Skip to content

Commit

Permalink
Updated tox config to run mypy in default environment
Browse files Browse the repository at this point in the history
This is mainly so that the default tox environment mirrors the CI
checks.

Also:

* Added some notes about tox in `developers.rst`.
* Made the `mypy` tox environment run for all python versions.
* Update mypy python config version to 3.7 to reflect minimum supported
  python version.
  • Loading branch information
aucampia committed Dec 17, 2021
1 parent 5230af3 commit 3b39bce
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
21 changes: 20 additions & 1 deletion docs/developers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ Run tests with `pytest <https://docs.pytest.org/en/latest/>`_:
$ pip install -r requirements.txt -r requirements.dev.txt
$ pytest
Specific tests can be run by file name. For example:

.. code-block:: bash
Expand Down Expand Up @@ -64,6 +63,26 @@ Check types with `mypy <http://mypy-lang.org/>`_:
python -m mypy --show-error-context --show-error-codes rdflib
Using tox
---------------------

RDFLib has a `tox <https://tox.wiki/en/latest/index.html>`_ config file which makes it easier to run validation on all supported python versions.

.. code-block:: bash
# install tox
pip install tox
# list all tox environments
tox -a
# run default environment for all python versions
tox
# run a specific environment
tox -e py37 # default environment with py37
tox -e py39-mypy # mypy environment with py39
Writing documentation
---------------------

Expand Down
7 changes: 3 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
[tox]
envlist =
py37,py38,py39
py37,py38,py39,py310

[testenv]
setenv =
BERKELEYDB_DIR = /usr
commands =
{envpython} -m mypy rdflib --show-error-context --show-error-codes
{envpython} setup.py clean --all
{envpython} setup.py build
{envpython} -m pytest
Expand All @@ -26,9 +27,7 @@ deps =
-rrequirements.txt
-rrequirements.dev.txt

[testenv:mypy]
basepython =
python3.7
[testenv:py3{7,8,9,10}-mypy]
commands =
{envpython} -m mypy rdflib --show-error-context --show-error-codes
deps =
Expand Down

0 comments on commit 3b39bce

Please sign in to comment.