Skip to content

Commit 2969d75

Browse files
authored
docs: Recommend uv in contributing guide (#873)
1 parent 62c8ada commit 2969d75

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed

CONTRIBUTING.md

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,22 +47,41 @@ git clone git@github.com:YOUR-USERNAME/narwhals.git
4747

4848
### 4. Setting up your environment
4949

50-
Here's how you can set up your local development environment to contribute:
51-
52-
1. Make sure you have Python3.8+ installed (for example, Python 3.11)
53-
2. Create a new virtual environment with `python3.11 -m venv .venv` (or whichever version of Python3.9+ you prefer)
54-
3. Activate it: `. .venv/bin/activate`
55-
4. Install Narwhals: `pip install -e .`
56-
5. Install test requirements: `pip install -r requirements-dev.txt`
57-
6. Install docs requirements: `pip install -r docs/requirements-docs.txt`
50+
Here's how you can set up your local development environment to contribute.
51+
52+
#### Option 1: Use UV (recommended)
53+
54+
1. Make sure you have Python3.8+ installed (for example, Python 3.11), create a virtual environment,
55+
and activate it. If you're new to this, here's one way that we recommend:
56+
1. Install uv: https://github.com/astral-sh/uv?tab=readme-ov-file#getting-started
57+
2. Install some version of Python greater than Python3.8. For example, to install
58+
Python3.11:
59+
```
60+
uv python install 3.11
61+
```
62+
3. Create a virtual environment:
63+
```
64+
uv venv -p 3.11 --seed
65+
```
66+
4. Activate it. On Linux, this is `. .venv/bin/activate`, on Windows `.\.venv\Scripts\activate`.
67+
2. Install Narwhals: `uv pip install -e .`
68+
3. Install test requirements: `uv pip install -r requirements-dev.txt`
69+
4. Install docs requirements: `uv pip install -r docs/requirements-docs.txt`
5870
5971
You should also install pre-commit:
6072
```
61-
pip install pre-commit
73+
uv pip install pre-commit
6274
pre-commit install
6375
```
6476
This will automatically format and lint your code before each commit, and it will block the commit if any issues are found.
6577
78+
#### Option 2: use python3-venv
79+
80+
1. Make sure you have Python 3.8+ installed. If you don't, you can check [install Python](https://realpython.com/installing-python/)
81+
to learn how. Then, [create and activate](https://realpython.com/python-virtual-environments-a-primer/)
82+
a virtual environment.
83+
2. Then, follow steps 2-4 from above but using `pip install` instead of `uv pip install`.
84+
6685
### 5. Working on your issue
6786
6887
Create a new git branch from the `main` branch in your local repository.

0 commit comments

Comments
 (0)