This commit is contained in:
DMRobertson 2023-01-17 18:05:34 +00:00
parent 37b0c8b513
commit bda3c76d04
6 changed files with 32 additions and 24 deletions

View file

@ -190,7 +190,7 @@ pipx install poetry
</code></pre> </code></pre>
<p>but see poetry's <a href="https://python-poetry.org/docs/#installation">installation instructions</a> <p>but see poetry's <a href="https://python-poetry.org/docs/#installation">installation instructions</a>
for other installation methods.</p> for other installation methods.</p>
<p>Synapse requires Poetry version 1.2.0 or later.</p> <p>Developing Synapse requires Poetry version 1.3.2 or later.</p>
<p>Next, open a terminal and install dependencies as follows:</p> <p>Next, open a terminal and install dependencies as follows:</p>
<pre><code class="language-sh">cd path/where/you/have/cloned/the/repository <pre><code class="language-sh">cd path/where/you/have/cloned/the/repository
poetry install --extras all poetry install --extras all

View file

@ -148,6 +148,10 @@
<h1 id="managing-dependencies-with-poetry"><a class="header" href="#managing-dependencies-with-poetry">Managing dependencies with Poetry</a></h1> <h1 id="managing-dependencies-with-poetry"><a class="header" href="#managing-dependencies-with-poetry">Managing dependencies with Poetry</a></h1>
<p>This is a quick cheat sheet for developers on how to use <a href="https://python-poetry.org/"><code>poetry</code></a>.</p> <p>This is a quick cheat sheet for developers on how to use <a href="https://python-poetry.org/"><code>poetry</code></a>.</p>
<h1 id="installing"><a class="header" href="#installing">Installing</a></h1>
<p>See the <a href="contributing_guide.html#4-install-the-dependencies">contributing guide</a>.</p>
<p>Developers should use Poetry 1.3.2 or higher. If you encounter problems related
to poetry, please <a href="#check-the-version-of-poetry-with-poetry---version">double-check your poetry version</a>.</p>
<h1 id="background"><a class="header" href="#background">Background</a></h1> <h1 id="background"><a class="header" href="#background">Background</a></h1>
<p>Synapse uses a variety of third-party Python packages to function as a homeserver. <p>Synapse uses a variety of third-party Python packages to function as a homeserver.
Some of these are direct dependencies, listed in <code>pyproject.toml</code> under the Some of these are direct dependencies, listed in <code>pyproject.toml</code> under the
@ -240,7 +244,7 @@ e.g. <code>mypy</code> instead of <code>poetry run mypy</code>; <code>python</co
context of poetry's venv, without having to run <code>poetry shell</code> beforehand.</p> context of poetry's venv, without having to run <code>poetry shell</code> beforehand.</p>
<h1 id="how-do-i"><a class="header" href="#how-do-i">How do I...</a></h1> <h1 id="how-do-i"><a class="header" href="#how-do-i">How do I...</a></h1>
<h2 id="reset-my-venv-to-the-locked-environment"><a class="header" href="#reset-my-venv-to-the-locked-environment">...reset my venv to the locked environment?</a></h2> <h2 id="reset-my-venv-to-the-locked-environment"><a class="header" href="#reset-my-venv-to-the-locked-environment">...reset my venv to the locked environment?</a></h2>
<pre><code class="language-shell">poetry install --extras all --remove-untracked <pre><code class="language-shell">poetry install --all-extras --sync
</code></pre> </code></pre>
<h2 id="delete-everything-and-start-over-from-scratch"><a class="header" href="#delete-everything-and-start-over-from-scratch">...delete everything and start over from scratch?</a></h2> <h2 id="delete-everything-and-start-over-from-scratch"><a class="header" href="#delete-everything-and-start-over-from-scratch">...delete everything and start over from scratch?</a></h2>
<pre><code class="language-shell"># Stop the current virtualenv if active <pre><code class="language-shell"># Stop the current virtualenv if active
@ -286,11 +290,7 @@ useful.</p>
<ul> <ul>
<li>manually update <code>pyproject.toml</code>; then <code>poetry lock --no-update</code>; or else</li> <li>manually update <code>pyproject.toml</code>; then <code>poetry lock --no-update</code>; or else</li>
<li><code>poetry add packagename</code>. See <code>poetry add --help</code>; note the <code>--dev</code>, <li><code>poetry add packagename</code>. See <code>poetry add --help</code>; note the <code>--dev</code>,
<code>--extras</code> and <code>--optional</code> flags in particular. <code>--extras</code> and <code>--optional</code> flags in particular.</li>
<ul>
<li><strong>NB</strong>: this specifies the new package with a version given by a &quot;caret bound&quot;. This won't get forced to its lowest version in the old deps CI job: see <a href="https://github.com/matrix-org/synapse/blob/4e1374373857f2f7a911a31c50476342d9070681/.ci/scripts/test_old_deps.sh#L35-L39">this TODO</a>.</li>
</ul>
</li>
</ul> </ul>
<p>Include the updated <code>pyproject.toml</code> and <code>poetry.lock</code> files in your commit.</p> <p>Include the updated <code>pyproject.toml</code> and <code>poetry.lock</code> files in your commit.</p>
<h2 id="remove-a-dependency"><a class="header" href="#remove-a-dependency">...remove a dependency?</a></h2> <h2 id="remove-a-dependency"><a class="header" href="#remove-a-dependency">...remove a dependency?</a></h2>
@ -298,7 +298,7 @@ useful.</p>
<pre><code class="language-shell">poetry remove packagename <pre><code class="language-shell">poetry remove packagename
</code></pre> </code></pre>
<p>ought to do the trick. Alternatively, manually update <code>pyproject.toml</code> and <p>ought to do the trick. Alternatively, manually update <code>pyproject.toml</code> and
<code>poetry lock --no-update</code>. Include the updated <code>pyproject.toml</code> and poetry.lock` <code>poetry lock --no-update</code>. Include the updated <code>pyproject.toml</code> and <code>poetry.lock</code>
files in your commit.</p> files in your commit.</p>
<h2 id="update-the-version-range-for-an-existing-dependency"><a class="header" href="#update-the-version-range-for-an-existing-dependency">...update the version range for an existing dependency?</a></h2> <h2 id="update-the-version-range-for-an-existing-dependency"><a class="header" href="#update-the-version-range-for-an-existing-dependency">...update the version range for an existing dependency?</a></h2>
<p>Best done by manually editing <code>pyproject.toml</code>, then <code>poetry lock --no-update</code>. <p>Best done by manually editing <code>pyproject.toml</code>, then <code>poetry lock --no-update</code>.
@ -326,8 +326,6 @@ poetry lock --no-update
<pre><code class="language-shell">poetry export --extras all <pre><code class="language-shell">poetry export --extras all
</code></pre> </code></pre>
<p>Be wary of bugs in <code>poetry export</code> and <code>pip install -r requirements.txt</code>.</p> <p>Be wary of bugs in <code>poetry export</code> and <code>pip install -r requirements.txt</code>.</p>
<p>Note: <code>poetry export</code> will be made a plugin in Poetry 1.2. Additional config may
be required.</p>
<h2 id="build-a-test-wheel"><a class="header" href="#build-a-test-wheel">...build a test wheel?</a></h2> <h2 id="build-a-test-wheel"><a class="header" href="#build-a-test-wheel">...build a test wheel?</a></h2>
<p>I usually use</p> <p>I usually use</p>
<pre><code class="language-shell">poetry run pip install build &amp;&amp; poetry run python -m build <pre><code class="language-shell">poetry run pip install build &amp;&amp; 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
<code>poetry build</code> too.</p> <code>poetry build</code> too.</p>
<h1 id="troubleshooting"><a class="header" href="#troubleshooting">Troubleshooting</a></h1> <h1 id="troubleshooting"><a class="header" href="#troubleshooting">Troubleshooting</a></h1>
<h2 id="check-the-version-of-poetry-with-poetry---version"><a class="header" href="#check-the-version-of-poetry-with-poetry---version">Check the version of poetry with <code>poetry --version</code>.</a></h2> <h2 id="check-the-version-of-poetry-with-poetry---version"><a class="header" href="#check-the-version-of-poetry-with-poetry---version">Check the version of poetry with <code>poetry --version</code>.</a></h2>
<p>The minimum version of poetry supported by Synapse is 1.2.</p> <p>The minimum version of poetry supported by Synapse is 1.3.2.</p>
<p>It can also be useful to check the version of <code>poetry-core</code> in use. If you've <p>It can also be useful to check the version of <code>poetry-core</code> in use. If you've
installed <code>poetry</code> with <code>pipx</code>, try <code>pipx runpip poetry list | grep poetry-core</code>.</p> installed <code>poetry</code> with <code>pipx</code>, try <code>pipx runpip poetry list | grep poetry-core</code>.</p>
<h2 id="clear-caches-poetry-cache-clear---all-pypi"><a class="header" href="#clear-caches-poetry-cache-clear---all-pypi">Clear caches: <code>poetry cache clear --all pypi</code>.</a></h2> <h2 id="clear-caches-poetry-cache-clear---all-pypi"><a class="header" href="#clear-caches-poetry-cache-clear---all-pypi">Clear caches: <code>poetry cache clear --all pypi</code>.</a></h2>

View file

@ -1779,6 +1779,12 @@ change: v1.75 workers cannot process account data replicated by v1.76 workers,
and vice versa.</p> and vice versa.</p>
<p>Once all workers are upgraded to v1.76 (or downgraded to v1.75), account data <p>Once all workers are upgraded to v1.76 (or downgraded to v1.75), account data
and device replication will resume as normal.</p> and device replication will resume as normal.</p>
<h2 id="minimum-version-of-poetry-is-now-132"><a class="header" href="#minimum-version-of-poetry-is-now-132">Minimum version of Poetry is now 1.3.2</a></h2>
<p>The minimum supported version of Poetry is now 1.3.2 (previously 1.2.0, <a href="upgrade.html#upgrading-to-v1670">since
Synapse 1.67</a>). If you have used <code>poetry install</code> to
install Synapse from a source checkout, you should upgrade poetry: see its
<a href="https://python-poetry.org/docs/#installation">installation instructions</a>.
For all other installation methods, no acction is required.</p>
<h1 id="upgrading-to-v1740"><a class="header" href="#upgrading-to-v1740">Upgrading to v1.74.0</a></h1> <h1 id="upgrading-to-v1740"><a class="header" href="#upgrading-to-v1740">Upgrading to v1.74.0</a></h1>
<h2 id="unicode-support-in-user-search"><a class="header" href="#unicode-support-in-user-search">Unicode support in user search</a></h2> <h2 id="unicode-support-in-user-search"><a class="header" href="#unicode-support-in-user-search">Unicode support in user search</a></h2>
<p>This version introduces optional support for an <a href="https://github.com/matrix-org/synapse/pull/14464">improved user search dealing with Unicode characters</a>.</p> <p>This version introduces optional support for an <a href="https://github.com/matrix-org/synapse/pull/14464">improved user search dealing with Unicode characters</a>.</p>
@ -15214,7 +15220,7 @@ pipx install poetry
</code></pre> </code></pre>
<p>but see poetry's <a href="https://python-poetry.org/docs/#installation">installation instructions</a> <p>but see poetry's <a href="https://python-poetry.org/docs/#installation">installation instructions</a>
for other installation methods.</p> for other installation methods.</p>
<p>Synapse requires Poetry version 1.2.0 or later.</p> <p>Developing Synapse requires Poetry version 1.3.2 or later.</p>
<p>Next, open a terminal and install dependencies as follows:</p> <p>Next, open a terminal and install dependencies as follows:</p>
<pre><code class="language-sh">cd path/where/you/have/cloned/the/repository <pre><code class="language-sh">cd path/where/you/have/cloned/the/repository
poetry install --extras all poetry install --extras all
@ -16221,6 +16227,10 @@ configuration key (see the <code>synapse.config.experimental</code> file) and ei
(briefly) what is being enabled, or include the MSC number.</p> (briefly) what is being enabled, or include the MSC number.</p>
<div style="break-before: page; page-break-before: always;"></div><h1 id="managing-dependencies-with-poetry"><a class="header" href="#managing-dependencies-with-poetry">Managing dependencies with Poetry</a></h1> <div style="break-before: page; page-break-before: always;"></div><h1 id="managing-dependencies-with-poetry"><a class="header" href="#managing-dependencies-with-poetry">Managing dependencies with Poetry</a></h1>
<p>This is a quick cheat sheet for developers on how to use <a href="https://python-poetry.org/"><code>poetry</code></a>.</p> <p>This is a quick cheat sheet for developers on how to use <a href="https://python-poetry.org/"><code>poetry</code></a>.</p>
<h1 id="installing"><a class="header" href="#installing">Installing</a></h1>
<p>See the <a href="development/contributing_guide.html#4-install-the-dependencies">contributing guide</a>.</p>
<p>Developers should use Poetry 1.3.2 or higher. If you encounter problems related
to poetry, please <a href="development/dependencies.html#check-the-version-of-poetry-with-poetry---version">double-check your poetry version</a>.</p>
<h1 id="background-1"><a class="header" href="#background-1">Background</a></h1> <h1 id="background-1"><a class="header" href="#background-1">Background</a></h1>
<p>Synapse uses a variety of third-party Python packages to function as a homeserver. <p>Synapse uses a variety of third-party Python packages to function as a homeserver.
Some of these are direct dependencies, listed in <code>pyproject.toml</code> under the Some of these are direct dependencies, listed in <code>pyproject.toml</code> under the
@ -16313,7 +16323,7 @@ e.g. <code>mypy</code> instead of <code>poetry run mypy</code>; <code>python</co
context of poetry's venv, without having to run <code>poetry shell</code> beforehand.</p> context of poetry's venv, without having to run <code>poetry shell</code> beforehand.</p>
<h1 id="how-do-i"><a class="header" href="#how-do-i">How do I...</a></h1> <h1 id="how-do-i"><a class="header" href="#how-do-i">How do I...</a></h1>
<h2 id="reset-my-venv-to-the-locked-environment"><a class="header" href="#reset-my-venv-to-the-locked-environment">...reset my venv to the locked environment?</a></h2> <h2 id="reset-my-venv-to-the-locked-environment"><a class="header" href="#reset-my-venv-to-the-locked-environment">...reset my venv to the locked environment?</a></h2>
<pre><code class="language-shell">poetry install --extras all --remove-untracked <pre><code class="language-shell">poetry install --all-extras --sync
</code></pre> </code></pre>
<h2 id="delete-everything-and-start-over-from-scratch"><a class="header" href="#delete-everything-and-start-over-from-scratch">...delete everything and start over from scratch?</a></h2> <h2 id="delete-everything-and-start-over-from-scratch"><a class="header" href="#delete-everything-and-start-over-from-scratch">...delete everything and start over from scratch?</a></h2>
<pre><code class="language-shell"># Stop the current virtualenv if active <pre><code class="language-shell"># Stop the current virtualenv if active
@ -16359,11 +16369,7 @@ useful.</p>
<ul> <ul>
<li>manually update <code>pyproject.toml</code>; then <code>poetry lock --no-update</code>; or else</li> <li>manually update <code>pyproject.toml</code>; then <code>poetry lock --no-update</code>; or else</li>
<li><code>poetry add packagename</code>. See <code>poetry add --help</code>; note the <code>--dev</code>, <li><code>poetry add packagename</code>. See <code>poetry add --help</code>; note the <code>--dev</code>,
<code>--extras</code> and <code>--optional</code> flags in particular. <code>--extras</code> and <code>--optional</code> flags in particular.</li>
<ul>
<li><strong>NB</strong>: this specifies the new package with a version given by a &quot;caret bound&quot;. This won't get forced to its lowest version in the old deps CI job: see <a href="https://github.com/matrix-org/synapse/blob/4e1374373857f2f7a911a31c50476342d9070681/.ci/scripts/test_old_deps.sh#L35-L39">this TODO</a>.</li>
</ul>
</li>
</ul> </ul>
<p>Include the updated <code>pyproject.toml</code> and <code>poetry.lock</code> files in your commit.</p> <p>Include the updated <code>pyproject.toml</code> and <code>poetry.lock</code> files in your commit.</p>
<h2 id="remove-a-dependency"><a class="header" href="#remove-a-dependency">...remove a dependency?</a></h2> <h2 id="remove-a-dependency"><a class="header" href="#remove-a-dependency">...remove a dependency?</a></h2>
@ -16371,7 +16377,7 @@ useful.</p>
<pre><code class="language-shell">poetry remove packagename <pre><code class="language-shell">poetry remove packagename
</code></pre> </code></pre>
<p>ought to do the trick. Alternatively, manually update <code>pyproject.toml</code> and <p>ought to do the trick. Alternatively, manually update <code>pyproject.toml</code> and
<code>poetry lock --no-update</code>. Include the updated <code>pyproject.toml</code> and poetry.lock` <code>poetry lock --no-update</code>. Include the updated <code>pyproject.toml</code> and <code>poetry.lock</code>
files in your commit.</p> files in your commit.</p>
<h2 id="update-the-version-range-for-an-existing-dependency"><a class="header" href="#update-the-version-range-for-an-existing-dependency">...update the version range for an existing dependency?</a></h2> <h2 id="update-the-version-range-for-an-existing-dependency"><a class="header" href="#update-the-version-range-for-an-existing-dependency">...update the version range for an existing dependency?</a></h2>
<p>Best done by manually editing <code>pyproject.toml</code>, then <code>poetry lock --no-update</code>. <p>Best done by manually editing <code>pyproject.toml</code>, then <code>poetry lock --no-update</code>.
@ -16399,8 +16405,6 @@ poetry lock --no-update
<pre><code class="language-shell">poetry export --extras all <pre><code class="language-shell">poetry export --extras all
</code></pre> </code></pre>
<p>Be wary of bugs in <code>poetry export</code> and <code>pip install -r requirements.txt</code>.</p> <p>Be wary of bugs in <code>poetry export</code> and <code>pip install -r requirements.txt</code>.</p>
<p>Note: <code>poetry export</code> will be made a plugin in Poetry 1.2. Additional config may
be required.</p>
<h2 id="build-a-test-wheel"><a class="header" href="#build-a-test-wheel">...build a test wheel?</a></h2> <h2 id="build-a-test-wheel"><a class="header" href="#build-a-test-wheel">...build a test wheel?</a></h2>
<p>I usually use</p> <p>I usually use</p>
<pre><code class="language-shell">poetry run pip install build &amp;&amp; poetry run python -m build <pre><code class="language-shell">poetry run pip install build &amp;&amp; poetry run python -m build
@ -16410,7 +16414,7 @@ doesn't require poetry. (It's what we use in CI too). However, you could try
<code>poetry build</code> too.</p> <code>poetry build</code> too.</p>
<h1 id="troubleshooting-4"><a class="header" href="#troubleshooting-4">Troubleshooting</a></h1> <h1 id="troubleshooting-4"><a class="header" href="#troubleshooting-4">Troubleshooting</a></h1>
<h2 id="check-the-version-of-poetry-with-poetry---version"><a class="header" href="#check-the-version-of-poetry-with-poetry---version">Check the version of poetry with <code>poetry --version</code>.</a></h2> <h2 id="check-the-version-of-poetry-with-poetry---version"><a class="header" href="#check-the-version-of-poetry-with-poetry---version">Check the version of poetry with <code>poetry --version</code>.</a></h2>
<p>The minimum version of poetry supported by Synapse is 1.2.</p> <p>The minimum version of poetry supported by Synapse is 1.3.2.</p>
<p>It can also be useful to check the version of <code>poetry-core</code> in use. If you've <p>It can also be useful to check the version of <code>poetry-core</code> in use. If you've
installed <code>poetry</code> with <code>pipx</code>, try <code>pipx runpip poetry list | grep poetry-core</code>.</p> installed <code>poetry</code> with <code>pipx</code>, try <code>pipx runpip poetry list | grep poetry-core</code>.</p>
<h2 id="clear-caches-poetry-cache-clear---all-pypi"><a class="header" href="#clear-caches-poetry-cache-clear---all-pypi">Clear caches: <code>poetry cache clear --all pypi</code>.</a></h2> <h2 id="clear-caches-poetry-cache-clear---all-pypi"><a class="header" href="#clear-caches-poetry-cache-clear---all-pypi">Clear caches: <code>poetry cache clear --all pypi</code>.</a></h2>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -239,6 +239,12 @@ change: v1.75 workers cannot process account data replicated by v1.76 workers,
and vice versa.</p> and vice versa.</p>
<p>Once all workers are upgraded to v1.76 (or downgraded to v1.75), account data <p>Once all workers are upgraded to v1.76 (or downgraded to v1.75), account data
and device replication will resume as normal.</p> and device replication will resume as normal.</p>
<h2 id="minimum-version-of-poetry-is-now-132"><a class="header" href="#minimum-version-of-poetry-is-now-132">Minimum version of Poetry is now 1.3.2</a></h2>
<p>The minimum supported version of Poetry is now 1.3.2 (previously 1.2.0, <a href="#upgrading-to-v1670">since
Synapse 1.67</a>). If you have used <code>poetry install</code> to
install Synapse from a source checkout, you should upgrade poetry: see its
<a href="https://python-poetry.org/docs/#installation">installation instructions</a>.
For all other installation methods, no acction is required.</p>
<h1 id="upgrading-to-v1740"><a class="header" href="#upgrading-to-v1740">Upgrading to v1.74.0</a></h1> <h1 id="upgrading-to-v1740"><a class="header" href="#upgrading-to-v1740">Upgrading to v1.74.0</a></h1>
<h2 id="unicode-support-in-user-search"><a class="header" href="#unicode-support-in-user-search">Unicode support in user search</a></h2> <h2 id="unicode-support-in-user-search"><a class="header" href="#unicode-support-in-user-search">Unicode support in user search</a></h2>
<p>This version introduces optional support for an <a href="https://github.com/matrix-org/synapse/pull/14464">improved user search dealing with Unicode characters</a>.</p> <p>This version introduces optional support for an <a href="https://github.com/matrix-org/synapse/pull/14464">improved user search dealing with Unicode characters</a>.</p>