-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
poetry-plugin-up: init at 0.2.1 #211231
poetry-plugin-up: init at 0.2.1 #211231
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.
Use pytestCheckHook
to run the tests.
pkgs/top-level/all-packages.nix
Outdated
@@ -16383,6 +16383,8 @@ with pkgs; | |||
|
|||
poetry = callPackage ../tools/package-management/poetry { }; | |||
|
|||
poetry-plugin-up = callPackage ../tools/package-management/poetry-plugin-up { }; |
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.
This should be in python-packages.nix
.
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.
Why? It's not going to be useful with any Python version but the one Poetry is built with.
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.
It could also live at poetry.plugins
or something like that.
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 thought about that but I'm not sure if it's worth adding another scope when we only have one package to put under it.
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.
It is. We can ensure that plugins use the same Python package set in two ways: the plugins
argument becomes a function that is passed python.pkgs
(see home-assistant) and plugins are packaged in python3Packages
, or plugins live in poetry.plugins
where they're automatically built with the correct Python package set.
Tests won't run because we don't have a Poetry. |
940f57c
to
ef2b18c
Compare
Applied all the style fixes. |
Add poetry to checkInputs, disable |
That's still not going to work because Poetry doesn't propagate its dependencies (see #209534). |
ef2b18c
to
234dbed
Compare
] ++ lib.optionals (pythonOlder "3.8") [ | ||
backports-cached-property |
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.
We can remove that, we no longer support 3.8
234dbed
to
265b7f6
Compare
Rebased to catch the nativeCheckInputs change. |
9db73c1
to
8dd486f
Compare
Introduce a wrapper for Poetry instead of manually unpropagating things, which also allows using unwrapped Poetry as an input when necessary. Also add poetry-plugin-up as an example.
8dd486f
to
2c96102
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.
I think this is more complicated than it needs to be. I don't see why one type of wrapping shouldn't suffice and I'm not fond of the $PYTHONPATH
hackery.
Thus I tried to achieve the same thing just using overridePythonAttrs
and thought that it's maybe a good idea to put the actual expression for poetry in a separate file unwrapped.nix
. See #213914 for my suggestion.
passthru = { | ||
inherit unwrapped python; | ||
withPlugins = selector: let | ||
pluginsSet = python.pkgs.callPackage ./plugins { |
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.
You can use import
The reason I went with a double wrapper here is mostly to avoid rebuilding poetry itself, which is not particularly slow but also kinda slow. |
That does make sense indeed. I guess I could copy the double wrapper in my approach if that's preferred. |
Cleaner than what? Sorry, might be missing something... |
You're right, your approach is almost the same in this regard. So never mind. |
|
||
wrapWithPlugins = '' | ||
buildPythonPath $plugins | ||
makeWrapper ${unwrapped}/bin/poetry $out/bin/poetry --suffix PYTHONPATH : "$program_PYTHONPATH" |
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.
This is basically a no-op if $program_PYTHONPATH
is empty. Is there a specific reason you're using a different wrapper in that case?
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.
It's a tiny efficiency thing, probably not worth worrying about realistically.
#213914 looks simpler and is the more python-native approach using I think I prefer it also because it relies less on a bespoke wrapping logic, like is the case here. The downside of the override approach is that you get to rebuild poetry, which takes a minute on my desktop due to five very slow tests. We could however also just disable tests on the overridden derivation to get that penalty out of the way. (formed this opinion while discussing the situation with K900 in a private chat) |
I definitely like the |
That's a good compromise.
The advantage of adding inputs is that it's going to be correct in the future even if |
Then I'm just going to close this in favor of #213914. |
Description of changes
A plugin to update dependencies to latest even if pyproject.toml says not to.
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/
)nixos/doc/manual/md-to-db.sh
to update generated release notes