Skip to content

Commit 50ca8f2

Browse files
committed
Update documentation for modern tooling
1 parent d53e002 commit 50ca8f2

File tree

2 files changed

+26
-70
lines changed

2 files changed

+26
-70
lines changed

CONTRIBUTING.md

Lines changed: 22 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -6,86 +6,43 @@ this case, the [GNU Affero General Public License v3](LICENSE-AGPL-3.0).
66

77
## Set up your development environment
88

9-
To contribute to Sydent, ensure you have Python 3.7 and `git` available on your
9+
To contribute to Sydent, ensure you have Python 3.10+ and `git` available on your
1010
system. You'll need to clone the source code first:
1111

1212
```shell
1313
git clone https://github.com/element-hq/sydent.git
14+
cd sydent
1415
```
1516

16-
### Installing `poetry`
17-
18-
Sydent uses [Poetry](https://python-poetry.org/) to manage its dependencies.
19-
See [its installation instructions](https://python-poetry.org/docs/master/#installation)
20-
to get started. They recommend using a custom installation script, which installs
21-
poetry in an isolated environment capable of self updating. We recommend using
22-
[`pipx`](https://pypa.github.io/pipx/) instead:
23-
24-
```shell
25-
pip install pipx
26-
pipx install poetry==1.1.12
27-
poetry --version
28-
```
17+
### Installing `uv`
2918

30-
For the time being, we are erring towards caution by using a pinned version of
31-
poetry.
19+
Sydent uses [uv](https://docs.astral.sh/uv/) to manage its dependencies.
20+
See [its installation instructions](https://docs.astral.sh/uv/getting-started/installation/)
21+
to get started.
3222

33-
### Generate a virtualenv
23+
### Install dependencies
3424

35-
Poetry manages a virtual environment ('virtualenv') for Sydent, using specific versions of
36-
every dependency. To create this environment, run
25+
uv manages a virtual environment for Sydent, using specific versions of every
26+
dependency. To create this environment and install everything, run:
3727

3828
```bash
39-
cd sydent
40-
poetry install
41-
```
42-
43-
This installs Sydent, its dependencies, and useful development tools into poetry's
44-
virtual environment. To run a one-off command in this environment, use `poetry run`.
45-
Otherwise, you'll end up running against the system python environment.
46-
47-
```shell
48-
$ which python
49-
/usr/bin/python
50-
$ poetry run which python
51-
/home/user/.cache/pypoetry/virtualenvs/matrix-sydent-Ew7U0NLX-py3.10/bin/python
29+
uv sync
5230
```
5331

54-
To avoid repeatedly typing out `poetry run`, use `poetry shell`:
32+
This installs Sydent, its dependencies, and useful development tools into a
33+
`.venv` directory. To run a one-off command in this environment, use `uv run`:
5534

5635
```shell
57-
$ poetry shell
58-
Spawning shell within /home/user/.cache/pypoetry/virtualenvs/matrix-sydent-Ew7U0NLX-py3.10
59-
. /home/user/.cache/pypoetry/virtualenvs/matrix-sydent-Ew7U0NLX-py3.10/bin/activate
60-
61-
$ which python
62-
~/.cache/pypoetry/virtualenvs/matrix-sydent-Ew7U0NLX-py3.10/bin/python
36+
uv run which python
37+
uv run sydent
6338
```
6439

65-
Be sure to do this _every time_ you open a new terminal window for working on
66-
Sydent. Using `poetry run` or `poetry shell` ensures that any Python commands
67-
you run (`pip`, `python`, etc.) use the versions inside your venv, and not your
68-
system Python.
69-
70-
When you're done, you can close your terminal.
71-
72-
### Optional: `direnv`
73-
74-
If even typing `poetry shell` is too much work for you, take a look at
75-
[`direnv`](https://direnv.net/). A few steps are needed:
76-
77-
1. install direnv.
78-
2. Add the configuration from [here](https://github.com/direnv/direnv/wiki/Python#poetry) to `~/.direnvrc`.
79-
3. In the Sydent checkout, run `echo layout poetry >> .envrc`. Then run `direnv allow`.
80-
81-
From now on, when you `cd` into the sydent directory, `poetry shell` will run automatically. Whenever you navigate out of the sydent directory, you'll no longer be using poetry's venv.
82-
8340
### Run the unit tests
8441

8542
To make sure everything is working as expected, run the unit tests:
8643

8744
```bash
88-
poetry run trial tests
45+
uv run trial tests
8946
```
9047

9148
If you see a message like:
@@ -104,12 +61,12 @@ Then all is well and you're ready to work!
10461
Sydent uses [matrix-is-tester](https://github.com/matrix-org/matrix-is-tester/) to provide
10562
black-box testing of compliance with the [Matrix Identity Service API](https://matrix.org/docs/spec/identity_service/latest).
10663
(Features that are Sydent-specific belong in unit tests rather than the black-box test suite.)
107-
This project is marked as a development dependency, so Poetry will automatically
108-
install for you.
64+
This project is marked as a development dependency, so `uv sync` will
65+
automatically install it for you.
10966

11067
Now, to run `matrix-is-tester`, execute:
11168
```
112-
poetry run trial matrix_is_tester
69+
uv run trial matrix_is_tester
11370
```
11471

11572
#### Advanced
@@ -152,15 +109,14 @@ Some other points to follow:
152109

153110
## Code style and continuous integration
154111

155-
Sydent uses `black`, `isort` and `ruff` to enforce code style. Use the following
156-
script to enforce these style guides:
112+
Sydent uses [ruff](https://docs.astral.sh/ruff/) for linting and formatting, and
113+
[mypy](https://mypy-lang.org/) for type checking. Use the following script to run
114+
all checks:
157115

158116
```shell
159-
poetry run scripts-dev/lint.sh
117+
uv run scripts-dev/lint.sh
160118
```
161119

162-
(This also runs `mypy`, our preferred typechecker.)
163-
164120
All of these checks are automatically run against any pull request via GitHub
165121
Actions. If your change breaks the build, this
166122
will be shown in GitHub, with links to the build results. If your build fails,

README.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,17 @@ To install Sydent's dependencies on a Debian-based system, run::
3333
Installing from source
3434
~~~~~~~~~~~~~~~~~~~~~~
3535

36-
First install `poetry`. See `poetry's documentation <https://python-poetry.org/docs/#installation>`_ for details; we recommend installing via `pipx`. Once that's done::
36+
First install `uv <https://docs.astral.sh/uv/getting-started/installation/>`_. Once that's done::
3737

3838
git clone https://github.com/element-hq/sydent.git
3939
cd sydent
40-
poetry install --no-dev
40+
uv sync --no-dev
4141
# For development, pull in extra tools with
42-
# poetry install
42+
# uv sync
4343

4444
To start Sydent::
4545

46-
poetry run sydent
46+
uv run sydent
4747

4848
Running Sydent
4949
==============

0 commit comments

Comments
 (0)