-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
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
pysc2: init at 1.2 #30552
Conversation
+ | ||
+if (sys.version_info[0] == 2 | ||
+ or (sys.version_info[0] == 3 and sys.version_info[1] < 4)): | ||
+ requires.append('enum34') |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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"; |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this 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 ]; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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 ]; |
There was a problem hiding this comment.
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.
@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. |
@@ -257,6 +259,8 @@ in { | |||
pythonPackages = self; | |||
}; | |||
|
|||
pysc2 = callPackage ../development/python-modules/pysc2 { }; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 | ||
''; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
@FRidh Is there anything else I should do to improve this PR further? |
There was a problem hiding this 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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
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. |
Thanks! |
Motivation for this change
Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)