-
-
Notifications
You must be signed in to change notification settings - Fork 15.4k
doc: python: refreshing virtualenv section for venv #77569
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
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.
LGTM
If this is a supposedly popular way of working, why don't we provide a hook for this? |
what do you recommend this looking like?
|
Please have a look at #77644. |
I like the |
@jonringer: I think the shellhook is a decent idea to improve out of the box ease of use, but think the doc could be improved a bit, so I will adjust this PR to mention the hook, but I also think it might make sense to leave the "manual way" for educational reasons, for example if people need to adjust it to old-school virtualenv or similar. Does that make sense? |
Just to add why I wanted to minimally improve this example: While not overly idiomatic from nix perspective, I think this is a workflow that many new-comers are looking at when doing python. Likely because they have to deal with some projects / dependencies that are not packaged but also lack understanding yet of how to do it more idiomatically. I've observed questions about this a few times on IRC so decided to maybe add a few words to lower barrier to entry / for gradual transition. |
I think the explanation is good and helpful. Please use |
Oh, sorry, copy paste fail. Also forgot the pip install post hook. Will fix. |
7d68ff2
to
5ded64d
Compare
I wasn't trying to say this wasn't worthwhile, it's still an improvement to documentation which usually can always need some help. I was just trying to express that venvShellHook is a lot less repetitious |
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.
LGTM, thank you for updating docs :)
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.
otherwise LGTM
Updating section about imperative use of ad-hoc virtual-environments for use of pythons built-in `venv` module via venvShellHook. Also trying to make it a bit friendlier to beginners by adding a bit more explanation to the code snippet and some remarks old-school virtualenv. Adjusting for venvShellHook and adding manual example Adding pip install and replacing python2 example with python3
5ded64d
to
d69bfcd
Compare
I don't have merge rights, so would be nice if someone else could do that. |
sorry, forgot about this |
When updating the section to python 3 some places still referred to pythonPackages and were overlooked. Decided to switch it to be more similar to the first example binding pythonPackages and clarified comments a bit based on confusion I observed on IRC. Related to NixOS#77569
When updating the section to python 3 some places still referred to pythonPackages and were overlooked. Decided to switch it to be more similar to the first example binding pythonPackages and clarified comments a bit based on confusion I observed on IRC. Related to #77569
When updating the section to python 3 some places still referred to pythonPackages and were overlooked. Decided to switch it to be more similar to the first example binding pythonPackages and clarified comments a bit based on confusion I observed on IRC. Related to NixOS#77569
Motivation for this change
Updating section about imperative use of ad-hoc virtual-environments
for use of pythons built-in
venv
module. Also trying to make it a bitfriendlier to beginners by adding a bit more explanation to the code
snippet and some remarks about using python 2.7 + virtualenv
and making it a bit more usable out of the box by not trying to re-create
the virtual environment each time.
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)