You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

418 lines
15 KiB

  1. [tool.towncrier]
  2. package = "synapse"
  3. filename = "CHANGES.md"
  4. directory = "changelog.d"
  5. issue_format = "[\\#{issue}](https://github.com/matrix-org/synapse/issues/{issue})"
  6. [[tool.towncrier.type]]
  7. directory = "feature"
  8. name = "Features"
  9. showcontent = true
  10. [[tool.towncrier.type]]
  11. directory = "bugfix"
  12. name = "Bugfixes"
  13. showcontent = true
  14. [[tool.towncrier.type]]
  15. directory = "docker"
  16. name = "Updates to the Docker image"
  17. showcontent = true
  18. [[tool.towncrier.type]]
  19. directory = "doc"
  20. name = "Improved Documentation"
  21. showcontent = true
  22. [[tool.towncrier.type]]
  23. directory = "removal"
  24. name = "Deprecations and Removals"
  25. showcontent = true
  26. [[tool.towncrier.type]]
  27. directory = "misc"
  28. name = "Internal Changes"
  29. showcontent = true
  30. [tool.black]
  31. target-version = ['py38', 'py39', 'py310', 'py311']
  32. # black ignores everything in .gitignore by default, see
  33. # https://black.readthedocs.io/en/stable/usage_and_configuration/file_collection_and_discovery.html#gitignore
  34. # Use `extend-exclude` if you want to exclude something in addition to this.
  35. [tool.ruff]
  36. line-length = 88
  37. # See https://beta.ruff.rs/docs/rules/#error-e
  38. # for error codes. The ones we ignore are:
  39. # E501: Line too long (black enforces this for us)
  40. # E731: do not assign a lambda expression, use a def
  41. #
  42. # flake8-bugbear compatible checks. Its error codes are described at
  43. # https://beta.ruff.rs/docs/rules/#flake8-bugbear-b
  44. # B023: Functions defined inside a loop must not use variables redefined in the loop
  45. ignore = [
  46. "B023",
  47. "E501",
  48. "E731",
  49. ]
  50. select = [
  51. # pycodestyle
  52. "E",
  53. "W",
  54. # pyflakes
  55. "F",
  56. # flake8-bugbear
  57. "B0",
  58. # flake8-comprehensions
  59. "C4",
  60. # flake8-2020
  61. "YTT",
  62. # flake8-slots
  63. "SLOT",
  64. # flake8-debugger
  65. "T10",
  66. # flake8-pie
  67. "PIE",
  68. # flake8-executable
  69. "EXE",
  70. ]
  71. [tool.isort]
  72. line_length = 88
  73. sections = ["FUTURE", "STDLIB", "THIRDPARTY", "TWISTED", "FIRSTPARTY", "TESTS", "LOCALFOLDER"]
  74. default_section = "THIRDPARTY"
  75. known_first_party = ["synapse"]
  76. known_tests = ["tests"]
  77. known_twisted = ["twisted", "OpenSSL"]
  78. multi_line_output = 3
  79. include_trailing_comma = true
  80. combine_as_imports = true
  81. skip_gitignore = true
  82. [tool.maturin]
  83. manifest-path = "rust/Cargo.toml"
  84. [tool.poetry]
  85. name = "matrix-synapse"
  86. version = "1.93.0rc1"
  87. description = "Homeserver for the Matrix decentralised comms protocol"
  88. authors = ["Matrix.org Team and Contributors <packages@matrix.org>"]
  89. license = "Apache-2.0"
  90. readme = "README.rst"
  91. repository = "https://github.com/matrix-org/synapse"
  92. packages = [
  93. { include = "synapse" },
  94. ]
  95. classifiers = [
  96. "Development Status :: 5 - Production/Stable",
  97. "Topic :: Communications :: Chat",
  98. ]
  99. include = [
  100. { path = "AUTHORS.rst", format = "sdist" },
  101. { path = "book.toml", format = "sdist" },
  102. { path = "changelog.d", format = "sdist" },
  103. { path = "CHANGES.md", format = "sdist" },
  104. { path = "CONTRIBUTING.md", format = "sdist" },
  105. { path = "demo", format = "sdist" },
  106. { path = "docs", format = "sdist" },
  107. { path = "INSTALL.md", format = "sdist" },
  108. { path = "mypy.ini", format = "sdist" },
  109. { path = "scripts-dev", format = "sdist" },
  110. { path = "synmark", format="sdist" },
  111. { path = "sytest-blacklist", format = "sdist" },
  112. { path = "tests", format = "sdist" },
  113. { path = "UPGRADE.rst", format = "sdist" },
  114. { path = "Cargo.toml", format = "sdist" },
  115. { path = "Cargo.lock", format = "sdist" },
  116. { path = "rust/Cargo.toml", format = "sdist" },
  117. { path = "rust/build.rs", format = "sdist" },
  118. { path = "rust/src/**", format = "sdist" },
  119. ]
  120. exclude = [
  121. { path = "synapse/*.so", format = "sdist"}
  122. ]
  123. [tool.poetry.build]
  124. script = "build_rust.py"
  125. generate-setup-file = true
  126. [tool.poetry.scripts]
  127. synapse_homeserver = "synapse.app.homeserver:main"
  128. synapse_worker = "synapse.app.generic_worker:main"
  129. synctl = "synapse._scripts.synctl:main"
  130. export_signing_key = "synapse._scripts.export_signing_key:main"
  131. generate_config = "synapse._scripts.generate_config:main"
  132. generate_log_config = "synapse._scripts.generate_log_config:main"
  133. generate_signing_key = "synapse._scripts.generate_signing_key:main"
  134. hash_password = "synapse._scripts.hash_password:main"
  135. register_new_matrix_user = "synapse._scripts.register_new_matrix_user:main"
  136. synapse_port_db = "synapse._scripts.synapse_port_db:main"
  137. synapse_review_recent_signups = "synapse._scripts.review_recent_signups:main"
  138. update_synapse_database = "synapse._scripts.update_synapse_database:main"
  139. [tool.poetry.dependencies]
  140. python = "^3.8.0"
  141. # Mandatory Dependencies
  142. # ----------------------
  143. # we use the TYPE_CHECKER.redefine method added in jsonschema 3.0.0
  144. jsonschema = ">=3.0.0"
  145. # We choose 2.0 as a lower bound: the most recent backwards incompatible release.
  146. # It seems generally available, judging by https://pkgs.org/search/?q=immutabledict
  147. immutabledict = ">=2.0"
  148. # We require 2.1.0 or higher for type hints. Previous guard was >= 1.1.0
  149. unpaddedbase64 = ">=2.1.0"
  150. # We require 2.0.0 for immutabledict support.
  151. canonicaljson = "^2.0.0"
  152. # we use the type definitions added in signedjson 1.1.
  153. signedjson = "^1.1.0"
  154. # validating SSL certs for IP addresses requires service_identity 18.1.
  155. service-identity = ">=18.1.0"
  156. # Twisted 18.9 introduces some logger improvements that the structured
  157. # logger utilises
  158. Twisted = {extras = ["tls"], version = ">=18.9.0"}
  159. treq = ">=15.1"
  160. # Twisted has required pyopenssl 16.0 since about Twisted 16.6.
  161. pyOpenSSL = ">=16.0.0"
  162. PyYAML = ">=3.13"
  163. pyasn1 = ">=0.1.9"
  164. pyasn1-modules = ">=0.0.7"
  165. bcrypt = ">=3.1.7"
  166. # 10.0.1 minimum is mandatory here because of libwebp CVE-2023-4863.
  167. # Packagers that already took care of libwebp can lower that down to 5.4.0.
  168. Pillow = ">=10.0.1"
  169. # We use SortedDict.peekitem(), which was added in sortedcontainers 1.5.2.
  170. sortedcontainers = ">=1.5.2"
  171. pymacaroons = ">=0.13.0"
  172. msgpack = ">=0.5.2"
  173. phonenumbers = ">=8.2.0"
  174. # we use GaugeHistogramMetric, which was added in prom-client 0.4.0.
  175. prometheus-client = ">=0.4.0"
  176. # we use `order`, which arrived in attrs 19.2.0.
  177. # Note: 21.1.0 broke `/sync`, see #9936
  178. attrs = ">=19.2.0,!=21.1.0"
  179. netaddr = ">=0.7.18"
  180. # Jinja 2.x is incompatible with MarkupSafe>=2.1. To ensure that admins do not
  181. # end up with a broken installation, with recent MarkupSafe but old Jinja, we
  182. # add a lower bound to the Jinja2 dependency.
  183. Jinja2 = ">=3.0"
  184. bleach = ">=1.4.3"
  185. # We use `ParamSpec` and `Concatenate`, which were added in `typing-extensions` 3.10.0.0.
  186. # Additionally we need https://github.com/python/typing/pull/817 to allow types to be
  187. # generic over ParamSpecs.
  188. typing-extensions = ">=3.10.0.1"
  189. # We enforce that we have a `cryptography` version that bundles an `openssl`
  190. # with the latest security patches.
  191. cryptography = ">=3.4.7"
  192. # ijson 3.1.4 fixes a bug with "." in property names
  193. ijson = ">=3.1.4"
  194. matrix-common = "^1.3.0"
  195. # We need packaging.verison.Version(...).major added in 20.0.
  196. packaging = ">=20.0"
  197. # We support pydantic v1 and pydantic v2 via the pydantic.v1 compat module.
  198. # See https://github.com/matrix-org/synapse/issues/15858
  199. pydantic = ">=1.7.4, <3"
  200. # This is for building the rust components during "poetry install", which
  201. # currently ignores the `build-system.requires` directive (c.f.
  202. # https://github.com/python-poetry/poetry/issues/6154). Both `pip install` and
  203. # `poetry build` do the right thing without this explicit dependency.
  204. #
  205. # This isn't really a dev-dependency, as `poetry install --no-dev` will fail,
  206. # but the alternative is to add it to the main list of deps where it isn't
  207. # needed.
  208. setuptools_rust = ">=1.3"
  209. # Optional Dependencies
  210. # ---------------------
  211. matrix-synapse-ldap3 = { version = ">=0.1", optional = true }
  212. psycopg2 = { version = ">=2.8", markers = "platform_python_implementation != 'PyPy'", optional = true }
  213. psycopg2cffi = { version = ">=2.8", markers = "platform_python_implementation == 'PyPy'", optional = true }
  214. psycopg2cffi-compat = { version = "==1.1", markers = "platform_python_implementation == 'PyPy'", optional = true }
  215. pysaml2 = { version = ">=4.5.0", optional = true }
  216. authlib = { version = ">=0.15.1", optional = true }
  217. # systemd-python is necessary for logging to the systemd journal via
  218. # `systemd.journal.JournalHandler`, as is documented in
  219. # `contrib/systemd/log_config.yaml`.
  220. # Note: systemd-python 231 appears to have been yanked from pypi
  221. systemd-python = { version = ">=231", optional = true }
  222. lxml = { version = ">=4.2.0", optional = true }
  223. sentry-sdk = { version = ">=0.7.2", optional = true }
  224. opentracing = { version = ">=2.2.0", optional = true }
  225. jaeger-client = { version = ">=4.0.0", optional = true }
  226. txredisapi = { version = ">=1.4.7", optional = true }
  227. hiredis = { version = "*", optional = true }
  228. Pympler = { version = "*", optional = true }
  229. parameterized = { version = ">=0.7.4", optional = true }
  230. idna = { version = ">=2.5", optional = true }
  231. pyicu = { version = ">=2.10.2", optional = true }
  232. [tool.poetry.extras]
  233. # NB: Packages that should be part of `pip install matrix-synapse[all]` need to be specified
  234. # twice: once here, and once in the `all` extra.
  235. matrix-synapse-ldap3 = ["matrix-synapse-ldap3"]
  236. postgres = ["psycopg2", "psycopg2cffi", "psycopg2cffi-compat"]
  237. saml2 = ["pysaml2"]
  238. oidc = ["authlib"]
  239. # systemd-python is necessary for logging to the systemd journal via
  240. # `systemd.journal.JournalHandler`, as is documented in
  241. # `contrib/systemd/log_config.yaml`.
  242. systemd = ["systemd-python"]
  243. url-preview = ["lxml"]
  244. sentry = ["sentry-sdk"]
  245. opentracing = ["jaeger-client", "opentracing"]
  246. jwt = ["authlib"]
  247. # hiredis is not a *strict* dependency, but it makes things much faster.
  248. # (if it is not installed, we fall back to slow code.)
  249. redis = ["txredisapi", "hiredis"]
  250. # Required to use experimental `caches.track_memory_usage` config option.
  251. cache-memory = ["pympler"]
  252. test = ["parameterized", "idna"]
  253. # Allows for better search for international characters in the user directory. This
  254. # requires libicu's development headers installed on the system (e.g. libicu-dev on
  255. # Debian-based distributions).
  256. user-search = ["pyicu"]
  257. # The duplication here is awful. I hate hate hate hate hate it. However, for now I want
  258. # to ensure you can still `pip install matrix-synapse[all]` like today. Two motivations:
  259. # 1) for new installations, I want instructions in existing documentation and tutorials
  260. # out there to still work.
  261. # 2) I don't want to hard-code a list of extras into CI if I can help it. The ideal
  262. # solution here would be something like https://github.com/python-poetry/poetry/issues/3413
  263. # Poetry 1.2's dependency groups might make this easier. But I'm not trying that out
  264. # until there's a stable release of 1.2.
  265. #
  266. # NB: the strings in this list must be *package* names, not extra names.
  267. # Some of our extra names _are_ package names, which can lead to great confusion.
  268. all = [
  269. # matrix-synapse-ldap3
  270. "matrix-synapse-ldap3",
  271. # postgres
  272. "psycopg2", "psycopg2cffi", "psycopg2cffi-compat",
  273. # saml2
  274. "pysaml2",
  275. # oidc and jwt
  276. "authlib",
  277. # url-preview
  278. "lxml",
  279. # sentry
  280. "sentry-sdk",
  281. # opentracing
  282. "jaeger-client", "opentracing",
  283. # redis
  284. "txredisapi", "hiredis",
  285. # cache-memory
  286. "pympler",
  287. # improved user search
  288. "pyicu",
  289. # omitted:
  290. # - test: it's useful to have this separate from dev deps in the olddeps job
  291. # - systemd: this is a system-based requirement
  292. ]
  293. [tool.poetry.dev-dependencies]
  294. # We pin development dependencies in poetry.lock so that our tests don't start
  295. # failing on new releases. Keeping lower bounds loose here means that dependabot
  296. # can bump versions without having to update the content-hash in the lockfile.
  297. # This helps prevents merge conflicts when running a batch of dependabot updates.
  298. isort = ">=5.10.1"
  299. black = ">=22.7.0"
  300. ruff = "0.0.290"
  301. # Type checking only works with the pydantic.v1 compat module from pydantic v2
  302. pydantic = "^2"
  303. # Typechecking
  304. lxml-stubs = ">=0.4.0"
  305. mypy = "*"
  306. mypy-zope = "*"
  307. types-bleach = ">=4.1.0"
  308. types-commonmark = ">=0.9.2"
  309. types-jsonschema = ">=3.2.0"
  310. types-netaddr = ">=0.8.0.6"
  311. types-opentracing = ">=2.4.2"
  312. types-Pillow = ">=8.3.4"
  313. types-psycopg2 = ">=2.9.9"
  314. types-pyOpenSSL = ">=20.0.7"
  315. types-PyYAML = ">=5.4.10"
  316. types-requests = ">=2.26.0"
  317. types-setuptools = ">=57.4.0"
  318. # Dependencies which are exclusively required by unit test code. This is
  319. # NOT a list of all modules that are necessary to run the unit tests.
  320. # Tests assume that all optional dependencies are installed.
  321. # parameterized<0.7.4 can create classes with names that would normally be invalid
  322. # identifiers. trial really does not like this when running with multiple workers.
  323. parameterized = ">=0.7.4"
  324. idna = ">=2.5"
  325. # The following are used by the release script
  326. click = ">=8.1.3"
  327. # GitPython was == 3.1.14; bumped to 3.1.20, the first release with type hints.
  328. GitPython = ">=3.1.20"
  329. commonmark = ">=0.9.1"
  330. pygithub = ">=1.55"
  331. # The following are executed as commands by the release script.
  332. twine = "*"
  333. # Towncrier min version comes from #3425. Rationale unclear.
  334. towncrier = ">=18.6.0rc1"
  335. # Used for checking the Poetry lockfile
  336. tomli = ">=1.2.3"
  337. # Dependencies for building the development documentation
  338. [tool.poetry.group.dev-docs]
  339. optional = true
  340. [tool.poetry.group.dev-docs.dependencies]
  341. sphinx = {version = "^6.1", python = "^3.8"}
  342. sphinx-autodoc2 = {version = "^0.4.2", python = "^3.8"}
  343. myst-parser = {version = "^1.0.0", python = "^3.8"}
  344. furo = ">=2022.12.7,<2024.0.0"
  345. [build-system]
  346. # The upper bounds here are defensive, intended to prevent situations like
  347. # #13849 and #14079 where we see buildtime or runtime errors caused by build
  348. # system changes.
  349. # We are happy to raise these upper bounds upon request,
  350. # provided we check that it's safe to do so (i.e. that CI passes).
  351. requires = ["poetry-core>=1.1.0,<=1.7.0", "setuptools_rust>=1.3,<=1.7.0"]
  352. build-backend = "poetry.core.masonry.api"
  353. [tool.cibuildwheel]
  354. # Skip unsupported platforms (by us or by Rust).
  355. # See https://cibuildwheel.readthedocs.io/en/stable/options/#build-skip for the list of build targets.
  356. # We skip:
  357. # - CPython 3.6 and 3.7: EOLed
  358. # - PyPy 3.7: we only support Python 3.8+
  359. # - musllinux i686: excluded to reduce number of wheels we build.
  360. # c.f. https://github.com/matrix-org/synapse/pull/12595#discussion_r963107677
  361. # - PyPy on Aarch64 and musllinux on aarch64: too slow to build.
  362. # c.f. https://github.com/matrix-org/synapse/pull/14259
  363. skip = "cp36* cp37* pp37* *-musllinux_i686 pp*aarch64 *-musllinux_aarch64"
  364. # We need a rust compiler
  365. before-all = "curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y --profile minimal"
  366. environment= { PATH = "$PATH:$HOME/.cargo/bin" }
  367. # For some reason if we don't manually clean the build directory we
  368. # can end up polluting the next build with a .so that is for the wrong
  369. # Python version.
  370. before-build = "rm -rf {project}/build"
  371. build-frontend = "build"
  372. test-command = "python -c 'from synapse.synapse_rust import sum_as_string; print(sum_as_string(1, 2))'"
  373. [tool.cibuildwheel.linux]
  374. # Wrap the repair command to correctly rename the built cpython wheels as ABI3.
  375. repair-wheel-command = "./.ci/scripts/auditwheel_wrapper.py -w {dest_dir} {wheel}"
  376. [tool.cibuildwheel.macos]
  377. # Wrap the repair command to correctly rename the built cpython wheels as ABI3.
  378. repair-wheel-command = "./.ci/scripts/auditwheel_wrapper.py --require-archs {delocate_archs} -w {dest_dir} {wheel}"