2016-01-07 05:26:29 +01:00
|
|
|
# Copyright 2015, 2016 OpenMarket Ltd
|
2017-03-13 18:27:51 +01:00
|
|
|
# Copyright 2017 Vector Creations Ltd
|
2018-04-26 13:34:40 +02:00
|
|
|
# Copyright 2018 New Vector Ltd
|
2020-01-30 12:25:59 +01:00
|
|
|
# Copyright 2020 The Matrix.org Foundation C.I.C.
|
2015-04-24 11:35:29 +02:00
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
2021-03-29 12:55:33 +02:00
|
|
|
import itertools
|
2015-01-08 18:07:28 +01:00
|
|
|
import logging
|
2022-03-01 18:44:41 +01:00
|
|
|
from typing import Set
|
2015-01-08 18:07:28 +01:00
|
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
2018-12-21 15:37:26 +01:00
|
|
|
|
|
|
|
# REQUIREMENTS is a simple list of requirement specifiers[1], and must be
|
|
|
|
# installed. It is passed to setup() as install_requires in setup.py.
|
2018-04-26 13:34:40 +02:00
|
|
|
#
|
2018-12-21 15:37:26 +01:00
|
|
|
# CONDITIONAL_REQUIREMENTS is the optional dependencies, represented as a dict
|
|
|
|
# of lists. The dict key is the optional dependency name and can be passed to
|
|
|
|
# pip when installing. The list is a series of requirement specifiers[1] to be
|
|
|
|
# installed when that optional dependency requirement is specified. It is passed
|
|
|
|
# to setup() as extras_require in setup.py
|
2018-04-26 13:34:40 +02:00
|
|
|
#
|
2020-09-23 12:45:37 +02:00
|
|
|
# Note that these both represent runtime dependencies (and the versions
|
|
|
|
# installed are checked at runtime).
|
|
|
|
#
|
2020-12-04 14:01:06 +01:00
|
|
|
# Also note that we replicate these constraints in the Synapse Dockerfile while
|
|
|
|
# pre-installing dependencies. If these constraints are updated here, the same
|
|
|
|
# change should be made in the Dockerfile.
|
|
|
|
#
|
2018-04-26 13:34:40 +02:00
|
|
|
# [1] https://pip.pypa.io/en/stable/reference/pip_install/#requirement-specifiers.
|
|
|
|
|
2018-12-21 15:37:26 +01:00
|
|
|
REQUIREMENTS = [
|
2021-08-26 18:07:58 +02:00
|
|
|
# we use the TYPE_CHECKER.redefine method added in jsonschema 3.0.0
|
|
|
|
"jsonschema>=3.0.0",
|
2021-12-21 18:26:04 +01:00
|
|
|
# frozendict 2.1.2 is broken on Debian 10: https://github.com/Marco-Sulla/python-frozendict/issues/41
|
2022-02-14 22:18:01 +01:00
|
|
|
"frozendict>=1,!=2.1.2",
|
2018-12-21 15:37:26 +01:00
|
|
|
"unpaddedbase64>=1.1.0",
|
2020-09-07 13:21:38 +02:00
|
|
|
"canonicaljson>=1.4.0",
|
2020-01-30 12:25:59 +01:00
|
|
|
# we use the type definitions added in signedjson 1.1.
|
2022-04-05 18:35:20 +02:00
|
|
|
"signedjson>=1.1.0",
|
2018-12-21 15:37:26 +01:00
|
|
|
"pynacl>=1.2.1",
|
2019-06-12 13:31:59 +02:00
|
|
|
"idna>=2.5",
|
2019-06-10 16:58:35 +02:00
|
|
|
# validating SSL certs for IP addresses requires service_identity 18.1.
|
|
|
|
"service_identity>=18.1.0",
|
2019-08-28 13:18:53 +02:00
|
|
|
# Twisted 18.9 introduces some logger improvements that the structured
|
|
|
|
# logger utilises
|
|
|
|
"Twisted>=18.9.0",
|
2018-12-21 15:37:26 +01:00
|
|
|
"treq>=15.1",
|
2018-09-06 13:53:15 +02:00
|
|
|
# Twisted has required pyopenssl 16.0 since about Twisted 16.6.
|
2018-12-21 15:37:26 +01:00
|
|
|
"pyopenssl>=16.0.0",
|
|
|
|
"pyyaml>=3.11",
|
|
|
|
"pyasn1>=0.1.9",
|
|
|
|
"pyasn1-modules>=0.0.7",
|
|
|
|
"bcrypt>=3.1.0",
|
2022-01-21 23:23:26 +01:00
|
|
|
"pillow>=5.4.0",
|
2018-12-21 15:37:26 +01:00
|
|
|
"sortedcontainers>=1.4.4",
|
2019-01-16 09:44:22 +01:00
|
|
|
"pymacaroons>=0.13.0",
|
2019-06-12 13:31:59 +02:00
|
|
|
"msgpack>=0.5.2",
|
2018-12-21 15:37:26 +01:00
|
|
|
"phonenumbers>=8.2.0",
|
2020-09-30 17:42:05 +02:00
|
|
|
# we use GaugeHistogramMetric, which was added in prom-client 0.4.0.
|
2022-02-02 17:51:00 +01:00
|
|
|
"prometheus_client>=0.4.0",
|
2021-06-17 17:23:11 +02:00
|
|
|
# we use `order`, which arrived in attrs 19.2.0.
|
2021-05-06 15:06:06 +02:00
|
|
|
# Note: 21.1.0 broke `/sync`, see #9936
|
2021-06-17 17:23:11 +02:00
|
|
|
"attrs>=19.2.0,!=21.1.0",
|
2018-12-21 15:37:26 +01:00
|
|
|
"netaddr>=0.7.18",
|
2022-03-28 19:02:57 +02:00
|
|
|
# Jinja 2.x is incompatible with MarkupSafe>=2.1. To ensure that admins do not
|
|
|
|
# end up with a broken installation, with recent MarkupSafe but old Jinja, we
|
|
|
|
# add a lower bound to the Jinja2 dependency.
|
|
|
|
"Jinja2>=3.0",
|
2019-06-21 17:52:09 +02:00
|
|
|
"bleach>=1.4.3",
|
2022-03-08 16:58:14 +01:00
|
|
|
# We use `ParamSpec`, which was added in `typing-extensions` 3.10.0.0.
|
|
|
|
"typing-extensions>=3.10.0",
|
2021-03-26 13:00:25 +01:00
|
|
|
# We enforce that we have a `cryptography` version that bundles an `openssl`
|
|
|
|
# with the latest security patches.
|
2021-04-27 14:13:07 +02:00
|
|
|
"cryptography>=3.4.7",
|
2022-02-17 17:11:59 +01:00
|
|
|
# ijson 3.1.4 fixes a bug with "." in property names
|
|
|
|
"ijson>=3.1.4",
|
2022-02-14 14:12:22 +01:00
|
|
|
"matrix-common~=1.1.0",
|
2022-03-04 23:40:24 +01:00
|
|
|
# We need packaging.requirements.Requirement, added in 16.1.
|
|
|
|
"packaging>=16.1",
|
2022-04-05 20:25:56 +02:00
|
|
|
# At the time of writing, we only use functions from the version `importlib.metadata`
|
|
|
|
# which shipped in Python 3.8. This corresponds to version 1.4 of the backport.
|
2022-04-06 18:37:56 +02:00
|
|
|
"importlib_metadata>=1.4 ; python_version < '3.8'",
|
2018-12-21 15:37:26 +01:00
|
|
|
]
|
2018-06-05 16:13:57 +02:00
|
|
|
|
2015-03-17 12:45:37 +01:00
|
|
|
CONDITIONAL_REQUIREMENTS = {
|
2018-12-21 15:37:26 +01:00
|
|
|
"matrix-synapse-ldap3": ["matrix-synapse-ldap3>=0.1"],
|
2021-02-04 14:29:47 +01:00
|
|
|
"postgres": [
|
|
|
|
# we use execute_values with the fetch param, which arrived in psycopg 2.8.
|
|
|
|
"psycopg2>=2.8 ; platform_python_implementation != 'PyPy'",
|
|
|
|
"psycopg2cffi>=2.8 ; platform_python_implementation == 'PyPy'",
|
|
|
|
"psycopg2cffi-compat==1.1 ; platform_python_implementation == 'PyPy'",
|
|
|
|
],
|
2020-12-08 19:41:25 +01:00
|
|
|
"saml2": [
|
2021-04-27 14:13:07 +02:00
|
|
|
"pysaml2>=4.5.0",
|
2020-12-08 19:41:25 +01:00
|
|
|
],
|
2020-05-08 14:30:40 +02:00
|
|
|
"oidc": ["authlib>=0.14.0"],
|
2021-02-23 14:42:36 +01:00
|
|
|
# systemd-python is necessary for logging to the systemd journal via
|
|
|
|
# `systemd.journal.JournalHandler`, as is documented in
|
|
|
|
# `contrib/systemd/log_config.yaml`.
|
2019-04-16 12:41:17 +02:00
|
|
|
"systemd": ["systemd-python>=231"],
|
2022-01-21 23:23:26 +01:00
|
|
|
"url_preview": ["lxml>=4.2.0"],
|
2019-02-12 14:55:58 +01:00
|
|
|
"sentry": ["sentry-sdk>=0.7.2"],
|
2019-07-11 11:36:03 +02:00
|
|
|
"opentracing": ["jaeger-client>=4.0.0", "opentracing>=2.2.0"],
|
2019-06-27 13:02:41 +02:00
|
|
|
"jwt": ["pyjwt>=1.6.4"],
|
2020-05-06 18:36:46 +02:00
|
|
|
# hiredis is not a *strict* dependency, but it makes things much faster.
|
|
|
|
# (if it is not installed, we fall back to slow code.)
|
|
|
|
"redis": ["txredisapi>=1.4.7", "hiredis"],
|
2021-05-05 17:54:36 +02:00
|
|
|
# Required to use experimental `caches.track_memory_usage` config option.
|
|
|
|
"cache_memory": ["pympler"],
|
2015-03-17 12:45:37 +01:00
|
|
|
}
|
|
|
|
|
2021-07-15 12:02:43 +02:00
|
|
|
ALL_OPTIONAL_REQUIREMENTS: Set[str] = set()
|
2019-04-16 12:41:17 +02:00
|
|
|
|
|
|
|
for name, optional_deps in CONDITIONAL_REQUIREMENTS.items():
|
|
|
|
# Exclude systemd as it's a system-based requirement.
|
2020-09-17 22:45:22 +02:00
|
|
|
# Exclude lint as it's a dev-based requirement.
|
2020-09-23 12:45:37 +02:00
|
|
|
if name not in ["systemd"]:
|
2019-04-16 12:41:17 +02:00
|
|
|
ALL_OPTIONAL_REQUIREMENTS = set(optional_deps) | ALL_OPTIONAL_REQUIREMENTS
|
2015-03-17 12:45:37 +01:00
|
|
|
|
2015-01-08 18:07:28 +01:00
|
|
|
|
2021-03-29 12:55:33 +02:00
|
|
|
# ensure there are no double-quote characters in any of the deps (otherwise the
|
|
|
|
# 'pip install' incantation in DependencyException will break)
|
|
|
|
for dep in itertools.chain(
|
|
|
|
REQUIREMENTS,
|
|
|
|
*CONDITIONAL_REQUIREMENTS.values(),
|
|
|
|
):
|
|
|
|
if '"' in dep:
|
|
|
|
raise Exception(
|
|
|
|
"Dependency `%s` contains double-quote; use single-quotes instead" % (dep,)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2019-04-16 12:41:17 +02:00
|
|
|
def list_requirements():
|
|
|
|
return list(set(REQUIREMENTS) | ALL_OPTIONAL_REQUIREMENTS)
|
2015-02-10 17:30:48 +01:00
|
|
|
|
2015-02-02 18:22:40 +01:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
import sys
|
2018-12-21 15:37:26 +01:00
|
|
|
|
2015-02-02 18:22:40 +01:00
|
|
|
sys.stdout.writelines(req + "\n" for req in list_requirements())
|