-
-
Notifications
You must be signed in to change notification settings - Fork 15.4k
grib-api: Provide python bindings #25990
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
Conversation
@knedlsepp, thanks for your PR! By analyzing the history of the files in this pull request, we identified @FRidh to be a potential reviewer. |
Could you move the outputs to a "py" output? See e.g. libxml2. |
@FRidh: I'm not sure what you mean by that. I've been looking how other libraries in nixpkgs that provide python bindings do it and only found opencv and gdal, so I basically copied how it's done in opencv and gdal. |
@knedlsepp see #19631 and #20516 (I know realise they're duplicates). What I meant is that Python bindings are preferably put in a separate output (see multiple outputs in manual and moveToOuput function) to reduce closure size for programs that do not need the bindings. |
This provides a default method for using the grib-api python bindings.
So, by default we would build with bindings, however, the main output would not contain them. Instead, they're in the package.py derivation/output. |
644b83d
to
2ff56a1
Compare
@FRidh: I tried to split the output, but now when I try to run:
I get an import error for |
@@ -43,6 +47,11 @@ stdenv.mkDerivation rec{ | |||
ctest -R "t_definitions|t_calendar|t_unit_tests" -VV | |||
''; | |||
|
|||
postFixup = stdenv.lib.optionalString enablePython '' | |||
moveToOutput lib/${pythonPackages.python.libPrefix} "$py" |
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 think you can use moveToOutput ${python.sitePackages} "$py"
As long as you add a numpy store path somewhere, it typically works. Normally, we use |
I see, that's what is being done in libxml2Python
Honestly I'm a bit hesitant to add all that noise for what would result in a minor saving of disk space. (I just checked: The main library would cosume about 27MB, some tools built upon the lib in |
8d6b913
to
2ff56a1
Compare
@knedlsepp its up to you to choose as maintainer whether you maintain separate outputs or not. I suppose this package is not used as much as libxml2. We should definitely find a better way. Because its not possible to modify outputs I think in the long term we might want to take the direction I took for |
@FRidh: Would you consider merging? |
This provides a default method for using the grib-api python bindings.
Motivation for this change
Things done
(nix.useSandbox on NixOS,
or option
build-use-sandbox
innix.conf
on non-NixOS)
nix-shell -p nox --run "nox-review wip"
./result/bin/
)