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

Commit efb6b66

Browse files
Move lint dependencies to extras_require (#8330)
Lint dependencies can now be installed with pip install -e ".[lint]" This should help keep the version in sync between tox and documentation.
1 parent 837293c commit efb6b66

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ https://help.github.com/articles/using-pull-requests/) to ask us to pull your
1717
changes into our repo.
1818

1919
Some other points to follow:
20-
20+
2121
* Please base your changes on the `develop` branch.
22-
22+
2323
* Please follow the [code style requirements](#code-style).
2424

2525
* Please include a [changelog entry](#changelog) with each PR.
@@ -46,7 +46,7 @@ locally. You'll need python 3.6 or later, and to install a number of tools:
4646

4747
```
4848
# Install the dependencies
49-
pip install -U black flake8 flake8-comprehensions isort
49+
pip install -e ".[lint]"
5050
5151
# Run the linter script
5252
./scripts-dev/lint.sh

changelog.d/8330.misc

Lines changed: 1 addition & 0 deletions
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.

synapse/python_dependencies.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,16 @@
104104
# hiredis is not a *strict* dependency, but it makes things much faster.
105105
# (if it is not installed, we fall back to slow code.)
106106
"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"],
107109
}
108110

109111
ALL_OPTIONAL_REQUIREMENTS = set() # type: Set[str]
110112

111113
for name, optional_deps in CONDITIONAL_REQUIREMENTS.items():
112114
# Exclude systemd as it's a system-based requirement.
113-
if name not in ["systemd"]:
115+
# Exclude lint as it's a dev-based requirement.
116+
if name not in ["systemd", "lint"]:
114117
ALL_OPTIONAL_REQUIREMENTS = set(optional_deps) | ALL_OPTIONAL_REQUIREMENTS
115118

116119

tox.ini

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,20 +118,14 @@ commands =
118118
check-manifest
119119

120120
[testenv:check_codestyle]
121-
skip_install = True
122-
deps =
123-
flake8
124-
flake8-comprehensions
125-
# We pin so that our tests don't start failing on new releases of black.
126-
black==19.10b0
121+
extras = lint
127122
commands =
128123
python -m black --check --diff .
129124
/bin/sh -c "flake8 synapse tests scripts scripts-dev contrib synctl {env:PEP8SUFFIX:}"
130125
{toxinidir}/scripts-dev/config-lint.sh
131126

132127
[testenv:check_isort]
133-
skip_install = True
134-
deps = isort==5.0.3
128+
extras = lint
135129
commands = /bin/sh -c "isort -c --df --sp setup.cfg synapse tests scripts-dev scripts"
136130

137131
[testenv:check-newsfragment]

0 commit comments

Comments
 (0)