You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2210818
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+11-22Lines changed: 11 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -76,20 +76,17 @@ Before you can contribute, you will need to [fork the `sentry-python` repository
76
76
77
77
### Create a Virtual Environment
78
78
79
-
To keep your Python development environment and packages separate from the ones
80
-
used by your operation system, create a [virtual environment](https://docs.python.org/3/tutorial/venv.html):
79
+
We use [uv](https://docs.astral.sh/uv/) to manage the project's virtual environment and dev dependencies. Install uv following the [official instructions](https://docs.astral.sh/uv/getting-started/installation/), then run:
81
80
82
81
```bash
83
82
cd sentry-python
84
83
85
-
python -m venv .venv
84
+
uv sync
86
85
```
87
86
88
-
Then, activate your virtual environment with the following command. You will need to repeat this step every time you wish to work on your changes for `sentry-python`.
87
+
This creates a `uv` managed `.venv` (using the Python version pinned in `.python-version`) and installs the project's dev dependencies (tox, tox-uv, etc.) into it. It is recommended not to deal with this `.venv` manually but only through `uv`.
89
88
90
-
```bash
91
-
source .venv/bin/activate
92
-
```
89
+
Invoke commands via `uv run <cmd>` (e.g. `uv run tox -e py3.14-common`).
93
90
94
91
### Install `sentry-python` in Editable Mode
95
92
@@ -103,16 +100,10 @@ pip install -e .
103
100
104
101
### Install Coding Style Pre-commit Hooks
105
102
106
-
This will make sure that your commits will have the correct coding style.
103
+
`pre-commit` is included in the project's dev dependencies (installed by `uv sync`). Register the git hooks with:
107
104
108
105
```bash
109
-
cd sentry-python
110
-
111
-
pip install -r requirements-devenv.txt
112
-
113
-
pip install pre-commit
114
-
115
-
pre-commit install
106
+
uv run pre-commit install
116
107
```
117
108
118
109
That's it. You should be ready to make changes, run tests, and make commits! If you experience any problems, please don't hesitate to ping us in our [Discord Community](https://discord.com/invite/Ww9hbqr).
@@ -121,34 +112,32 @@ That's it. You should be ready to make changes, run tests, and make commits! If
121
112
122
113
We test against a number of Python language and library versions, which are automatically generated and stored in the [tox.ini](tox.ini) file. The `envlist` defines the environments you can choose from when running tests, and correspond to package versions and environment variables. The `TESTPATH` environment variable, in turn, determines which tests are run.
123
114
124
-
The tox CLI tool is required to run the tests locally. Follow [the installation instructions](https://tox.wiki/en/latest/installation.html) for tox. Dependencies are installed for you when you run the command below, but _you_ need to bring an appropriate Python interpreter.
125
-
126
-
[Pyenv](https://github.com/pyenv/pyenv) is a cross-platform utility for managing Python versions. You can also use a conventional package manager, but not all versions may be distributed in the package manager of your choice. For macOS, versions 3.8 and up can be installed with Homebrew.
115
+
`uv` manages both `tox` (installed as a dev dependency via `uv sync`) and the Python interpreters used by each tox environment — you don't need to install them yourself. Invoke tox via `uv run tox ...`.
127
116
128
117
An environment consists of the Python major and minor version and the library name and version. The exception to the rule is that you can provide `common` instead of the library information. The environments tied to a specific library usually run the corresponding test suite, while `common` targets all tests but skips those that require uninstalled dependencies.
129
118
130
119
To run Celery tests for version v5.5.3 of its Python library using a 3.12 interpreter, use
131
120
132
121
```bash
133
-
tox -p auto -o -e py3.12-celery-v5.5.3
122
+
uv run tox -p auto -o -e py3.12-celery-v5.5.3
134
123
```
135
124
136
125
or to use the `common` environment, run
137
126
138
127
```bash
139
-
tox -p auto -o -e py3.12-common
128
+
uv run tox -p auto -o -e py3.12-common
140
129
```
141
130
142
131
To select specific tests, you can forward arguments to `pytest` like so
143
132
144
133
```bash
145
-
tox -p auto -o -e py3.12-celery-v5.5.3 -- -k test_transaction_events
134
+
uv run tox -p auto -o -e py3.12-celery-v5.5.3 -- -k test_transaction_events
146
135
```
147
136
148
137
In general, you use
149
138
150
139
```bash
151
-
tox -p auto -o -e <tox_env> -- <pytest_args>
140
+
uv run tox -p auto -o -e <tox_env> -- <pytest_args>
0 commit comments