Skip to content

Commit 60ab4d9

Browse files
committed
pre-commit and instructions
1 parent 92ffa80 commit 60ab4d9

6 files changed

Lines changed: 91 additions & 35 deletions

File tree

‎AGENTS.md‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,29 @@
22

33
## Tox
44

5-
- Run tox via uv: `uv run -- tox -e <env>`
5+
- Run tox via uv: `uv run tox -e <env>`
66
- `tox` + `tox-uv` are declared as the project's default dev dependencies in `pyproject.toml`, so uv installs them automatically into `.venv`.
77

88
## Package Manager
99

1010
Use **tox** for testing (not pytest directly):
1111
- Test matrix configuration is in `tox.ini`
12-
- Integration tests: `tox -e py3.14-{integration}-v{version}`
13-
- Common tests: `tox -e py3.14-common`
14-
- Run specific test file: `TESTPATH=tests/integrations/logging/test_logging.py tox -e py3.14-common`
15-
- Run single test: `TESTPATH=tests/path/to/test_file.py tox -e py3.14-common -- -k "test_name"`
12+
- Integration tests: `uv run tox -e py3.14-{integration}-v{version}`
13+
- Common tests: `uv run tox -e py3.14-common`
14+
- Run specific test file: `TESTPATH=tests/integrations/logging/test_logging.py uv run tox -e py3.14-common`
15+
- Run single test: `TESTPATH=tests/path/to/test_file.py uv run tox -e py3.14-common -- -k "test_name"`
1616

1717
## Type Checking
1818

1919
Use **tox** for type checking (not mypy directly):
20-
- Run `tox -e mypy` before committing (must pass with zero errors)
20+
- Run `uv run tox -e mypy` before committing (must pass with zero errors)
2121
- Strict mode enabled (`check_untyped_defs`, `disallow_untyped_defs`)
2222

2323
## Linting & Formatting
2424

2525
Use **tox** for linting (not ruff directly):
26-
- `tox -e ruff`
27-
- Full lint suite: `tox -e linters`
26+
- `uv run tox -e ruff`
27+
- Full lint suite: `uv run tox -e linters`
2828
- Full lint suite must pass before committing
2929

3030
## Commit Attribution

‎CONTRIBUTING.md‎

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -76,20 +76,17 @@ Before you can contribute, you will need to [fork the `sentry-python` repository
7676

7777
### Create a Virtual Environment
7878

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:
8180

8281
```bash
8382
cd sentry-python
8483

85-
python -m venv .venv
84+
uv sync
8685
```
8786

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, coverage, etc.) into it. It is recommended not to deal with this `.venv` manually but only through `uv`.
8988

90-
```bash
91-
source .venv/bin/activate
92-
```
89+
Invoke commands via `uv run <cmd>` (e.g. `uv run tox -e py3.14-common`).
9390

9491
### Install `sentry-python` in Editable Mode
9592

@@ -103,16 +100,10 @@ pip install -e .
103100

104101
### Install Coding Style Pre-commit Hooks
105102

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:
107104

108105
```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
116107
```
117108

118109
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).

‎Makefile‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
SHELL = /bin/bash
22

3-
VENV_PATH = tox.venv
3+
VENV_PATH = .venv
44

55
help:
66
@echo "Thanks for your interest in the Sentry Python SDK!"
@@ -12,17 +12,17 @@ help:
1212
@echo
1313
@false
1414

15-
$(VENV_PATH):
15+
.venv:
1616
python -m venv $(VENV_PATH)
17-
$(VENV_PATH)/bin/pip install tox tox-uv
17+
$(VENV_PATH)/bin/pip install tox
1818

19-
dist: $(VENV_PATH)
19+
dist: .venv
2020
rm -rf dist dist-serverless build
2121
$(VENV_PATH)/bin/pip install wheel setuptools
2222
$(VENV_PATH)/bin/python setup.py sdist bdist_wheel
2323
.PHONY: dist
2424

25-
apidocs: $(VENV_PATH)
25+
apidocs: .venv
2626
@$(VENV_PATH)/bin/pip install --editable .
2727
@$(VENV_PATH)/bin/pip install -U -r ./requirements-docs.txt
2828
rm -rf docs/_build

‎pyproject.toml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
#
22
# Project dev dependencies (PEP 735 `dev` group, installed by default).
3-
# Run tox with: `uv run -- tox -e <env>`
3+
# Run tox with: `uv run tox -e <env>`
44
#
55

66
[dependency-groups]
77
dev = [
88
"tox",
99
"tox-uv",
1010
"coverage[toml]",
11+
"pre-commit",
1112
]
1213

1314
#

‎requirements-devenv.txt‎

Lines changed: 0 additions & 6 deletions
This file was deleted.

‎uv.lock‎

Lines changed: 70 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)