diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000..42016b1 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,17 @@ +version: 2 + +build: + os: ubuntu-22.04 + tools: + python: "3.10" + +# Build documentation in the docs/ directory with Sphinx +sphinx: + configuration: docs/conf.py + +# Build all formats like pdf, htmlzip, etc +formats: all + +python: + install: + - requirements: requirements/docs.txt diff --git a/CHANGELOG.rst b/CHANGELOG.rst index c9314e5..940b601 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -29,6 +29,19 @@ Added * 🎈 Support for Python 3.11 `Pull #203 `_ +* ⛏️ Read the docs build added with supporting docs requirements. `Pull #205 + `_. + +Changed +....... + +* ⛏️ Tox configuration rebuilt with lint, test and meta labels. `Pull #205 + `_. + +* ⛏ Requirements cleaned: base requirements removed, specific versions + indicated where builds are required on particular Python versions, README + added. `Pull #205 `_. + 0.13.0_ - 2023/02/17 -------------------- diff --git a/Makefile b/Makefile index d78483b..4574e6e 100644 --- a/Makefile +++ b/Makefile @@ -7,17 +7,6 @@ rst_files=README.rst CHANGELOG.rst good_examples = $(wildcard examples/good/*.py examples/good/black/*.py) examples/good/noqa/test_cmd.py bad_examples = $(wildcard examples/good/noqa/test_0*.py examples/good/black/noqa/test_0*.py examples/bad/*.py) - -# Local dev: Install requirements -.PHONY: dev -dev: - pip-sync requirements/base.txt requirements/test.txt requirements/dev.txt - -# Local dev: Run all tests for available Python versions -.PHONY: test -test: - tox --skip-missing-interpreters true - # --- Tox recipes --- .PHONY: lint @@ -35,13 +24,6 @@ lint: @echo "=== setup.py ===" python setup.py check --metadata --strict -.PHONY: fixlint -fixlint: - @echo "=== fixing isort ===" - isort --quiet --recursive $(lint_files) - @echo "=== fixing yapf ===" - yapf --recursive --in-place $(lint_files) - .PHONY: lintexamples lintexamples: @echo "=== flake8 ===" @@ -60,13 +42,8 @@ lintexamplespy38: @echo "=== mypy ===" mypy examples/good_py38 -.PHONY: fixlintexamples -fixlintexamples: - @echo "=== black ===" - black examples/good/black - -.PHONY: doc -doc: +.PHONY: docs +docs: $(MAKE) -C docs html .PHONY: cmd @@ -87,11 +64,10 @@ cmdbad: echo; \ done - # --- Local dev: Building / Publishing --- .PHONY: clean -clean: dev +clean: rm -rf dist build .tox .pytest_cache src/flake8_aaa.egg-info find . -name '*.pyc' -delete @@ -120,6 +96,18 @@ on_master: tag: on_master git tag -a $$(python -c 'from src.flake8_aaa.__about__ import __version__; print("v{}".format(__version__))') +.PHONY: fixlint +fixlint: + @echo "=== fixing isort ===" + isort --quiet --recursive $(lint_files) + @echo "=== fixing yapf ===" + yapf --recursive --in-place $(lint_files) + +.PHONY: fixlintexamples +fixlintexamples: + @echo "=== black ===" + black examples/good/black + .PHONY: black_examples black_examples: $(MAKE) -C examples clean all diff --git a/docs/conf.py b/docs/conf.py index b4c1c8c..188b3e0 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -53,7 +53,7 @@ # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +language = 'en' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. diff --git a/examples/good/black/test_comments.py b/examples/good/black/test_comments.py index ba5d1c1..d63a0f0 100644 --- a/examples/good/black/test_comments.py +++ b/examples/good/black/test_comments.py @@ -88,7 +88,7 @@ def test_in_arrange(): # Let's make a 3, 4, 5 triangle y = 4 - result = x ** 2 + y ** 2 + result = x**2 + y**2 assert result == 25 diff --git a/requirements/Makefile b/requirements/Makefile index a1f0fae..f39d252 100644 --- a/requirements/Makefile +++ b/requirements/Makefile @@ -8,5 +8,4 @@ all: $(outputs) pip-compile --verbose --output-file $@ $< # Dependency chain -test.txt: base.txt -dev.txt: test.txt +dev.txt: ci.txt diff --git a/requirements/README.rst b/requirements/README.rst new file mode 100644 index 0000000..099cda2 --- /dev/null +++ b/requirements/README.rst @@ -0,0 +1,47 @@ +Requirements management +======================= + +Summary +------- + +* ``ci.in|txt``: Requirements for GitHub Actions built with Python 3.10. + +* ``dev.in|txt``: Requirements for working on code. Build with Python 3.8 + (can't build on 3.7) + +* Tox environments use ``lint.in|txt``, ``test.in|txt`` and + ``examples.in|txt``, all built with Python 3.7. + +* ``docs.in|txt``: Python 3.10 (match RTD) + +CI ``ci.txt`` py310 +------------------- + +Used by GitHub Actions. Installs tox and GH helper to manage Python versions. + +# Requirements for CI +# Currently GitHub actions on their Ubuntu 22.04 images +# These have Python 3.10.6 installed so compile these requirements with py310 +# https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md + +Targets Python 3.10 because GHA instance uses that version in ``ubuntu-22.04`` +image. + +Am using a pinned Tox dependency to allow for tags to be built "in the past" in +scenarios where they might have missed a build / were forgotten. E.g. `tag +v0.12.2 `_ was +added more than a year after the release was done, but by that point couldn't +be built by latest Tox, so `commit 77e29 +`_ +now shows red 😞. + +Development ``dev.txt`` py38 +---------------------------- + +Targets Python 3.8 because it's the oldest version that is easy to build these +requirements for (Python 3.7 fails to build this list with no constraints). + +All tools for local development. Tests are run in Tox, so no Pytest. But +linters are run in editor, so those are installed. + +Twine available for shipping packages diff --git a/requirements/base.in b/requirements/base.in deleted file mode 100644 index 849df5d..0000000 --- a/requirements/base.in +++ /dev/null @@ -1,2 +0,0 @@ -asttokens>=1.1.11 -flake8>=3 diff --git a/requirements/base.txt b/requirements/base.txt deleted file mode 100644 index 221a6ab..0000000 --- a/requirements/base.txt +++ /dev/null @@ -1,18 +0,0 @@ -# -# This file is autogenerated by pip-compile with python 3.9 -# To update, run: -# -# pip-compile --output-file=base.txt base.in -# -asttokens==2.0.5 - # via -r base.in -flake8==4.0.1 - # via -r base.in -mccabe==0.6.1 - # via flake8 -pycodestyle==2.8.0 - # via flake8 -pyflakes==2.4.0 - # via flake8 -six==1.16.0 - # via asttokens diff --git a/requirements/ci.in b/requirements/ci.in index 7f49ac2..a880e59 100644 --- a/requirements/ci.in +++ b/requirements/ci.in @@ -1,7 +1,4 @@ +# py310 # Requirements for CI -# Currently GitHub actions on their Ubuntu 22.04 images -# These have Python 3.10.6 installed so compile these requirements with py310 -# https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md - tox tox-gh-actions diff --git a/requirements/dev.in b/requirements/dev.in index a3a468b..4188d8a 100644 --- a/requirements/dev.in +++ b/requirements/dev.in @@ -1,5 +1,14 @@ --c base.txt --c test.txt +# py38 +# Requirements for local development in editor / outside tox +# Can't be built by py37, target py38 for development. #198 +# Constrain with CI requirements so Tox versions match +-c ci.txt + +flake8 +mypy pip-tools +pytest +tox +yapf twine diff --git a/requirements/dev.txt b/requirements/dev.txt index 66228b8..8068ad8 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1,101 +1,174 @@ # -# This file is autogenerated by pip-compile with python 3.9 -# To update, run: +# This file is autogenerated by pip-compile with Python 3.8 +# by the following command: # # pip-compile --output-file=dev.txt dev.in # -bleach==4.1.0 +attrs==22.2.0 + # via pytest +bleach==6.0.0 # via readme-renderer -certifi==2021.10.8 +build==0.10.0 + # via pip-tools +cachetools==5.3.0 # via - # -c test.txt - # requests -cffi==1.15.0 + # -c ci.txt + # tox +certifi==2022.12.7 + # via requests +cffi==1.15.1 # via cryptography -charset-normalizer==2.0.9 +chardet==5.1.0 # via - # -c test.txt - # requests -click==8.0.3 + # -c ci.txt + # tox +charset-normalizer==3.0.1 + # via requests +click==8.1.3 # via pip-tools -colorama==0.4.4 - # via twine -cryptography==36.0.1 +colorama==0.4.6 + # via + # -c ci.txt + # tox +cryptography==39.0.1 # via secretstorage -docutils==0.17.1 +distlib==0.3.6 # via - # -c test.txt - # readme-renderer -idna==3.3 + # -c ci.txt + # virtualenv +docutils==0.19 + # via readme-renderer +exceptiongroup==1.1.0 + # via pytest +filelock==3.9.0 # via - # -c test.txt - # requests -importlib-metadata==4.10.0 + # -c ci.txt + # tox + # virtualenv +flake8==6.0.0 + # via -r dev.in +idna==3.4 + # via requests +importlib-metadata==6.0.0 # via # keyring # twine -jeepney==0.7.1 +importlib-resources==5.12.0 + # via keyring +iniconfig==2.0.0 + # via pytest +jaraco-classes==3.2.3 + # via keyring +jeepney==0.8.0 # via # keyring # secretstorage -keyring==23.4.0 +keyring==23.13.1 # via twine -packaging==21.3 +markdown-it-py==2.2.0 + # via rich +mccabe==0.7.0 + # via flake8 +mdurl==0.1.2 + # via markdown-it-py +more-itertools==9.0.0 + # via jaraco-classes +mypy==1.0.1 + # via -r dev.in +mypy-extensions==1.0.0 + # via mypy +packaging==23.0 # via - # -c test.txt - # bleach -pep517==0.12.0 - # via pip-tools -pip-tools==6.4.0 + # -c ci.txt + # build + # pyproject-api + # pytest + # tox +pip-tools==6.12.2 # via -r dev.in -pkginfo==1.8.2 +pkginfo==1.9.6 # via twine +platformdirs==3.0.0 + # via + # -c ci.txt + # tox + # virtualenv +pluggy==1.0.0 + # via + # -c ci.txt + # pytest + # tox +pycodestyle==2.10.0 + # via flake8 pycparser==2.21 # via cffi -pygments==2.10.0 +pyflakes==3.0.1 + # via flake8 +pygments==2.14.0 # via - # -c test.txt # readme-renderer -pyparsing==3.0.6 + # rich +pyproject-api==1.5.0 # via - # -c test.txt - # packaging -readme-renderer==32.0 + # -c ci.txt + # tox +pyproject-hooks==1.0.0 + # via build +pytest==7.2.1 + # via -r dev.in +readme-renderer==37.3 # via twine -requests==2.26.0 +requests==2.28.2 # via - # -c test.txt # requests-toolbelt # twine -requests-toolbelt==0.9.1 +requests-toolbelt==0.10.1 + # via twine +rfc3986==2.0.0 # via twine -rfc3986==1.5.0 +rich==13.3.1 # via twine -secretstorage==3.3.1 +secretstorage==3.3.3 # via keyring six==1.16.0 + # via bleach +tomli==2.0.1 # via - # -c base.txt - # -c test.txt - # bleach -tomli==2.0.0 + # -c ci.txt + # build + # mypy + # pyproject-api + # pyproject-hooks + # pytest + # tox +tox==4.4.5 # via - # -c test.txt - # pep517 -tqdm==4.62.3 - # via twine -twine==3.7.1 + # -c ci.txt + # -r dev.in +twine==4.0.2 # via -r dev.in -urllib3==1.26.7 +typing-extensions==4.5.0 + # via + # mypy + # rich +urllib3==1.26.14 # via - # -c test.txt # requests + # twine +virtualenv==20.19.0 + # via + # -c ci.txt + # tox webencodings==0.5.1 # via bleach -wheel==0.37.1 +wheel==0.38.4 # via pip-tools -zipp==3.6.0 - # via importlib-metadata +yapf==0.32.0 + # via -r dev.in +zipp==3.14.0 + # via + # importlib-metadata + # importlib-resources # The following packages are considered to be unsafe in a requirements file: # pip diff --git a/requirements/docs.in b/requirements/docs.in new file mode 100644 index 0000000..2049e76 --- /dev/null +++ b/requirements/docs.in @@ -0,0 +1,4 @@ +# py310 +sphinx +sphinx-autobuild +sphinx_rtd_theme diff --git a/requirements/docs.txt b/requirements/docs.txt new file mode 100644 index 0000000..992e3fe --- /dev/null +++ b/requirements/docs.txt @@ -0,0 +1,72 @@ +# +# This file is autogenerated by pip-compile with Python 3.10 +# by the following command: +# +# pip-compile --output-file=docs.txt docs.in +# +alabaster==0.7.13 + # via sphinx +babel==2.11.0 + # via sphinx +certifi==2022.12.7 + # via requests +charset-normalizer==3.0.1 + # via requests +colorama==0.4.6 + # via sphinx-autobuild +docutils==0.18.1 + # via + # sphinx + # sphinx-rtd-theme +idna==3.4 + # via requests +imagesize==1.4.1 + # via sphinx +jinja2==3.1.2 + # via sphinx +livereload==2.6.3 + # via sphinx-autobuild +markupsafe==2.1.2 + # via jinja2 +packaging==23.0 + # via sphinx +pygments==2.14.0 + # via sphinx +pytz==2022.7.1 + # via babel +requests==2.28.2 + # via sphinx +six==1.16.0 + # via livereload +snowballstemmer==2.2.0 + # via sphinx +sphinx==6.1.3 + # via + # -r docs.in + # sphinx-autobuild + # sphinx-rtd-theme +sphinx-autobuild==2021.3.14 + # via -r docs.in +sphinx-rtd-theme==1.2.0 + # via -r docs.in +sphinxcontrib-applehelp==1.0.4 + # via sphinx +sphinxcontrib-devhelp==1.0.2 + # via sphinx +sphinxcontrib-htmlhelp==2.0.1 + # via sphinx +sphinxcontrib-jquery==2.0.0 + # via sphinx-rtd-theme +sphinxcontrib-jsmath==1.0.1 + # via sphinx +sphinxcontrib-qthelp==1.0.3 + # via sphinx +sphinxcontrib-serializinghtml==1.1.5 + # via sphinx +tornado==6.2 + # via livereload +urllib3==1.26.14 + # via requests + +# The following packages are considered to be unsafe in a requirements file: +# setuptools diff --git a/requirements/examples.in b/requirements/examples.in index a6e3407..292fe88 100644 --- a/requirements/examples.in +++ b/requirements/examples.in @@ -1,4 +1,5 @@ -black +# py37 +black<23 flake8 mypy pytest diff --git a/requirements/examples.txt b/requirements/examples.txt index 4f17b45..04c57b1 100644 --- a/requirements/examples.txt +++ b/requirements/examples.txt @@ -1,52 +1,63 @@ # -# This file is autogenerated by pip-compile with python 3.9 -# To update, run: +# This file is autogenerated by pip-compile with Python 3.7 +# by the following command: # # pip-compile --output-file=examples.txt examples.in # -attrs==21.4.0 +attrs==22.2.0 # via pytest -black==21.12b0 +black==22.12.0 # via -r examples.in -click==8.0.3 +click==8.1.3 # via black -flake8==4.0.1 +exceptiongroup==1.1.0 + # via pytest +flake8==5.0.4 # via -r examples.in -iniconfig==1.1.1 +importlib-metadata==4.2.0 + # via + # click + # flake8 + # pluggy + # pytest +iniconfig==2.0.0 # via pytest -mccabe==0.6.1 +mccabe==0.7.0 # via flake8 -mypy==0.930 +mypy==1.0.1 # via -r examples.in -mypy-extensions==0.4.3 +mypy-extensions==1.0.0 # via # black # mypy -packaging==21.3 +packaging==23.0 # via pytest -pathspec==0.9.0 +pathspec==0.11.0 # via black -platformdirs==2.4.1 +platformdirs==3.0.0 # via black pluggy==1.0.0 # via pytest -py==1.11.0 - # via pytest -pycodestyle==2.8.0 +pycodestyle==2.9.1 # via flake8 -pyflakes==2.4.0 +pyflakes==2.5.0 # via flake8 -pyparsing==3.0.6 - # via packaging -pytest==6.2.5 +pytest==7.2.1 # via -r examples.in -toml==0.10.2 - # via pytest -tomli==1.2.3 +tomli==2.0.1 + # via + # black + # mypy + # pytest +typed-ast==1.5.4 # via # black # mypy -typing-extensions==4.0.1 +typing-extensions==4.5.0 # via # black + # importlib-metadata # mypy + # platformdirs +zipp==3.14.0 + # via importlib-metadata diff --git a/requirements/test.in b/requirements/test.in index 8c39b4c..2f7390a 100644 --- a/requirements/test.in +++ b/requirements/test.in @@ -1,13 +1,8 @@ --c base.txt - -Sphinx -flake8 +# py37 +flake8==4.0.1 isort -mypy +mypy==0.930 pygments pytest restructuredtext-lint -six -sphinx-rtd-theme -tox yapf diff --git a/requirements/test.txt b/requirements/test.txt index e4d780b..0644512 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -1,133 +1,57 @@ # -# This file is autogenerated by pip-compile with python 3.9 -# To update, run: +# This file is autogenerated by pip-compile with Python 3.7 +# by the following command: # # pip-compile --output-file=test.txt test.in # -alabaster==0.7.12 - # via sphinx -attrs==21.4.0 +attrs==22.2.0 + # via pytest +docutils==0.19 + # via restructuredtext-lint +exceptiongroup==1.1.0 # via pytest -babel==2.9.1 - # via sphinx -certifi==2021.10.8 - # via requests -charset-normalizer==2.0.9 - # via requests -distlib==0.3.4 - # via virtualenv -docutils==0.17.1 - # via - # restructuredtext-lint - # sphinx - # sphinx-rtd-theme -filelock==3.4.2 - # via - # tox - # virtualenv flake8==4.0.1 + # via -r test.in +importlib-metadata==4.2.0 # via - # -c base.txt - # -r test.in -idna==3.3 - # via requests -imagesize==1.3.0 - # via sphinx -iniconfig==1.1.1 + # flake8 + # pluggy + # pytest +iniconfig==2.0.0 # via pytest -isort==5.10.1 +isort==5.11.5 # via -r test.in -jinja2==3.0.3 - # via sphinx -markupsafe==2.0.1 - # via jinja2 mccabe==0.6.1 - # via - # -c base.txt - # flake8 + # via flake8 mypy==0.930 # via -r test.in -mypy-extensions==0.4.3 +mypy-extensions==1.0.0 # via mypy -packaging==21.3 - # via - # pytest - # sphinx - # tox -platformdirs==2.4.1 - # via virtualenv +packaging==23.0 + # via pytest pluggy==1.0.0 - # via - # pytest - # tox -py==1.11.0 - # via - # pytest - # tox + # via pytest pycodestyle==2.8.0 - # via - # -c base.txt - # flake8 + # via flake8 pyflakes==2.4.0 - # via - # -c base.txt - # flake8 -pygments==2.10.0 - # via - # -r test.in - # sphinx -pyparsing==3.0.6 - # via packaging -pytest==6.2.5 + # via flake8 +pygments==2.14.0 # via -r test.in -pytz==2021.3 - # via babel -requests==2.26.0 - # via sphinx -restructuredtext-lint==1.3.2 +pytest==7.2.1 # via -r test.in -six==1.16.0 - # via - # -c base.txt - # -r test.in - # tox - # virtualenv -snowballstemmer==2.2.0 - # via sphinx -sphinx==4.3.2 - # via - # -r test.in - # sphinx-rtd-theme -sphinx-rtd-theme==1.0.0 +restructuredtext-lint==1.4.0 # via -r test.in -sphinxcontrib-applehelp==1.0.2 - # via sphinx -sphinxcontrib-devhelp==1.0.2 - # via sphinx -sphinxcontrib-htmlhelp==2.0.0 - # via sphinx -sphinxcontrib-jsmath==1.0.1 - # via sphinx -sphinxcontrib-qthelp==1.0.3 - # via sphinx -sphinxcontrib-serializinghtml==1.1.5 - # via sphinx -toml==0.10.2 +tomli==2.0.1 # via + # mypy # pytest - # tox -tomli==2.0.0 +typed-ast==1.5.4 # via mypy -tox==3.24.5 - # via -r test.in -typing-extensions==4.0.1 - # via mypy -urllib3==1.26.7 - # via requests -virtualenv==20.11.2 - # via tox +typing-extensions==4.5.0 + # via + # importlib-metadata + # mypy yapf==0.32.0 # via -r test.in - -# The following packages are considered to be unsafe in a requirements file: -# setuptools +zipp==3.15.0 + # via importlib-metadata diff --git a/setup.py b/setup.py index 07b3995..8174f40 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,7 @@ def readme(): # --- Python --- packages=find_packages('src'), package_dir={'': 'src'}, - python_requires='>=3.7, <4', + python_requires='>=3.7', install_requires=[ 'asttokens >= 2', ], diff --git a/tox.ini b/tox.ini index 5bf3a94..96e5ef1 100644 --- a/tox.ini +++ b/tox.ini @@ -1,75 +1,106 @@ # Environments -# ------------ +# ============ # -# * cmd -# Run the command line interface (`python -m flake8_aaa`) on all good -# example files. Expect no errors and no non-zero error codes. -# * cmdbad -# Run all bad examples through command line interface and ensure an error -# code is returned for every one. -# * doc -# Emulate the documentation build on RTD. -# * examples -# Check all examples, good and bad. Includes linting with vanilla Flake8 -# and assert tests formatted with Black pass. All (working) examples -# executed with vanilla pytest. -# * examples_aaa -# Ensures that all examples work against Flake8-AAA as expected. Good -# examples are green. Bad examples are linted and the output asserted to -# match expected. -# * install -# Assert that plugin can be installed and run via flake8 in a clean venv. -# Flake8 is called with flake8-aaa installed to lint flake8-aaa's tests -# (dog fooding) Test requirements do not include flake8-aaa, latest -# version is installed by tox during testing. -# * lint -# "Internal" linting and formatting on the codebase and tests. Not run -# with Flake8-aaa installed (that happens in "install" env). Does not -# check examples (that happens in "examples" and "examples_aaa" envs). -# * test -# Run pytest on test suite. +# Labels +# ------ +# +# In increasing level of integration: +# * lint: Lint all the things! +# * test: Run all tests on code, run pytest on stdlib examples. +# * meta; Integration tests - run as plugin and command against code and examples. +# +# Additional: +# * docs: Emulate doc build on RTD. +# +# Cheat-sheet +# ----------- +# +# * When updating this file, check all default environments have a description: +# ``tox l``. Check a label's envs: ``tox l -m examples``. [tox] -envlist = py3{7,8,9,10,11}-{install,lint,examples,examples_aaa,test,cmd,cmdbad},py310-doc +envlist = + py3{7,8,9,10,11}-lint_{code,examples} + py3{7,8,9,10,11}-test_{code,examples} + py3{7,8,9,10,11}-meta_{plugin,command} + py310-docs [testenv] -deps = - doc,lint,test: -rrequirements/base.txt - doc,lint,test: -rrequirements/test.txt - examples: -rrequirements/examples.txt - examples_aaa: flake8>=4 - install: flake8>=4 -commands = - cmd: make cmd - cmdbad: make cmdbad - doc: make doc - examples: {[examples]commands} - py3{8,9,10,11}-examples: {[py38-examples]commands} - examples_aaa: {[examples_aaa]commands} - install: {[install]commands} - lint: make lint - test: pytest {posargs:tests} -skip_install = - lint: true - examples: true setenv = PYTHONWARNINGS = default TOXDIR = {envdir} + +# === Env commands === + +# --- LINT: code --- +# Regular linting of code: flake8, yapf, mypy, etc. +[testenv:py3{7,8,9,10,11}-lint_code] +description = ⛏️ Regular linting of code: Flake8, yapf, mypy, etc. +labels = + lint + lint_code +deps = + -rrequirements/test.txt +skip_install = true +commands = + make lint allowlist_externals = - bash - diff make -# --- Env commands --- +# --- LINT: examples --- +# Lint all good and bad examples. Includes linting with vanilla Flake8 and +# assert tests formatted with Black pass. +[testenv:py37-lint_examples] +description = ⛏️ Lint examples, run stdlib examples on Pytest +labels = + lint + lint_examples +deps = + -rrequirements/examples.txt +skip_install = true +commands = + make lintexamples +allowlist_externals = + make -[install] +# Extra checks on Python 3.8 (and later) files +# Future work: Merge with above in #198 +[testenv:py3{8,9,10,11}-lint_examples] +description = {[testenv:py37-lint_examples]description} +labels = + lint + lint_examples +deps = {[testenv:py37-lint_examples]deps} +skip_install = true commands = - flake8 --version - flake8 tests + {[testenv:py37-lint_examples]commands} + make lintexamplespy38 +allowlist_externals = + make -[examples] +# --- TEST: code --- +# Run Pytest on all code +[testenv:py3{7,8,9,10,11}-test_code] +description = 🧰 Test all code +labels = + test + test_code +deps = + -rrequirements/test.txt +commands = + pytest {posargs:tests} + +# --- TEST: Examples --- +# All stdlib examples executed with vanilla Pytest. +[testenv:py37-test_examples] +description = 🧰 Test stdlib examples on py37 +labels = + test + test_examples +deps = + -rrequirements/examples.txt +skip_install = true commands = - make lintexamples pytest \ examples/good/test_comments.py \ examples/good/test_with_statement.py \ @@ -79,19 +110,63 @@ commands = examples/bad/test_aaa04.py \ examples/bad/test_aaa06.py -[py38-examples] -# Add extra checks on Python 3.8 (and later) files +# Extra checks on Python 3.8 (and later) files +# Future work: Merge with above in #198 +[testenv:py3{8,9,10,11}-test_examples] +description = 🧰 Test stdlib examples on py38+ +labels = + test + test_examples +deps = + -rrequirements/examples.txt +skip_install = true commands = - make lintexamplespy38 + {[testenv:py37-test_examples]commands} pytest examples/good_py38/test_assignment_operator.py -[examples_aaa] +# --- META: plugin --- +# Run as plugin to lint Flake8-AAA's own tests (dog fooding), and also lint all +# good and bad examples. Bad examples generate expected errors. +[testenv:py3{7,8,9,10,11}-meta_plugin] +description = 🎈 Run -m flake_aaa against examples and tests. +labels = + meta + meta_plugin +deps = + flake8>=4 commands = flake8 --version + flake8 tests flake8 examples/good - bash -c "flake8 examples/bad/ | sort > {envtmpdir}/out" - bash -c "sort examples/bad/bad_expected.out > {envtmpdir}/expected_out" diff {envtmpdir}/out {envtmpdir}/expected_out +allowlist_externals = + bash + diff + +# --- META: command --- +# Run `... -m flake8_aaa`) on all example files. Check errors from bad examples +# are as expected. +[testenv:py3{7,8,9,10,11}-meta_command] +description = 🎈 Run command "-m flake8_aaa" on all examples +commands = + make cmd + make cmdbad +allowlist_externals = + make + +# --- Docs --- +[testenv:py310-docs] +description = 📕 Emulate the documentation build on RTD using Python 3.10 +deps = + -rrequirements/docs.txt +commands = + make docs +allowlist_externals = + make + +# --- Mappings for GitHub actions --- [gh-actions] python =