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.
This commit is contained in:
parent
837293c314
commit
efb6b6629c
|
@ -17,9 +17,9 @@ https://help.github.com/articles/using-pull-requests/) to ask us to pull your
|
||||||
changes into our repo.
|
changes into our repo.
|
||||||
|
|
||||||
Some other points to follow:
|
Some other points to follow:
|
||||||
|
|
||||||
* Please base your changes on the `develop` branch.
|
* Please base your changes on the `develop` branch.
|
||||||
|
|
||||||
* Please follow the [code style requirements](#code-style).
|
* Please follow the [code style requirements](#code-style).
|
||||||
|
|
||||||
* Please include a [changelog entry](#changelog) with each PR.
|
* 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:
|
||||||
|
|
||||||
```
|
```
|
||||||
# Install the dependencies
|
# Install the dependencies
|
||||||
pip install -U black flake8 flake8-comprehensions isort
|
pip install -e ".[lint]"
|
||||||
|
|
||||||
# Run the linter script
|
# Run the linter script
|
||||||
./scripts-dev/lint.sh
|
./scripts-dev/lint.sh
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Move lint-related dependencies to package-extra field, update CONTRIBUTING.md to utilise this.
|
|
@ -104,13 +104,16 @@ CONDITIONAL_REQUIREMENTS = {
|
||||||
# hiredis is not a *strict* dependency, but it makes things much faster.
|
# hiredis is not a *strict* dependency, but it makes things much faster.
|
||||||
# (if it is not installed, we fall back to slow code.)
|
# (if it is not installed, we fall back to slow code.)
|
||||||
"redis": ["txredisapi>=1.4.7", "hiredis"],
|
"redis": ["txredisapi>=1.4.7", "hiredis"],
|
||||||
|
# We pin black so that our tests don't start failing on new releases.
|
||||||
|
"lint": ["isort==5.0.3", "black==19.10b0", "flake8-comprehensions", "flake8"],
|
||||||
}
|
}
|
||||||
|
|
||||||
ALL_OPTIONAL_REQUIREMENTS = set() # type: Set[str]
|
ALL_OPTIONAL_REQUIREMENTS = set() # type: Set[str]
|
||||||
|
|
||||||
for name, optional_deps in CONDITIONAL_REQUIREMENTS.items():
|
for name, optional_deps in CONDITIONAL_REQUIREMENTS.items():
|
||||||
# Exclude systemd as it's a system-based requirement.
|
# Exclude systemd as it's a system-based requirement.
|
||||||
if name not in ["systemd"]:
|
# Exclude lint as it's a dev-based requirement.
|
||||||
|
if name not in ["systemd", "lint"]:
|
||||||
ALL_OPTIONAL_REQUIREMENTS = set(optional_deps) | ALL_OPTIONAL_REQUIREMENTS
|
ALL_OPTIONAL_REQUIREMENTS = set(optional_deps) | ALL_OPTIONAL_REQUIREMENTS
|
||||||
|
|
||||||
|
|
||||||
|
|
10
tox.ini
10
tox.ini
|
@ -118,20 +118,14 @@ commands =
|
||||||
check-manifest
|
check-manifest
|
||||||
|
|
||||||
[testenv:check_codestyle]
|
[testenv:check_codestyle]
|
||||||
skip_install = True
|
extras = lint
|
||||||
deps =
|
|
||||||
flake8
|
|
||||||
flake8-comprehensions
|
|
||||||
# We pin so that our tests don't start failing on new releases of black.
|
|
||||||
black==19.10b0
|
|
||||||
commands =
|
commands =
|
||||||
python -m black --check --diff .
|
python -m black --check --diff .
|
||||||
/bin/sh -c "flake8 synapse tests scripts scripts-dev contrib synctl {env:PEP8SUFFIX:}"
|
/bin/sh -c "flake8 synapse tests scripts scripts-dev contrib synctl {env:PEP8SUFFIX:}"
|
||||||
{toxinidir}/scripts-dev/config-lint.sh
|
{toxinidir}/scripts-dev/config-lint.sh
|
||||||
|
|
||||||
[testenv:check_isort]
|
[testenv:check_isort]
|
||||||
skip_install = True
|
extras = lint
|
||||||
deps = isort==5.0.3
|
|
||||||
commands = /bin/sh -c "isort -c --df --sp setup.cfg synapse tests scripts-dev scripts"
|
commands = /bin/sh -c "isort -c --df --sp setup.cfg synapse tests scripts-dev scripts"
|
||||||
|
|
||||||
[testenv:check-newsfragment]
|
[testenv:check-newsfragment]
|
||||||
|
|
Loading…
Reference in New Issue