Add how-to for creating an environment #247
Add how-to for creating an environment #247munkm wants to merge 11 commits intoscientific-python:mainfrom
Conversation
for more information, see https://pre-commit.ci
✅ Deploy Preview for learn-scientific-python-org ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
Co-authored-by: Guen Prawiroatmodjo <guenevere.p@gmail.com>
matthewfeickert
left a comment
There was a problem hiding this comment.
@munkm Thanks for this work and the PR! I've got some style change suggestions, small error corrections, and possible syntax revisions (but those could depend on what workflow you're trying to show).
Let me know if you have any questions!
| cd <path/to/science/> | ||
| source .venv/bin/activate |
There was a problem hiding this comment.
| cd <path/to/science/> | |
| source .venv/bin/activate | |
| source science/bin/activate |
Following pip example syntax
| Remember to re-activate your environment when you re-open a terminal. Navigate to | ||
| the science folder, and execute: | ||
|
|
||
| ```shell | ||
| pixi shell | ||
| ``` |
There was a problem hiding this comment.
Not sure if it is worth mentioning that both Pixi and uv have run options that allow for you to execute operations inside the virtual environment without explicitly activating them.
There was a problem hiding this comment.
Good point! I was having trouble when constructing this document deciding how broad (or narrow) to construct this document. I do think this is a useful tip. Do folks here think it should be included?
danielballan
left a comment
There was a problem hiding this comment.
Great addition! One structural suggestion to consider: The environment managers are covered in chronological order. It might be helpful to move uv up to after pip. Once you know pip, you mostly know uv. Likewise, once you know conda, you mostly know mamba. It could be helpful to emphasize that uv and mamba intentionally hem very close to the pip and conda interfaces respectively.
Then, by way of transitioning to the discussion on pixi, this comparison guide may be a good resource for readers.
| - pixi | ||
|
|
||
| In each of these examples we'll create a new virtual environment related to our | ||
| project called `science` (you can use whichever name you prefer!). We'll activate |
|
Maybe we should link other resources on here as well? |
|
Longer term, I think it makes sense to try to put these in tabs. Most users don't want to learn 4 package managers at the same time, generally they learn one at a time. This could also be used to display the structure: native PyPI tools are Something like this: I would recommend calling the virtual environment This overlaps a little with https://learn.scientific-python.org/development/tutorials/dev-environment/. |
Co-authored-by: Matthew Feickert <matthew.feickert@cern.ch>
Co-authored-by: Matthew Feickert <matthew.feickert@cern.ch>
for more information, see https://pre-commit.ci

Here I'm adding a how-to that includes creating an environment, installing some scientific python tools in the environment, and also installing dependencies from a file. This guide covers basic commands for venv,
I didn't modify https://github.com/scientific-python/learn.scientific-python.org/blob/main/content/contributors/setup/install.md to link to this at first, but depending on review I can do that here or open a new PR.