Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pysc2: init at 1.2 #30552

Merged
merged 6 commits into from
Nov 14, 2017
Merged

pysc2: init at 1.2 #30552

merged 6 commits into from
Nov 14, 2017

Conversation

ghost
Copy link

@ghost ghost commented Oct 18, 2017

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

Sorry, something went wrong.

@ghost ghost requested a review from FRidh as a code owner October 18, 2017 21:16
+
+if (sys.version_info[0] == 2
+ or (sys.version_info[0] == 3 and sys.version_info[1] < 4)):
+ requires.append('enum34')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also send this upstream?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would like to eventually, but i have to do some legwork on the google contributors agreement before that's possible.

name = "absl-py-${version}";

src = fetchurl {
url = "mirror://pypi/a/absl-py/${name}.tar.gz";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use here in and in the other cases fetchPypi instead of fetchurl.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@ghost ghost force-pushed the pysc2-init branch from b2889f5 to 35f35f5 Compare October 18, 2017 21:28
Copy link
Member

@FRidh FRidh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will you maintain these packages?

sha256 = "017wc85i7l3vpjzw3shgb7k7n0jfid88g09dlf1kgdy4ll0sjfax";
};

buildInputs = [ six ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

propagatedBuildInputs if six is in install_requires of setup.py.


buildInputs = [ argparse ];

doCheck = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? Leave a comment.

sha256 = "01q0xh2fy3zzsrfr45d2ypj4whs7s060cy1rnprg6sg55fbgbaih";
};

buildInputs = [ argparse ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

argparse has been removed from our package set. Patch the source to remove the dependency on argparse.

@ghost ghost force-pushed the pysc2-init branch from 35f35f5 to 7c35c3c Compare October 19, 2017 21:40
@ghost ghost requested a review from edolstra as a code owner October 19, 2017 21:40
@ghost
Copy link
Author

ghost commented Oct 19, 2017

@FRidh yes, i intend on maintaining these packages. i've added myself to the maintainers list and marked myself as each package's maintainer accordingly.

@ghost ghost force-pushed the pysc2-init branch from 5d3b833 to eef09ad Compare October 23, 2017 16:36
@@ -257,6 +259,8 @@ in {
pythonPackages = self;
};

pysc2 = callPackage ../development/python-modules/pysc2 { };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this supposed to be used as a library or a command line application?

Copy link
Author

@ghost ghost Oct 23, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both. The package comes with scripts for running a machine learning agent as a player in a Starcraft 2 scenario, but it is also a library for creating such an agent.

wrapProgram $f \
--set SC2PATH "${sc2-headless}"
done
'';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It won't be able to find sc2 when you use this package as a library and you try to import this package. If this should be supported (and considering you wrote it can be used as a library I think that's the case), then instead of wrapping the executables the path to sc2 should be hardcoded, e.g. here https://github.com/deepmind/pysc2/blob/c8ad5e8fdc0fff5549c575abea9acbf11d903fe0/pysc2/run_configs/platforms.py#L122

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for that. When I looked at the library aspect of the package it did not occur to me that someone could want to launch the environment in their own code instead of invoking one of the bin scripts with their agent as an argument. I've updated it to apply a patch that enables us to substitute the correct path and also cleans up their LD_LIBRARY_PATH manipulations since they aren't necessary in nix.

@ghost
Copy link
Author

ghost commented Nov 13, 2017

@FRidh Is there anything else I should do to improve this PR further?

Copy link
Member

@FRidh FRidh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A commit per expression/package is needed.

, lib
, fetchPypi
, six
, pytest
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused

{ buildPythonPackage
, lib
, fetchPypi
, argparse
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused

{ buildPythonPackage
, lib
, fetchPypi
, argparse
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused

absl-py
enum34
future
mock
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it need mock during runtime? Its quite unlikely. Remember, install_requires goes here. tests_require goes to checkInputs

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Their setup.py lists mock as an install_requires instead of a tests_requires [0]. They use it in a file that is part of their lib package. I suspect that it is a test that was just misplaced but it is where it is.

[0] https://github.com/deepmind/pysc2/blob/master/setup.py#L64
[1] https://github.com/deepmind/pysc2/blob/master/pysc2/lib/stopwatch_test.py

@ghost ghost force-pushed the pysc2-init branch from 7b8ae6d to 2e81984 Compare November 14, 2017 19:35
@ghost ghost requested a review from nbp as a code owner November 14, 2017 19:35
@ghost ghost force-pushed the pysc2-init branch from 2e81984 to 6a70e7f Compare November 14, 2017 19:38
@ghost
Copy link
Author

ghost commented Nov 14, 2017

Thank you @FRidh for taking a close look at this PR. I've clearly bitten off more than I can chew but I'm glad to put in the work to get this ready to merge. I've implemented all of the changes you've requested except for the one involving mock. I've confirmed that the module that uses mock is available to the user at runtime and so it has to be included as an install dependency.

@FRidh FRidh merged commit 0cedba1 into NixOS:master Nov 14, 2017
@FRidh
Copy link
Member

FRidh commented Nov 14, 2017

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants