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
[staging] python: add pythonRemoveTestsDirHook #81538
Conversation
@GrahamcOfBorg build python38Packages.poetry |
actually, i need ofborg to evaluate |
@jonringer I recently implemented the same fix for poetry2nix as a hook: https://github.com/nix-community/poetry2nix/blob/master/hooks/fixup-hook.sh. It's better as a hook in regards to overrides. |
I used to just build a sdist first, as I needed that anyway when distributing source code. IMO that's how we should do it when building from git. |
this does solve the related issue:
|
I don't think we have a good mechanism to determine this, as both will hand us a |
Right, it would be a Nix function building a derivation, e.g. |
ec79110
to
9beff1e
Compare
I changed it to being a hook Seeing as the "tests" package on pypi https://pypi.org/project/tests/ is defunct, I think it's safe that you will never want a top-level "tests" package |
9beff1e
to
9072d09
Compare
or use the pre-existing |
pkgs/development/interpreters/python/hooks/python-remove-tests-dir-hook.sh
Outdated
Show resolved
Hide resolved
This will automatically remove a top-level "tests" directory from being installed.
9072d09
to
8cb9a57
Compare
Now that we're talking about hooks, I started off a hook that would remove requirements from a wheel master...FRidh:python-deps-hook, that way it should work regardless of where the dependency is listed. It's not functioning (need to look further into zipfile class) but it shows the idea. |
For packages that over-pin, I think this is great, but it still leans more on having tests to verify that a package set is still valid. (Overall, this is still needed. Testing is mostly orthogonal) It would remove a lot of pain around use-cases where |
with current changes, this has the expected behavior:
|
@FRidh does this look good to you? I know that the python ecosystem is mostly your baby |
I hope we could fix it at the source side instead of fixing up but I think we may have to do it this anyway. Something I quickly gave a try. So far the issue have been the packages for which an sdist was built using poetry. Rebuilding an sdist for those requires poetry resulting in recursion. The main issue is with those packages built using poetry so I prefer to look at that deeper before using the hammer. |
Actually I do not want to spend time on this, let's merge. |
Motivation for this change
closes: #81482
This could potentially create problems if there ever was a "tests" package. But I don't think that will ever be the case with how prevalent a "tests" directory is.
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)