-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
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
python3.pkgs.ruamel-base: add pythonNamespaces to remove nspkg.pth file #250830
Conversation
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.
Thank you so much for doing this! I had no idea that the pythonNamespaces
option does exactly what is needed here. Tangentially, it will make updating Sphinx so much easier.
Only ruamel-base
needs this, which you can verify by looking inside the sitePackages
directory of the built derivation. ruamel-yaml
was updated to use implicit namespaces, and ruamel-yaml-clib
doesn't seem to have a namespace inside of its output.
6cb5c5c
to
55596d3
Compare
Thanks. I have removed This hook seems a little hard to discover, and I found it only by searching |
I verified that this fixes the build of |
55596d3
to
2b2ff20
Compare
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.
Thank you!
@KiruyaMomochi, thanks for submitting this PR! In the future, when changing the base branch, I recommend first marking the PR as draft. Then change the branch and force-push, then unmark it as draft. Github's UI for changing the base branch is really terrible, and often causes a mass-review-request from everybody in the codeowners file during the branch change. But it won't do this for a PR which is marked as draft at the time the base-change or force-push happens. |
Description of changes
The Python package ruamel-* uses legacy namespace which produces
ruamel.*-1.0.0-py3.10-nspkg.pth
file. This causes wrapped python applications importtingruamel.yaml
throw aModuleNotFoundError
when$PYTHONPATH
is also set to contain ruamel packages. Although I don't understand the cause, this maybe related topypa/setuptools#3991.
For example, in a simple
devShell
with only ansible-lint package, runningansible-lint
command givesModuleNotFoundError: No module named 'ruamel.yaml'
. You can try it by runningnix develop github:KiruyaMomochi/nix-ruamel-lab
and then runansible-lint
.This issue does not occurs with ruamel-yaml 0.17.21 (update commit), because both the ruamel-base and ruamel-yaml contains .pth file. The former .pth file is overridden by the latter.
This PR fixes the problem by adding
pythonNamespaces
to all ruamel-* packages. This triggerspythonNamespacesHook
, so that all the .pth files are removed in these packages.Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)