python3.pkgs.ruamel-base: add pythonNamespaces to remove nspkg.pth file#250830
python3.pkgs.ruamel-base: add pythonNamespaces to remove nspkg.pth file#250830tjni merged 1 commit intoNixOS:stagingfrom
Conversation
There was a problem hiding this comment.
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
|
@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.pthfile. This causes wrapped python applications importtingruamel.yamlthrow aModuleNotFoundErrorwhen$PYTHONPATHis also set to contain ruamel packages. Although I don't understand the cause, this maybe related topypa/setuptools#3991.
For example, in a simple
devShellwith only ansible-lint package, runningansible-lintcommand givesModuleNotFoundError: No module named 'ruamel.yaml'. You can try it by runningnix develop github:KiruyaMomochi/nix-ruamel-laband 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
pythonNamespacesto all ruamel-* packages. This triggerspythonNamespacesHook, so that all the .pth files are removed in these packages.Things done
sandbox = trueset 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/)