summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorIwan Aucamp <aucampia@gmail.com>2021-09-10 23:24:36 +0200
committerIwan Aucamp <aucampia@gmail.com>2021-09-10 23:24:36 +0200
commit90f6fe5611f4c7411e5eac347cafb9d009829b6c (patch)
tree13a18c252540faed9a29e1a2be5cb152b90b1974 /docs
parentfd935e2a7480d19a0c03a6757107767f94c01acd (diff)
downloadrdflib-90f6fe5611f4c7411e5eac347cafb9d009829b6c.tar.gz
Fix mypy type errors and add mypy to .drone.yml
Fixes #1311 Add `mypy` to .drone.yml and fix type errors that come up. Not type checking examples or tests. Other changes: - fix return value for `Graph.serialize` (refs #1394) - remove default value for `rdflib.plugins.sparql.algebra.translateAlgebra` (refs #1322) - add .dockerignore to reduce context size and make docker quicker to run. - add .flake8 config to ignore line length as black is managing formatting. - add mypy to docker-compose, makefile and tox.ini - fix the way csv2rdf is invoked to ensure that the right code gets executed.
Diffstat (limited to 'docs')
-rw-r--r--docs/developers.rst28
1 files changed, 26 insertions, 2 deletions
diff --git a/docs/developers.rst b/docs/developers.rst
index 52d8ea89..fed80505 100644
--- a/docs/developers.rst
+++ b/docs/developers.rst
@@ -15,6 +15,9 @@ Code should be formatted using `black <https://github.com/psf/black>`_.
While not yet mandatory, it will be required in the future (6.0.0+).1
Use Black v21.6b1, with the black.toml config file provided.
+Code should also pass `flake8 <https://github.com/psf/black>`_ linting
+and `mypy <http://mypy-lang.org/>`_ type checking.
+
Any new functionality being added to RDFLib should have doc tests and
unit tests. Tests should be added for any functionality being changed
that currently does not have any doc tests or unit tests. And all the
@@ -28,7 +31,7 @@ Running tests
-------------
Run tests with `nose <https://nose.readthedocs.org/en/latest/>`_:
-.. code-block: bash
+.. code-block:: bash
$ pip install nose
$ python run_tests.py
@@ -42,10 +45,31 @@ Specific tests can either be run by module name or file name. For example::
$ python run_tests.py --tests rdflib.graph
$ python run_tests.py --tests test/test_graph.py
+Running static checks
+---------------------
+
+Check formatting with `black <https://github.com/psf/black>`_:
+
+.. code-block:: bash
+
+ python -m black --config black.toml --check ./rdflib
+
+Check style and conventions with `flake8 <https://github.com/psf/black>`_:
+
+.. code-block:: bash
+
+ python -m flake8 rdflib
+
+Check types with `mypy <http://mypy-lang.org/>`_:
+
+.. code-block:: bash
+
+ python -m mypy --show-error-context --show-error-codes rdflib
+
Writing documentation
---------------------
-We use sphinx for generating HTML docs, see :ref:`docs`
+We use sphinx for generating HTML docs, see :ref:`docs`.
Continuous Integration
----------------------