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

Commit bbde403

Browse files
authored
Do not check lint/test dependencies at runtime. (#8377)
moves non-runtime dependencies out of synapse.python_dependencies (test and lint)
1 parent a4e63e5 commit bbde403

File tree

5 files changed

+25
-15
lines changed

5 files changed

+25
-15
lines changed

changelog.d/8330.misc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Move lint-related dependencies to package-extra field, update CONTRIBUTING.md to utilise this.
1+
Move lint-related dependencies to package-extra field, update CONTRIBUTING.md to utilise this.

changelog.d/8377.misc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Move lint-related dependencies to package-extra field, update CONTRIBUTING.md to utilise this.

setup.py

+16
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,22 @@ def exec_file(path_segments):
9494
# Make `pip install matrix-synapse[all]` install all the optional dependencies.
9595
CONDITIONAL_REQUIREMENTS["all"] = list(ALL_OPTIONAL_REQUIREMENTS)
9696

97+
# Developer dependencies should not get included in "all".
98+
#
99+
# We pin black so that our tests don't start failing on new releases.
100+
CONDITIONAL_REQUIREMENTS["lint"] = [
101+
"isort==5.0.3",
102+
"black==19.10b0",
103+
"flake8-comprehensions",
104+
"flake8",
105+
]
106+
107+
# Dependencies which are exclusively required by unit test code. This is
108+
# NOT a list of all modules that are necessary to run the unit tests.
109+
# Tests assume that all optional dependencies are installed.
110+
#
111+
# parameterized_class decorator was introduced in parameterized 0.7.0
112+
CONDITIONAL_REQUIREMENTS["test"] = ["mock>=2.0", "parameterized>=0.7.0"]
97113

98114
setup(
99115
name="matrix-synapse",

synapse/python_dependencies.py

+4-9
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
# installed when that optional dependency requirement is specified. It is passed
3838
# to setup() as extras_require in setup.py
3939
#
40+
# Note that these both represent runtime dependencies (and the versions
41+
# installed are checked at runtime).
42+
#
4043
# [1] https://pip.pypa.io/en/stable/reference/pip_install/#requirement-specifiers.
4144

4245
REQUIREMENTS = [
@@ -92,28 +95,20 @@
9295
"oidc": ["authlib>=0.14.0"],
9396
"systemd": ["systemd-python>=231"],
9497
"url_preview": ["lxml>=3.5.0"],
95-
# Dependencies which are exclusively required by unit test code. This is
96-
# NOT a list of all modules that are necessary to run the unit tests.
97-
# Tests assume that all optional dependencies are installed.
98-
#
99-
# parameterized_class decorator was introduced in parameterized 0.7.0
100-
"test": ["mock>=2.0", "parameterized>=0.7.0"],
10198
"sentry": ["sentry-sdk>=0.7.2"],
10299
"opentracing": ["jaeger-client>=4.0.0", "opentracing>=2.2.0"],
103100
"jwt": ["pyjwt>=1.6.4"],
104101
# hiredis is not a *strict* dependency, but it makes things much faster.
105102
# (if it is not installed, we fall back to slow code.)
106103
"redis": ["txredisapi>=1.4.7", "hiredis"],
107-
# We pin black so that our tests don't start failing on new releases.
108-
"lint": ["isort==5.0.3", "black==19.10b0", "flake8-comprehensions", "flake8"],
109104
}
110105

111106
ALL_OPTIONAL_REQUIREMENTS = set() # type: Set[str]
112107

113108
for name, optional_deps in CONDITIONAL_REQUIREMENTS.items():
114109
# Exclude systemd as it's a system-based requirement.
115110
# Exclude lint as it's a dev-based requirement.
116-
if name not in ["systemd", "lint"]:
111+
if name not in ["systemd"]:
117112
ALL_OPTIONAL_REQUIREMENTS = set(optional_deps) | ALL_OPTIONAL_REQUIREMENTS
118113

119114

tox.ini

+3-5
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
envlist = packaging, py35, py36, py37, py38, check_codestyle, check_isort
33

44
[base]
5+
extras = test
56
deps =
6-
mock
77
python-subunit
88
junitxml
99
coverage
1010
coverage-enable-subprocess
11-
parameterized
1211

1312
# cyptography 2.2 requires setuptools >= 18.5
1413
#
@@ -36,7 +35,7 @@ setenv =
3635
[testenv]
3736
deps =
3837
{[base]deps}
39-
extras = all
38+
extras = all, test
4039

4140
whitelist_externals =
4241
sh
@@ -84,7 +83,6 @@ deps =
8483
# Old automat version for Twisted
8584
Automat == 0.3.0
8685

87-
mock
8886
lxml
8987
coverage
9088
coverage-enable-subprocess
@@ -97,7 +95,7 @@ commands =
9795
/bin/sh -c 'python -m synapse.python_dependencies | sed -e "s/>=/==/g" -e "s/psycopg2==2.6//" -e "s/pyopenssl==16.0.0/pyopenssl==17.0.0/" | xargs -d"\n" pip install'
9896

9997
# Install Synapse itself. This won't update any libraries.
100-
pip install -e .
98+
pip install -e ".[test]"
10199

102100
{envbindir}/coverage run "{envbindir}/trial" {env:TRIAL_FLAGS:} {posargs:tests} {env:TOXSUFFIX:}
103101

0 commit comments

Comments
 (0)