Skip to content

Commit 753226b

Browse files
authored
docs: update development setup from Poetry to uv (#2220)
1 parent 7b4111c commit 753226b

1 file changed

Lines changed: 25 additions & 23 deletions

File tree

docs/development.md

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,52 +16,54 @@ The project is structured so that:
1616
- In the project root directory, you will find common code for using, serving and testing Presidio
1717
as a cluster of services, as well as CI/CD pipelines codebase and documentation.
1818

19-
### Setting up Poetry
19+
### Setting up uv
2020

21-
[Poetry](https://python-poetry.org/) is Python package manager. It is used to manage dependencies and virtual
22-
environments for Presidio services.
23-
Follow these steps when starting to work on a Presidio service with poetry:
21+
[uv](https://docs.astral.sh/uv/) is the Python package manager used to manage dependencies and virtual
22+
environments for Presidio services (the CI installs dependencies the same way).
23+
Follow these steps when starting to work on a Presidio service with uv:
2424

25-
1. Install poetry
25+
1. Install uv
2626

27-
- Using Pip
27+
- Using the standalone installer (you can inspect [install.sh](https://astral.sh/uv/install.sh) before running it)
2828

2929
```sh
30-
pip install poetry
30+
curl -LsSf https://astral.sh/uv/install.sh | sh
3131
```
3232

3333
- Using Homebrew (in MacOS)
3434

3535
```
36-
brew install poetry
36+
brew install uv
3737
```
3838

39-
Additional installation instructions for poetry: <https://python-poetry.org/docs/#installation>
39+
Additional installation instructions for uv: <https://docs.astral.sh/uv/getting-started/installation/>
4040

41-
2. Have poetry create a virtualenv for the project and install all requirements in the pyproject.toml,
41+
2. Have uv create a virtualenv for the project and install all requirements in the pyproject.toml,
4242
including dev requirements.
4343

4444
For example, in the `presidio-analyzer` folder, run:
4545

4646
```
47-
poetry install --all-extras
47+
uv sync --all-extras --group dev
4848
```
4949

50+
Add `--locked` to install the exact locked dependency graph (matching CI behavior).
51+
5052
3. Run all tests:
5153

5254
```
53-
poetry run pytest
55+
uv run pytest
5456
```
5557

5658
4. To run arbitrary scripts within the virtual env, start the command with
57-
`poetry run`. For example:
58-
1. `poetry run ruff check`
59-
2. `poetry run pip freeze`
60-
3. `poetry run python -m spacy download en_core_web_lg`
59+
`uv run`. For example:
60+
1. `uv run ruff check`
61+
2. `uv run pip freeze`
62+
3. `uv run python -m spacy download en_core_web_lg`
6163

62-
Command 3 downloads the default spacy model needed for Presidio Analyzer.`
64+
Command 3 downloads the default spacy model needed for Presidio Analyzer.
6365

64-
#### Alternatively, activate the virtual environment and use the commands using [this method](https://python-poetry.org/docs/basic-usage/#activating-the-virtual-environment).
66+
#### Alternatively, [activate the virtual environment](https://docs.astral.sh/uv/pip/environments/#using-a-virtual-environment) and run the commands without the `uv run` prefix.
6567

6668
### Development guidelines
6769

@@ -93,9 +95,9 @@ use docker-compose ps:
9395
```bash
9496
>docker-compose ps
9597
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
96-
6d5a258d19c2 presidio-anonymizer "/bin/sh -c 'poetry …" 6 minutes ago Up 6 minutes 0.0.0.0:5001->5001/tcp presidio_presidio-anonymizer_1
97-
9aad2b68f93c presidio-analyzer "/bin/sh -c 'poetry …" 2 days ago Up 6 minutes 0.0.0.0:5002->5001/tcp presidio_presidio-analyzer_1
98-
1448dfb3ec2b presidio-image-redactor "/bin/sh -c 'poetry …" 2 seconds ago Up 2 seconds 0.0.0.0:5003->5001/tcp presidio_presidio-image-redactor_1
98+
6d5a258d19c2 presidio-anonymizer "./entrypoint.sh" 6 minutes ago Up 6 minutes 0.0.0.0:5001->5001/tcp presidio_presidio-anonymizer_1
99+
9aad2b68f93c presidio-analyzer "./entrypoint.sh" 2 days ago Up 6 minutes 0.0.0.0:5002->5001/tcp presidio_presidio-analyzer_1
100+
1448dfb3ec2b presidio-image-redactor "./entrypoint.sh" 2 seconds ago Up 2 seconds 0.0.0.0:5003->5001/tcp presidio_presidio-image-redactor_1
99101
```
100102

101103
Edit docker-compose.yml configuration file to change the default ports.
@@ -138,7 +140,7 @@ Running the tests locally can be done in two ways:
138140
1. Using cli, from each service directory, run:
139141

140142
```sh
141-
poetry run pytest
143+
uv run pytest
142144
```
143145

144146
2. Using your IDE.
@@ -202,7 +204,7 @@ Running the e2e-tests locally can be done in two ways:
202204

203205
Presidio services are PEP8 compliant and continuously enforced on style guide issues during the build process using `ruff`, in turn running `flake8` and other linters.
204206

205-
Running ruff locally, using `poetry run ruff check`, you can check for those issues prior to committing a change.
207+
Running ruff locally, using `uv run ruff check`, you can check for those issues prior to committing a change.
206208

207209
Ruff runs linters in addition to the basic `flake8` functionality, Presidio uses linters as part as ruff such as:
208210

0 commit comments

Comments
 (0)