Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Unpin build-system requirements, but impose an upper-bound #14085

Merged
merged 6 commits into from
Oct 7, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/14085.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Rename the `url_preview` extra to `url-preview`, for compatability with poetry-core 1.3.0.
21 changes: 21 additions & 0 deletions docs/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,27 @@ Synapse will log a warning when a module uses the deprecated method, to help
administrators find modules using it.


## Package extra `url_preview` now called `url-preview`

This is compliant with [PEP 685](https://peps.python.org/pep-0685/#specification) and is necessary to use the URL preview option when Synapse is built with poetry-core 1.3.0 or greater. [#14079](https://github.com/matrix-org/synapse/issues/14079) has some more context.

If you are installing Synapse from source with this extra specifically named, e.g. with

```
pip install /path/to/synapse[url_preview]
```

or

```
poetry install --extras url_preview
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are either of these things that people are likely to be doing every upgrade?

I'm not entirely sure this needs calling out in the upgrade notes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As noted in the description: if you're installing from source, you need to be doing pip install or poetry install to pick up the latest version of the Rust source. So reinstalls are likely.

I think installations that specifically name url_previews are unlikely.

(Also a factor: if you install an extra with poetry install --extras EXTRA_NAME once, you have to keep supplying that EXTRA_NAME in future poetry install calls, or else it will remove unused dependencies.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, fair.

I think installations that specifically name url_previews are unlikely.

Yeah. On this occasion, I feel like this is unlikely to be useful to anyone. We do need to find some sort of balance in these upgrade notes: if they describe every single change, then people won't read them at all. IMHO this is on the "not worth including" side of the balance (though it might be worth an explicit shoutout in the changelog). YMMV though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mainly want to have something here to point people to if they encounter this problem on upgrade. Can remove it if you think it's too niche.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, sorry. I missed your earlier comment.

I'll omit this from the notes and add a "BTW" in the changelog.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a722cf5.


then you need to change the underscore `_` in `url_preview` to a hyphen `-` when upgrading to Synapse 1.69.0.
No config changes are necessary.

Installations using Debian packages and Docker images from Matrix.org are not affected. Installations from source that install the `all` extra are not affected.

# Upgrading to v1.68.0

Two changes announced in the upgrade notes for v1.67.0 have now landed in v1.68.0.
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ oidc = ["authlib"]
# `systemd.journal.JournalHandler`, as is documented in
# `contrib/systemd/log_config.yaml`.
systemd = ["systemd-python"]
url_preview = ["lxml"]
url-preview = ["lxml"]
sentry = ["sentry-sdk"]
opentracing = ["jaeger-client", "opentracing"]
jwt = ["authlib"]
Expand Down Expand Up @@ -250,7 +250,7 @@ all = [
"pysaml2",
# oidc and jwt
"authlib",
# url_preview
# url-preview
"lxml",
# sentry
"sentry-sdk",
Expand Down Expand Up @@ -307,7 +307,7 @@ twine = "*"
towncrier = ">=18.6.0rc1"

[build-system]
requires = ["poetry-core==1.2.0", "setuptools_rust==1.5.2"]
requires = ["poetry-core>=1.0.0", "setuptools_rust>=1.3"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps we should cap these to known-good versions, to avoid #13849 situations?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No strong opinions here. I'd be happy to cap to poetry-core>=1.0.0,<=1.3.0, but I don't have any context on what's going on with setuptools_rust and how quickly-moving it is. E.g. I expect we'll want to take advantage of PyO3/setuptools-rust#295 sooner rather than later.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't do <=1.3.0, version 1.3.1 is already out. If you're going to constrain the upper end of the version, at least make it <1.4.

Copy link
Contributor Author

@DMRobertson DMRobertson Oct 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed among the team. We'll constrain to <= 1.3.1 and will raise that upper bound to 1.3.2/1.4.0/another version if a) someone wants to use that version, and b) we can check that it's safe.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is 045cecd.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think making a too-conservative upper bound conserves frustration by replacing "Synapse is broken" issues with "Requirements need updating" issues. Limiting to the current minor version might thread the needle by minimizing the likelihood of breakage while still allowing upgrades. (Of course, given how some Python projects seem to bump patch versions with ever merge and minor versions every third hour of every fourth day, maybe the relaxation isn't all that significant.)

build-backend = "poetry.core.masonry.api"


Expand Down
2 changes: 1 addition & 1 deletion synapse/config/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def read_config(self, config: JsonDict, **kwargs: Any) -> None:
)
self.url_preview_enabled = config.get("url_preview_enabled", False)
if self.url_preview_enabled:
check_requirements("url_preview")
check_requirements("url-preview")

proxy_env = getproxies_environment()
if "url_preview_ip_range_blacklist" not in config:
Expand Down