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

Add python packages: pyensembl and its dependencies, gffutils #89213

Closed
wants to merge 13 commits into from

Conversation

moritzschaefer
Copy link
Contributor

@moritzschaefer moritzschaefer commented May 30, 2020

Motivation for this change

Replaces PR #87551

Both pyenseml and gffutils are commonly used python packages (> 100 stars on GitHub), so I added them to nix packages.

Things done
  • Built on platform(s)
    • NixOS
  • 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 nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/) (only pyensembl has a supplemental binary)
  • Ensured that relevant documentation is up to date
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • [-] Mostly Fits CONTRIBUTING.md. I designed the derivations 1:1 to existing ones.

Copy link
Contributor

@jonringer jonringer left a comment

Choose a reason for hiding this comment

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

please add yourself as a maintainer for all packages that you're adding.

please attempt to sort the package entries in python-packages

pkgs/development/python-modules/datacache/default.nix Outdated Show resolved Hide resolved
pkgs/development/python-modules/datacache/default.nix Outdated Show resolved Hide resolved

checkPhase = ''
# sh gffutils/test/data/download-large-annotation-files.sh
# nosetests
Copy link
Contributor

Choose a reason for hiding this comment

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

why no test suite?

Suggested change
# nosetests
# nosetests

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The tests fail inside the nix environment

Copy link
Contributor

Choose a reason for hiding this comment

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

general consensus is to just ignore test cases that fail due to sandbox environment. But some test failures may be indications that the package is in an actual broken state.

tests are also very useful for verifying that dependency bumps don't cause regressions.

pkgs/development/python-modules/gtfparse/default.nix Outdated Show resolved Hide resolved
pkgs/development/python-modules/scikit-plot/default.nix Outdated Show resolved Hide resolved
pkgs/development/python-modules/serializable/default.nix Outdated Show resolved Hide resolved
Comment on lines 12 to 13
checkInputs = [ ];
propagatedBuildInputs = [ ];

checkPhase = ''
${python.interpreter} -c 'import tinytimer'
'';

# Tests require extra dependencies
doCheck = true;

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
checkInputs = [ ];
propagatedBuildInputs = [ ];
checkPhase = ''
${python.interpreter} -c 'import tinytimer'
'';
# Tests require extra dependencies
doCheck = true;
pythonImportsCheck = [ "tinytimer" ];

Comment on lines 7408 to 7426
typechecks = callPackage ../development/python-modules/typechecks { };

datacache = callPackage ../development/python-modules/datacache { };

memoized-property = callPackage ../development/python-modules/memoized-property { };

gtfparse = callPackage ../development/python-modules/gtfparse { };

serializable = callPackage ../development/python-modules/serializable { };

tinytimer = callPackage ../development/python-modules/tinytimer { };

pyensembl = callPackage ../development/python-modules/pyensembl { };

gffutils = callPackage ../development/python-modules/gffutils { };

scikit-plot = callPackage ../development/python-modules/scikit-plot { };

pybedtools = callPackage ../development/python-modules/pybedtools { };
Copy link
Contributor

Choose a reason for hiding this comment

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

please attempt to sort these

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't get the sorting schema of this file. It appears to be somewhat alphabetically, but not as a whole but rather for a set regions within the file.

Wouldn't it make more sense to sort the file "entirely" from time to time?

Copy link
Contributor

Choose a reason for hiding this comment

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

it has been evolving over time... some people grouped similar packages, some people just dropped them anywhere. At the very least, random listings should be avoided

@moritzschaefer
Copy link
Contributor Author

Thank you for your comments @jonringer! I have simplified all the files and added myself as maintainer. Please let me know if something still requires improvements.

@moritzschaefer
Copy link
Contributor Author

@jonringer After having applied all the requested changes, I wanted to da a final rebase on master so I did

git checkout python-packages
git pull --rebase official master # official points to github.com/NIXOS/nixpgs.git

This resulted in a merge commit and now the PR is blown up with 370 commits. Is this an issue and if yes, would you mind telling me what went wrong?

@jonringer
Copy link
Contributor

with --rebase, there shouldn't be a merge commit.

And it looks like you pulled in master. Assuming the merge is the main culprit, you could do git reset HEAD^ --hard but, I'm not sure exactly what you've done.

If all else failes, you could cherry pick the commits into a new branch and just push that

@moritzschaefer
Copy link
Contributor Author

moritzschaefer commented Jun 4, 2020

Indeed trashing the merge commit seemed to have fixed it. So no cherry-picking-in-new-branch required.

I noticed that two packages failed to build because of failing tests, even though checkPhase was not set (it seems that it is set to some default python test runner). I explicitly disabled tests for them using doCheck = false;

I'm anyways surprised that this wasn't detected by the @GrahamcOfBorg bot, which showed green for all tests.

@jonringer
Copy link
Contributor

if you still want to get this into nixpkgs, you can break this up into smaller PRs, just adding a package at a time. It will be a lot less time intensive than having to cover all of it.

@moritzschaefer
Copy link
Contributor Author

Dear @jonringer,

thanks for the response. I'll transition to adding these packages into my overlays and close this PR as there are definitely more important PRs (from me and others) for the moment.

Still, I am kind of missing some kind of strategy for pypi packages. In a conversation on the nixos-discourse, I got the notion that it is not desired to add the majority of pypi packages to nixpkgs. However it is really cumbersome to build a derivation for each single python package, when you're working in a non-mainstream field.

Is there some kind of vision for this issue?

@jonringer
Copy link
Contributor

In general the preference is to have python packages available which enable an application, and less so to "just have the package".

However it is really cumbersome to build a derivation for each single python package, when you're working in a non-mainstream field.

You can use nix with venv to bring in missing python packages. I got a video about it https://www.youtube.com/watch?v=jXd-hkP4xnU , and some docs here: https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/python.section.md#how-to-consume-python-modules-using-pip-in-a-virtual-environment-like-i-am-used-to-on-other-operating-systems

If you still want a pure nix way to do it, I would look at mach-nixhttps://github.com/DavHau/mach-nix

@moritzschaefer moritzschaefer mentioned this pull request Nov 28, 2020
10 tasks
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