Skip to content

Commit e48a4c3

Browse files
Revamped contributing.md
1 parent 0314293 commit e48a4c3

File tree

1 file changed

+56
-36
lines changed

1 file changed

+56
-36
lines changed

CONTRIBUTING.md

Lines changed: 56 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,39 @@
11
## Setting up the environment
22

3-
### With Rye
3+
We use [UV](https://docs.astral.sh/uv/) for fast, modern Python package management. UV automatically handles Python installation and virtual environment management.
44

5-
We use [Rye](https://rye.astral.sh/) to manage dependencies because it will automatically provision a Python environment with the expected Python version. To set it up, run:
5+
### Quick Setup
66

77
```sh
8-
$ ./scripts/bootstrap
8+
# Setup environment and dependencies
9+
$ uv run task bootstrap
10+
11+
# Install pre-commit hooks
12+
$ uv run task setup-pre-commit
913
```
1014

11-
Or [install Rye manually](https://rye.astral.sh/guide/installation/) and run:
15+
### Manual Setup
16+
17+
If you prefer to install UV manually:
1218

1319
```sh
14-
$ rye sync --all-features
20+
# Install UV - https://docs.astral.sh/uv/getting-started/installation/
21+
$ curl -LsSf https://astral.sh/uv/install.sh | sh
22+
23+
# Install dependencies
24+
$ uv sync --all-extras --group dev
1525
```
1626

17-
You can then run scripts using `rye run python script.py` or by activating the virtual environment:
27+
You can then run commands using `uv run` or by activating the virtual environment:
1828

1929
```sh
20-
# Activate the virtual environment - https://docs.python.org/3/library/venv.html#how-venvs-work
30+
# Activate the virtual environment
2131
$ source .venv/bin/activate
2232

23-
# now you can omit the `rye run` prefix
33+
# Now you can omit the `uv run` prefix
2434
$ python script.py
2535
```
2636

27-
### Without Rye
28-
29-
Alternatively if you don't want to install `Rye`, you can stick with the standard `pip` setup by ensuring you have the Python version specified in `.python-version`, create a virtual environment however you desire and then install dependencies using this command:
30-
31-
```sh
32-
$ pip install -r requirements-dev.lock
33-
```
34-
3537
## Modifying/Adding code
3638

3739
Most of the SDK is generated code. Modifications to code will be persisted between generations, but may
@@ -45,7 +47,7 @@ All files in the `examples/` directory are not modified by the generator and can
4547
```py
4648
# add an example to examples/<your-example>.py
4749

48-
#!/usr/bin/env -S rye run python
50+
#!/usr/bin/env -S uv run python
4951
5052
```
5153

@@ -72,9 +74,9 @@ Building this package will create two files in the `dist/` directory, a `.tar.gz
7274
To create a distributable version of the library, all you have to do is run this command:
7375

7476
```sh
75-
$ rye build
77+
$ uv build
7678
# or
77-
$ python -m build
79+
$ uv run task ci-build
7880
```
7981

8082
Then to install:
@@ -83,36 +85,50 @@ Then to install:
8385
$ pip install ./path-to-wheel-file.whl
8486
```
8587

86-
## Running tests
88+
## Development Workflow
8789

88-
Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.
90+
We use [Taskipy](https://github.com/taskipy/taskipy) to manage development tasks. All commands are defined in `pyproject.toml` and can be run with `uv run task <command>`.
8991

90-
```sh
91-
# you will need npm installed
92-
$ npx prism mock path/to/your/openapi.yml
93-
```
92+
### Running tests
9493

9594
```sh
96-
$ ./scripts/test
97-
```
95+
# Run tests with automatic mock server management
96+
$ uv run task test
9897

99-
## Linting and formatting
98+
# Or run tests directly (no mock server setup)
99+
$ uv run pytest
100+
```
100101

101-
This repository uses [ruff](https://github.com/astral-sh/ruff) and
102-
[black](https://github.com/psf/black) to format the code in the repository.
102+
The test command automatically handles [Prism mock server](https://github.com/stoplightio/prism) setup and teardown using the OpenAPI spec.
103103

104-
To lint:
104+
### Linting and formatting
105105

106106
```sh
107-
$ ./scripts/lint
107+
# Format code and documentation
108+
$ uv run task format
109+
110+
# Run all linting checks
111+
$ uv run task lint
112+
113+
# Run type checking only
114+
$ uv run task typecheck
108115
```
109116

110-
To format and fix all ruff issues automatically:
117+
### Available Tasks
111118

112119
```sh
113-
$ ./scripts/format
120+
# See all available tasks
121+
$ uv run task --list
114122
```
115123

124+
Key tasks:
125+
- `bootstrap` - Set up development environment
126+
- `format` - Format code with Ruff and documentation
127+
- `lint` - Run all checks (Ruff + type checking + import validation)
128+
- `test` - Run tests with mock server orchestration
129+
- `mock` - Start standalone mock API server
130+
- `setup-pre-commit` - Install pre-commit hooks
131+
116132
## Publishing and releases
117133

118134
Changes made to this repository via the automated release PR pipeline should publish to PyPI automatically. If
@@ -124,8 +140,12 @@ You can release to package managers by using [the `Publish PyPI` GitHub action](
124140

125141
### Publish manually
126142

127-
If you need to manually release a package, you can run the `bin/publish-pypi` script with a `PYPI_TOKEN` set on
128-
the environment.
143+
If you need to manually release a package, you can use UV directly:
144+
145+
```sh
146+
$ uv build
147+
$ uv publish --token $PYPI_TOKEN
148+
```
129149

130150
## 🤖 **Vibe Coding Setup**
131151

0 commit comments

Comments
 (0)