-
Notifications
You must be signed in to change notification settings - Fork 18
Add how-to for creating an environment #247
Add how-to for creating an environment #247munkm wants to merge 11 commits intoscientific-python:main from
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. |
@guenp
guenp
left a comment
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, just one nit
Co-authored-by: Guen Prawiroatmodjo <guenevere.p@gmail.com>
@matthewfeickert
matthewfeickert
left a comment
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.
@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!
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.
Following pip example syntax
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
danielballan
left a comment
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.
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.
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.
science ❤️
guenp
commented
May 14, 2025
Maybe we should link other resources on here as well?
e.g.
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 pip and uv pip, native conda tools are conda and mamba/micromamba, all-in-one Conda is pixi, and all-in-one PyPI is uv (which I think is missing here). pip and uv pip could be inline tabs, since they are nearly the same. Same with conda/mamba (mamba and micromamba are the same these days, just different linkages when building). While there could also be page-wide tabs could be these four.
Something like this:
┌──────┐┌──────┐┌──────┐┌──────┐
│pip ││conda ││pixi ││uv │
│ ╰┴──────┴┴──────┴┴──────┴────────────╮
│ │
│ ┌──────┐┌────────┐ │
│ │pip ││uv pip │ │
│ │ ╰┴────────┴───────────────────╮ │
│ │ │ │
│ │ python -m venv .venv │ │
│ │ │ │
│ ╰────────────────────────────────────╯ │
│ ... │
╰───────────────────────────────────────────╯
I would recommend calling the virtual environment .venv. That's the default in uv, it gets picked up by the Python launcher for Unix, by VSCode, and is ignored in most repository gitignore's.
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.