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
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+34-10Lines changed: 34 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -74,38 +74,62 @@ On macOS, we recommend using `brew` to install Python. For Windows, we recommend
74
74
75
75
Before you can contribute, you will need to [fork the `sentry-python` repository](https://github.com/getsentry/sentry-python/fork). Then, clone the forked repository to your local development environment.
76
76
77
-
### Create a Virtual Environment
77
+
78
+
### Development Tooling
78
79
79
80
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:
80
81
81
82
```bash
82
83
cd sentry-python
83
-
84
84
uv sync
85
85
```
86
86
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`.
88
-
89
87
Invoke commands via `uv run <cmd>` (e.g. `uv run tox -e py3.14-common`).
90
88
91
-
###Install `sentry-python` in Editable Mode
89
+
#### Linting / Formatting
92
90
93
-
Install `sentry-python` in [editable mode](https://pip.pypa.io/en/latest/topics/local-project-installs/#editable-installs). This will make any changes you make to the SDK code locally immediately effective without you having to reinstall or copy anything.
91
+
We use `ruff` to lint and format our code. Use the following commands:
94
92
95
-
```bash
96
-
pip install -e .
93
+
```
94
+
uv run ruff check --fix tests sentry_sdk
95
+
uv run ruff format tests sentry_sdk
97
96
```
98
97
99
-
**Hint:** Sometimes you need a sample project to run your new changes to `sentry-python`. In this case install the sample project in the same virtualenv and you should be good to go.
98
+
#### Typing
99
+
100
+
We use `mypy` for typing our codebase. Use the following command to typecheck the source:
100
101
101
-
### Install Coding Style Pre-commit Hooks
102
+
```
103
+
uv run --group typing mypy sentry_sdk
104
+
```
105
+
106
+
##### Install Coding Style Pre-commit Hooks
102
107
103
108
`pre-commit` is included in the project's dev dependencies (installed by `uv sync`). Register the git hooks with:
104
109
105
110
```bash
106
111
uv run pre-commit install
107
112
```
108
113
114
+
Now, pre-commit will automatically lint your changes with `ruff`.
115
+
116
+
117
+
### Install `sentry-python` in Editable Mode
118
+
119
+
Install `sentry-python` in [editable mode](https://pip.pypa.io/en/latest/topics/local-project-installs/#editable-installs). This will make any changes you make to the SDK code locally immediately effective without you having to reinstall or copy anything.
120
+
121
+
```bash
122
+
pip install -e .
123
+
```
124
+
125
+
or
126
+
127
+
```bash
128
+
uv add --editable .
129
+
```
130
+
131
+
**Hint:** Sometimes you need a sample project to run your new changes to `sentry-python`. In this case install the sample project in the same virtualenv and you should be good to go.
132
+
109
133
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).
0 commit comments