diff --git a/changelog.d/20356.misc b/changelog.d/20356.misc new file mode 100644 index 0000000000..8279850972 --- /dev/null +++ b/changelog.d/20356.misc @@ -0,0 +1 @@ +Remove unused `lxml` packaging and type-stub dependencies, and update URL-preview tests to check for BeautifulSoup instead. diff --git a/debian/build_virtualenv b/debian/build_virtualenv index bc689e6caf..3fe8f05d12 100755 --- a/debian/build_virtualenv +++ b/debian/build_virtualenv @@ -53,7 +53,6 @@ dh_virtualenv \ --builtin-venv \ --python "$SNAKE" \ --upgrade-pip \ - --preinstall="lxml" \ --preinstall="mock" \ --preinstall="wheel" \ --extra-pip-arg="--no-deps" \ diff --git a/debian/changelog b/debian/changelog index 0552032bce..f54149e400 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +matrix-synapse-py3 (1.163.0+unreleased1) UNRELEASED; urgency=medium + + * Stop preinstalling the unused Python lxml package. + + -- Synapse Packaging team Wed, 14 Oct 2026 11:30:04 +0100 + matrix-synapse-py3 (1.163.0) stable; urgency=medium * New synapse release 1.163.0. diff --git a/poetry.lock b/poetry.lock index 2649e2450d..b58e17b57f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1247,22 +1247,6 @@ files = [ {file = "librt-0.8.1.tar.gz", hash = "sha256:be46a14693955b3bd96014ccbdb8339ee8c9346fbe11c1b78901b55125f14c73"}, ] -[[package]] -name = "lxml-stubs" -version = "0.5.1" -description = "Type annotations for the lxml package" -optional = true -python-versions = "*" -groups = ["main"] -markers = "extra == \"saml2\" or extra == \"all\"" -files = [ - {file = "lxml-stubs-0.5.1.tar.gz", hash = "sha256:e0ec2aa1ce92d91278b719091ce4515c12adc1d564359dfaf81efa7d4feab79d"}, - {file = "lxml_stubs-0.5.1-py3-none-any.whl", hash = "sha256:1f689e5dbc4b9247cb09ae820c7d34daeb1fdbd1db06123814b856dae7787272"}, -] - -[package.extras] -test = ["coverage[toml] (>=7.2.5)", "mypy (>=1.2.0)", "pytest (>=7.3.0)", "pytest-mypy-plugins (>=1.10.1)"] - [[package]] name = "markdown-it-py" version = "4.0.0" @@ -1972,7 +1956,7 @@ files = [ {file = "pycparser-3.0-py3-none-any.whl", hash = "sha256:b727414169a36b7d524c1c3e31839a521725078d7b2ff038656844266160a992"}, {file = "pycparser-3.0.tar.gz", hash = "sha256:600f49d217304a5902ac3c37e1281c9fe94e4d0489de643a9504c5cdfdfc6b29"}, ] -markers = {main = "implementation_name != \"PyPy\"", dev = "implementation_name != \"PyPy\" and platform_python_implementation != \"PyPy\""} +markers = {main = "implementation_name != \"PyPy\"", dev = "platform_python_implementation != \"PyPy\" and implementation_name != \"PyPy\""} [[package]] name = "pydantic" @@ -3645,7 +3629,7 @@ docs = ["Sphinx", "repoze.sphinx.autointerface"] test = ["zope.i18nmessageid", "zope.testing", "zope.testrunner (>=6.4)"] [extras] -all = ["authlib", "beautifulsoup4", "defusedxml", "hiredis", "jaeger-client", "lxml-stubs", "matrix-synapse-ldap3", "opentracing", "psycopg2", "psycopg2cffi", "psycopg2cffi-compat", "pympler", "pysaml2", "pytz", "sentry-sdk", "thrift", "tornado", "txredisapi"] +all = ["authlib", "beautifulsoup4", "defusedxml", "hiredis", "jaeger-client", "matrix-synapse-ldap3", "opentracing", "psycopg2", "psycopg2cffi", "psycopg2cffi-compat", "pympler", "pysaml2", "pytz", "sentry-sdk", "thrift", "tornado", "txredisapi"] cache-memory = ["pympler"] jwt = ["authlib"] matrix-synapse-ldap3 = ["matrix-synapse-ldap3"] @@ -3653,7 +3637,7 @@ oidc = ["authlib"] opentracing = ["jaeger-client", "opentracing", "thrift", "tornado"] postgres = ["psycopg2", "psycopg2cffi", "psycopg2cffi-compat"] redis = ["hiredis", "txredisapi"] -saml2 = ["defusedxml", "lxml-stubs", "pysaml2", "pytz"] +saml2 = ["defusedxml", "pysaml2", "pytz"] sentry = ["sentry-sdk"] test = ["idna", "parameterized"] url-preview = ["beautifulsoup4"] @@ -3661,4 +3645,4 @@ url-preview = ["beautifulsoup4"] [metadata] lock-version = "2.1" python-versions = ">=3.10.0,<4.0.0" -content-hash = "6e8f0d223b61ab7c100236797f0ec1eed7f23b819c01c117fe445c6b1e91bbfc" +content-hash = "ae436463df1256bff83762dfd3871e58682c3d6e67f622b3c2b5f5cfa25ce475" diff --git a/pyproject.toml b/pyproject.toml index bbb27a8507..2454a8429d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -128,7 +128,6 @@ postgres = [ ] saml2 = [ "pysaml2>=4.5.0", - "lxml-stubs>=0.4.0", # Transitive dependencies from pysaml2 # These dependencies aren't directly required by Synapse. @@ -187,7 +186,6 @@ all = [ "psycopg2cffi-compat==1.1;platform_python_implementation == 'PyPy'", # saml2 "pysaml2>=4.5.0", - "lxml-stubs>=0.4.0", # oidc and jwt "authlib>=0.15.1", # url-preview diff --git a/tests/rest/client/test_capabilities.py b/tests/rest/client/test_capabilities.py index 4e64407788..ddfe0f2781 100644 --- a/tests/rest/client/test_capabilities.py +++ b/tests/rest/client/test_capabilities.py @@ -32,9 +32,9 @@ from tests import unittest from tests.unittest import override_config, skip_unless try: - import lxml + import bs4 except ImportError: - lxml = None # type: ignore[assignment] + bs4 = None # type: ignore[assignment] class CapabilitiesTestCase(unittest.HomeserverTestCase): @@ -336,7 +336,7 @@ class CapabilitiesTestCase(unittest.HomeserverTestCase): self.assertEqual(channel.code, HTTPStatus.OK) self.assertFalse(capabilities["m.preview_url"]["enabled"]) - @skip_unless(lxml is not None, "Requires lxml") + @skip_unless(bs4 is not None, "Requires beautifulsoup4") @override_config( { "url_preview_enabled": True, @@ -372,7 +372,7 @@ class CapabilitiesTestCase(unittest.HomeserverTestCase): self.assertFalse(capabilities["io.element.msc4452.preview_url"]["enabled"]) self.assertFalse(capabilities["m.preview_url"]["enabled"]) - @skip_unless(lxml is not None, "Requires lxml") + @skip_unless(bs4 is not None, "Requires beautifulsoup4") @override_config( { "url_preview_enabled": True, diff --git a/tests/rest/client/test_media.py b/tests/rest/client/test_media.py index fa1841e039..31d8f3de35 100644 --- a/tests/rest/client/test_media.py +++ b/tests/rest/client/test_media.py @@ -1605,7 +1605,7 @@ class URLPreviewTests(unittest.HomeserverTestCase): # We test this here because this endpoint must still work -# even if lxml is not installed. +# even if beautifulsoup4 is not installed. class URLPreviewDisabledTests(unittest.HomeserverTestCase): servlets = [ admin.register_servlets,