Skip to content

Commit

Permalink
Put requirements file in setup.cfg as extra_require
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Sassoulas committed Apr 4, 2021
1 parent c037011 commit 1291354
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 79 deletions.
25 changes: 10 additions & 15 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ jobs:
id: generate-python-key
run: >-
echo "::set-output name=key::base-venv-${{ env.CACHE_VERSION }}-${{
hashFiles('pylint/__pkg_info__.py', 'requirements_test.txt', 'setup.py',
'setup.cfg', 'requirements_test_min.txt', 'requirements_docs.txt') }}"
hashFiles('pylint/__pkg_info__.py', 'setup.cfg') }}"
- name: Restore Python virtual environment
id: cache-venv
uses: actions/cache@v2.1.4
Expand All @@ -50,9 +49,8 @@ jobs:
python -m venv venv
. venv/bin/activate
python -m pip install -U pip setuptools wheel
pip install -U -r requirements_test.txt
pip install -U -r requirements_docs.txt
pip install -e .
pip install -U -e .[test_online]
pip install -U -e .[docs]
- name: Generate pre-commit restore key
id: generate-pre-commit-key
run: >-
Expand Down Expand Up @@ -194,8 +192,7 @@ jobs:
id: generate-python-key
run: >-
echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{
hashFiles('pylint/__pkg_info__.py', 'requirements_test.txt', 'setup.py',
'setup.cfg', 'requirements_test_min.txt') }}"
hashFiles('pylint/__pkg_info__.py', 'setup.cfg') }}"
- name: Restore Python virtual environment
id: cache-venv
uses: actions/cache@v2.1.4
Expand All @@ -212,8 +209,7 @@ jobs:
python -m venv venv
. venv/bin/activate
python -m pip install -U pip setuptools wheel
pip install -U -r requirements_test.txt
pip install -e .
pip install -e .[test_online] -U
pytest-linux:
name: Run tests Python ${{ matrix.python-version }} (Linux)
Expand Down Expand Up @@ -366,7 +362,7 @@ jobs:
id: generate-python-key
run: >-
echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{
hashFiles('pylint/__pkg_info__.py', 'setup.py', 'setup.cfg', 'requirements_test_min.txt') }}"
hashFiles('pylint/__pkg_info__.py', 'setup.cfg') }}"
- name: Restore Python virtual environment
id: cache-venv
uses: actions/cache@v2.1.4
Expand All @@ -383,8 +379,7 @@ jobs:
python -m venv venv
. venv\\Scripts\\activate
python -m pip install -U pip setuptools wheel
pip install -U -r requirements_test_min.txt
pip install -e .
pip install -U -e .[test_minimal]
pytest-windows:
name: Run tests Python ${{ matrix.python-version }} (Windows)
Expand Down Expand Up @@ -444,7 +439,7 @@ jobs:
id: generate-python-key
run: >-
echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{
hashFiles('pylint/__pkg_info__.py', 'setup.py', 'setup.cfg', 'requirements_test_min.txt') }}"
hashFiles('pylint/__pkg_info__.py', 'setup.cfg') }}"
- name: Restore Python virtual environment
id: cache-venv
uses: actions/cache@v2.1.4
Expand All @@ -461,8 +456,8 @@ jobs:
python -m venv venv
. venv/bin/activate
python -m pip install -U pip setuptools wheel
pip install -U -r requirements_test_min.txt
pip install -e .
pip install -e .[test_minimal] -U
pytest-pypy:
name: Run tests Python ${{ matrix.python-version }}
Expand Down
2 changes: 0 additions & 2 deletions requirements_docs.txt

This file was deleted.

9 changes: 0 additions & 9 deletions requirements_test.txt

This file was deleted.

2 changes: 0 additions & 2 deletions requirements_test_min.txt

This file was deleted.

7 changes: 0 additions & 7 deletions requirements_test_pre_commit.txt

This file was deleted.

30 changes: 29 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ classifiers =
Topic :: Software Development :: Testing
[options]
zip_safe = True
packages = find:
python_requires = ~=3.6
py_modules = easy_install
setup_requires =
install_requires =
astroid>=2.5.2,<2.7
isort>=4.2.5,<6
Expand All @@ -53,6 +54,33 @@ console_scripts =
pyreverse = pylint:run_pyreverse
symilar = pylint:run_symilar
[options.extras_require]
docs =
Sphinx==3.5.3
python-docs-theme==2020.12
test_minimal =
pytest~=6.2
pytest-benchmark~=3.2
pytest-cov~=2.11
test_pre_commit =
pre-commit~=2.11
autoflake==1.4
black==20.8b1
flake8==3.9.0
isort==5.8.0
mypy==0.812
pyupgrade==2.11.0
black-disable-checker==1.0.0
test_online =
coveralls~=3.0
coverage~=5.5
pyenchant~=3.2
pytest-profiling~=1.7
pytest-xdist~=2.2
[aliases]
test = pytest
Expand Down
25 changes: 1 addition & 24 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,5 @@
with open(HERE / "pylint/__pkginfo__.py", encoding="UTF-8") as f:
exec(f.read(), __pkginfo__) # pylint: disable=exec-used

with open(HERE / "requirements_docs.txt", encoding="UTF-8") as f:
doc_extra_requires = f.readlines()

with open(HERE / "requirements_test_min.txt", encoding="UTF-8") as f:
test_requires = f.readlines()

DEV_REQUIREMENTS_FILES = ["requirements_test.txt", "requirements_test_pre_commit.txt"]
dev_extra_requires = doc_extra_requires + test_requires
for requirement_file in DEV_REQUIREMENTS_FILES:
with open(HERE / requirement_file, encoding="UTF-8") as f:
dev_extra_requires += [
line for line in f.readlines() if not line.startswith("-r")
]


if __name__ == "__main__":
setup(
version=__pkginfo__["__version__"],
tests_require=test_requires,
extras_require={
':sys_platform=="win32"': ["colorama"],
"docs": doc_extra_requires,
"dev": dev_extra_requires,
},
)
setup(version=__pkginfo__["__version__"])
34 changes: 15 additions & 19 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@ skip_missing_interpreters = true

[testenv:pylint]
deps =
-r {toxinidir}/requirements_test_min.txt
pre-commit==2.10.1
-e {toxinidir}[test_minimal]
pre-commit~=2.11
commands =
pre-commit run pylint --all-files


[testenv:formatting]
basepython = python3
deps =
-r {toxinidir}/requirements_test_min.txt
pre-commit==2.10.1
-e {toxinidir}[test_minimal]
pre-commit~=2.11
commands =
pre-commit run --all-files


[testenv:mypy]
basepython = python3
deps =
pre-commit==2.10.1
pre-commit~=2.11
commands =
pre-commit run mypy --all-files

Expand All @@ -33,15 +33,15 @@ commands =
setenv =
COVERAGE_FILE = {toxinidir}/.coverage.{envname}
deps =
-r {toxinidir}/requirements_test.txt
-e {toxinidir}[test_online]
commands =
; Run tests, ensuring all benchmark tests do not run
pytest --benchmark-disable {toxinidir}/tests/ {posargs:}


[testenv:spelling]
deps =
-r {toxinidir}/requirements_test.txt
-e {toxinidir}[test_online]
commands =
pytest {toxinidir}/tests/ {posargs:} -k unittest_spelling

Expand All @@ -50,7 +50,7 @@ commands =
setenv =
COVERAGE_FILE = {toxinidir}/.coverage
deps =
-r {toxinidir}/requirements_test.txt
-e {toxinidir}[test_online]
skip_install = true
commands =
coverage combine
Expand All @@ -60,32 +60,28 @@ commands =
[testenv:docs]
changedir = doc/
deps =
-r {toxinidir}/requirements_docs.txt
-e {toxinidir}[docs]
commands =
sphinx-build -W -b html -d _build/doctrees . _build/html


[testenv:benchmark]
deps =
-r {toxinidir}/requirements_test.txt
-e {toxinidir}[test_online]
pygal
commands =
; Run the only the benchmark tests, grouping output and forcing .json output so we
; can compare benchmark runs
pytest --exitfirst \
--failed-first \
--benchmark-only \
--benchmark-save=batch_files \
--benchmark-save-data \
--benchmark-autosave {toxinidir}/tests \
--benchmark-group-by="group" \
{posargs:}
pytest --exitfirst --failed-first --benchmark-only \
--benchmark-save=batch_files --benchmark-save-data \
--benchmark-autosave {toxinidir}/tests --benchmark-group-by="group" \
{posargs:}

[testenv:profile_against_external]
setenv =
PYTEST_PROFILE_EXTERNAL = 1
deps =
-r {toxinidir}/requirements_test.txt
-e {toxinidir}[test_online]
gprof2dot
commands =
pytest --exitfirst \
Expand Down

0 comments on commit 1291354

Please sign in to comment.