doc: python: refreshing virtualenv section for venv#77569
doc: python: refreshing virtualenv section for venv#77569jonringer merged 1 commit intoNixOS:masterfrom
Conversation
|
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 |
jonringer
left a comment
There was a problem hiding this comment.
LGTM, thank you for updating docs :)
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 NixOS#77569
Motivation for this change
Updating section about imperative use of ad-hoc virtual-environments
for use of pythons built-in
venvmodule. 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
sandboxinnix.confon non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"./result/bin/)nix path-info -Sbefore and after)