Repository navigation
xonsh: refactor - #305316
xonsh: refactor#305316AndersonTorres wants to merge 3 commits into
Conversation
GrimmTheShrimp
left a comment
There was a problem hiding this comment.
I didn't do too much python packaging, but as i daily-drive xonsh here are a couple of my thoughts on the changes.
There was a problem hiding this comment.
Does this approach allow overriding the python version (not the packages), i.e. using xonsh with e.g. python 3.12 despite python 3.11.9 being the current python3 version?
There was a problem hiding this comment.
It uses the same Python provided by xonsh.passthru.
There was a problem hiding this comment.
ah so i can override python with e.g. xonsh.override {python3 = pkgs.python312; } and it'll eat it? Incredible, ty :)
|
Maybe this would be better to do in a separate pull request, but I think xonsh should be added to pythonPackages. Xonsh is meant to be used as both a library and an application |
|
So we need a complete overhaul?
This will be wild. |
I think so. This pull request is already a big improvement, though, since now overrides can be made on xonsh. If you want to go ahead and get this merged, and leave the library+application changes to another PR, that's a good choice too. |
|
Now I need testers! |
There was a problem hiding this comment.
Alright, i did some testing and this is what i found:
you can indeed override the python version and libraries, though a bit awkward:
programs.xonsh.package = let xonsh = pkgs.xonsh.override { python3Packages = pkgs.python312Packages; }; in xonsh.wrapper.override {
inherit xonsh;
extraPackages =
ps: with ps; [
requests
matplotlib
numpy
scipy
pygobject3
];
};the used python version can be checked by import sys; print(sys.executable), it'll print the store path of the used python.
Keep in mind the prompt toolkit that was pinned here does not yet fully support python 3.12, this is more a PoC and test whether it is possible rather than a serious suggestion.
Overriding python libraries still works, though obviously you have to override on the wrapper. That is honestly completely fine, its documented in the example. It might however break users config, so whether this can be merged before 24.05 is released is questionable.
Importing xonsh as a python library works, thoguh i never used xonsh as a python library so i can't say i tested that much.
Xonsh itself starts entirely fine, reports as version 0.16.0 and builds xonsh and prompt toolkit 3.0.39 just fine.
Built and tested on x86-64_linux.
|
Well, let's wait the branch off. |
|
The new changes are working for me. And I'm able to use the same override pattern that @LordGrimmauld mentioned to override xonsh package = let xonsh = pkgs.xonsh.overridePythonAttrs (old: {
src = pkgs.fetchgit { ... };
}); in xonsh.wrapper.override {
inherit xonsh;
extraPackages = ps: [
...
];
}; |
And a complete overhaul!
- xonsh now refers to the unwrapped derivation
- the wrapper is now called xonsh.wrapper
- use a self-referent argset
- Avoiding rec at all costs - until the day finalAttrs design pattern becomes
ubiquitous :)
- pin prompt-toolkit (upstream-upstream bug workaround)
|
Upstream has unpinned prompt-toolkit after xonsh/xonsh#5437, and worked out a fix for #206062 in xonsh/xonsh#5440. Would you like to apply those fixes in your PR? |
|
I am not exactly keen on the idea on wildly patching our packets on nix with fixes that are available upstream already and will soon be part of a release. Imo there is three options:
|
|
Let's close this, then. |
|
huh? But what happens to all the nice refactors then? Having this closed wasn't my intention! |
|
Short answer: my brain cells are (in the sense of "now") too dumb to deal with merge conflicts that came from nowhere. Times three. |
|
You feel like opening a new PR once things have settled down? I can help too if need be, feels a bit cheap telling you what is or isn't a good idea and then not do anything. |
Description of changes
Closes #301670 (by incorporation)
Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.