From bda3c76d044781398a628cd086b2c40d5f58d6b7 Mon Sep 17 00:00:00 2001 From: DMRobertson Date: Tue, 17 Jan 2023 18:05:34 +0000 Subject: deploy: b88cfe6d41ede17bde4144ca12f9dc9d0ef21215 --- develop/development/contributing_guide.html | 2 +- develop/development/dependencies.html | 18 ++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) (limited to 'develop/development') diff --git a/develop/development/contributing_guide.html b/develop/development/contributing_guide.html index e04f8d1488..b4a63db2a8 100644 --- a/develop/development/contributing_guide.html +++ b/develop/development/contributing_guide.html @@ -190,7 +190,7 @@ pipx install poetry

but see poetry's installation instructions for other installation methods.

-

Synapse requires Poetry version 1.2.0 or later.

+

Developing Synapse requires Poetry version 1.3.2 or later.

Next, open a terminal and install dependencies as follows:

cd path/where/you/have/cloned/the/repository
 poetry install --extras all
diff --git a/develop/development/dependencies.html b/develop/development/dependencies.html
index a0823a71c6..1db41ffa4b 100644
--- a/develop/development/dependencies.html
+++ b/develop/development/dependencies.html
@@ -148,6 +148,10 @@
 
                         

Managing dependencies with Poetry

This is a quick cheat sheet for developers on how to use poetry.

+

Installing

+

See the contributing guide.

+

Developers should use Poetry 1.3.2 or higher. If you encounter problems related +to poetry, please double-check your poetry version.

Background

Synapse uses a variety of third-party Python packages to function as a homeserver. Some of these are direct dependencies, listed in pyproject.toml under the @@ -240,7 +244,7 @@ e.g. mypy instead of poetry run mypy; pythonpoetry shell beforehand.

How do I...

...reset my venv to the locked environment?

-
poetry install --extras all --remove-untracked
+
poetry install --all-extras --sync
 

...delete everything and start over from scratch?

# Stop the current virtualenv if active
@@ -286,11 +290,7 @@ useful.

  • manually update pyproject.toml; then poetry lock --no-update; or else
  • poetry add packagename. See poetry add --help; note the --dev, ---extras and --optional flags in particular. -
      -
    • NB: this specifies the new package with a version given by a "caret bound". This won't get forced to its lowest version in the old deps CI job: see this TODO.
    • -
    -
  • +--extras and --optional flags in particular.

Include the updated pyproject.toml and poetry.lock files in your commit.

...remove a dependency?

@@ -298,7 +298,7 @@ useful.

poetry remove packagename
 

ought to do the trick. Alternatively, manually update pyproject.toml and -poetry lock --no-update. Include the updated pyproject.toml and poetry.lock` +poetry lock --no-update. Include the updated pyproject.toml and poetry.lock files in your commit.

...update the version range for an existing dependency?

Best done by manually editing pyproject.toml, then poetry lock --no-update. @@ -326,8 +326,6 @@ poetry lock --no-update

poetry export --extras all
 

Be wary of bugs in poetry export and pip install -r requirements.txt.

-

Note: poetry export will be made a plugin in Poetry 1.2. Additional config may -be required.

...build a test wheel?

I usually use

poetry run pip install build && poetry run python -m build
@@ -337,7 +335,7 @@ doesn't require poetry. (It's what we use in CI too). However, you could try
 poetry build too.

Troubleshooting

Check the version of poetry with poetry --version.

-

The minimum version of poetry supported by Synapse is 1.2.

+

The minimum version of poetry supported by Synapse is 1.3.2.

It can also be useful to check the version of poetry-core in use. If you've installed poetry with pipx, try pipx runpip poetry list | grep poetry-core.

Clear caches: poetry cache clear --all pypi.

-- cgit 1.5.1