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
+56-36Lines changed: 56 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,37 +1,39 @@
1
1
## Setting up the environment
2
2
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.
4
4
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
6
6
7
7
```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
9
13
```
10
14
11
-
Or [install Rye manually](https://rye.astral.sh/guide/installation/) and run:
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:
18
28
19
29
```sh
20
-
# Activate the virtual environment - https://docs.python.org/3/library/venv.html#how-venvs-work
30
+
# Activate the virtual environment
21
31
$ source .venv/bin/activate
22
32
23
-
#now you can omit the `rye run` prefix
33
+
#Now you can omit the `uv run` prefix
24
34
$ python script.py
25
35
```
26
36
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
-
35
37
## Modifying/Adding code
36
38
37
39
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
45
47
```py
46
48
# add an example to examples/<your-example>.py
47
49
48
-
#!/usr/bin/env -S rye run python
50
+
#!/usr/bin/env -S uv run python
49
51
…
50
52
```
51
53
@@ -72,9 +74,9 @@ Building this package will create two files in the `dist/` directory, a `.tar.gz
72
74
To create a distributable version of the library, all you have to do is run this command:
73
75
74
76
```sh
75
-
$ rye build
77
+
$ uv build
76
78
# or
77
-
$ python -m build
79
+
$ uv run task ci-build
78
80
```
79
81
80
82
Then to install:
@@ -83,36 +85,50 @@ Then to install:
83
85
$ pip install ./path-to-wheel-file.whl
84
86
```
85
87
86
-
## Running tests
88
+
## Development Workflow
87
89
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>`.
89
91
90
-
```sh
91
-
# you will need npm installed
92
-
$ npx prism mock path/to/your/openapi.yml
93
-
```
92
+
### Running tests
94
93
95
94
```sh
96
-
$ ./scripts/test
97
-
```
95
+
# Run tests with automatic mock server management
96
+
$ uv run task test
98
97
99
-
## Linting and formatting
98
+
# Or run tests directly (no mock server setup)
99
+
$ uv run pytest
100
+
```
100
101
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.
103
103
104
-
To lint:
104
+
### Linting and formatting
105
105
106
106
```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
108
115
```
109
116
110
-
To format and fix all ruff issues automatically:
117
+
### Available Tasks
111
118
112
119
```sh
113
-
$ ./scripts/format
120
+
# See all available tasks
121
+
$ uv run task --list
114
122
```
115
123
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
+
116
132
## Publishing and releases
117
133
118
134
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](
124
140
125
141
### Publish manually
126
142
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:
0 commit comments