Skip to content

Commit e309826

Browse files
samcunliffepaddyroddymatt-graham
authored
Add uv and pixi. (#464)
Resolves #419. Notably not done, is that I've not updated the tutorial.md to use `uv` instead of Anaconda. I'd need to use a Windows machine to test the instructions before I'd feel confident changing the tutorial. --------- Co-authored-by: Patrick J. Roddy <[email protected]> Co-authored-by: Matt Graham <[email protected]>
1 parent df14157 commit e309826

2 files changed

Lines changed: 23 additions & 43 deletions

File tree

README.md

Lines changed: 11 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,13 @@ We also have a detailed [tutorial](tutorial.md) that has been given in a couple
7575
The tutorial goes into much more pedagogical detail, it both describes using the template to create a package
7676
and how to use the newly created package with some of the tools included.
7777

78-
1. Install [cookiecutter] in a Conda or `venv` environment (commented lines for
79-
Conda example).
78+
1. Install [cookiecutter] in a `uv venv` or `conda` environment (commented lines for
79+
`uv venv` example).
8080

8181
```sh
82-
# conda create --channel conda-forge --name new-env-name
83-
# conda activate new-env-name
84-
# conda install pip
85-
pip install cookiecutter
82+
# uv venv # creates a .venv directory wherever you are
83+
# source ./.venv/bin/activate
84+
uv pip install cookiecutter
8685
```
8786

8887
2. Run cookiecutter in the desired directory
@@ -114,36 +113,13 @@ and how to use the newly created package with some of the tools included.
114113
package_name [python_template]: PACKAGE_NAME
115114
```
116115
117-
we will get a project folder named `PROJECT_SLUG`, structured like this:
118-
119-
```sh
120-
PROJECT_SLUG
121-
├── ...
122-
├── README.md
123-
├── pyproject.toml
124-
├── src
125-
│ └── PACKAGE_NAME
126-
│ └── __init__.py
127-
└── tests
128-
└── test_dummy.py
129-
```
130-
131-
And the `PROJECT_NAME` will appear in the README.md as the human-readable
132-
name of the project.
133-
134-
```sh
135-
cat PROJECT_SLUG/README.md
136-
# PROJECT_NAME
137-
...
138-
```
139-
140116
5. To work on your project, initialise a Git repository and _install_ it in
141117
editable mode.
142118
143119
```sh
144120
cd PROJECT_SLUG
145121
git init
146-
python -m pip install -e ".[dev]"
122+
uv pip install -e ".[dev]"
147123
```
148124

149125
6. Build your package
@@ -175,10 +151,10 @@ cd python-tooling
175151
- To create and remove your virtual environment
176152

177153
```sh
178-
conda create -n ptoolingVE pip -c conda-forge
179-
conda activate ptoolingVE
180-
conda deactivate ptoolingVE
181-
conda remove -n ptoolingVE --all
154+
uv venv
155+
source .venv/bin/activate
156+
# do your work
157+
deactivate
182158
```
183159

184160
- To run template in the same path of this repo. We do a test cookiecut of a
@@ -188,7 +164,7 @@ cd python-tooling
188164
cookiecutter .
189165
cd python-template
190166
git init
191-
python -m pip install -e ".[dev]"
167+
uv pip install -e ".[dev]"
192168
```
193169

194170
- To run cookiecutter using a specific branch of the template:

docs/pages/virtual.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,22 @@ layout: default
55

66
## Virtual environments
77

8-
| Name | Short description | 🚦 |
9-
| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-: |
10-
| conda-forge [miniforge] | Installs, runs, and updates packages and their dependencies. Uses `conda`, but with community maintained packages from `conda-forge` channel instead of commercially maintained packages. | 🟢 |
11-
| [pipenv] | Automatically creates and manages a virtualenv for your projects. | 🟠 |
12-
| [pyenv] | Lets you easily switch between multiple versions of Python. | 🟠 |
13-
| [virtualenv] | Creates isolated Python environments, and offers more features than venv. | 🟠 |
14-
| [venv] | Creates isolated Python environments. Fewer features than other tools, but very widely used and comes built into Python. | 🟠 |
15-
| [anaconda] | Due to recent [licensing ambiguity][anaconda-problems], we recommend avoiding anaconda and many of the default channels. We recommend installing miniforge and sticking to the `conda-forge` channel. | 🔴 |
8+
| Name | Short description | 🚦 |
9+
| ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-: |
10+
| conda-forge [miniforge] | Installs, runs, and updates packages and their dependencies. Uses `conda`, but with community maintained packages from `conda-forge` channel instead of commercially maintained packages. | 🟢 |
11+
| [uv] | Fast dependency (and project) management tool. A drop-in replacement for `venv`. This will probably become our 🟢 tool, but for now we are playing cautious as there are some open bugs and features. If you're comfortable using `venv` syntax we'd recommend this. | 🟠 |
12+
| [pipenv] | Automatically creates and manages a virtualenv for your projects. | 🟠 |
13+
| [pixi] | A fast drop-in replacement for `conda`. | 🟠 |
14+
| [pyenv] | Lets you easily switch between multiple versions of Python. | 🟠 |
15+
| [virtualenv] | Creates isolated Python environments, and offers more features than venv. | 🟠 |
16+
| [venv] | Creates isolated Python environments. Fewer features than other tools, but very widely used and comes built into Python. | 🟠 |
17+
| [anaconda] | Due to recent [licensing ambiguity][anaconda-problems], we recommend avoiding anaconda and many of the default channels. We recommend installing miniforge and sticking to the `conda-forge` channel. | 🔴 |
1618

1719
<!-- links here for a more readable table -->
1820

1921
[miniforge]: https://conda-forge.org/download/
22+
[uv]: https://docs.astral.sh/uv/getting-started/installation/
23+
[pixi]: https://pixi.sh/latest/#installation
2024
[pipenv]: https://pipenv.pypa.io/en/latest/
2125
[pyenv]: https://github.com/pyenv/pyenv
2226
[virtualenv]: https://virtualenv.pypa.io/en/latest/

0 commit comments

Comments
 (0)