From 8918606b99d3be458a2b036deeb7573ef6cac291 Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Tue, 26 Sep 2023 08:23:44 +0200 Subject: [PATCH 1/2] Add ability to set custom docs-dependencies. Used for https://github.com/zopefoundation/zope.hookable/pull/30 --- config/README.rst | 13 +++++++++++-- config/config-package.py | 3 ++- config/default/tox-docs.j2 | 6 ++++++ config/default/tox-testenv.j2 | 2 +- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/config/README.rst b/config/README.rst index 818f28c..7eede2e 100644 --- a/config/README.rst +++ b/config/README.rst @@ -241,13 +241,16 @@ updated. Example: ] coverage-basepython = "python3.9" coverage-command = [ - "coverage run {envbindir}/test_with_gs []" + "coverage run {envbindir}/test_with_gs []", ] coverage-setenv = [ "COVERAGE_HOME={toxinidir}", ] coverage-additional = [ - "depends = py37,docs" + "depends = py37,docs", + ] + docs-deps = [ + "urllib3 < 2", ] use-flake8 = true @@ -483,6 +486,12 @@ coverage-additional This option allows to add additional lines below ``[testenv:coverage]`` in ``tox.ini``. This option has to be a list of strings. +docs-deps + This option allows to add additional install dependencies for + ``[testenv:docs]`` in ``tox.ini``. This option has to be a list of strings + and is empty by default. Caution: The values set for this option overwrite + the ones set in ``[testenv]``. + use-flake8 Whether to add the ``flake8`` and ``isort`` linting steps to the section ``[testenv:lint]``. By default these steps are run. On an older code base it diff --git a/config/config-package.py b/config/config-package.py index 143c4af..f05d0cc 100755 --- a/config/config-package.py +++ b/config/config-package.py @@ -432,6 +432,7 @@ def tox(self): use_flake8 = self.tox_option('use-flake8', default=True) else: use_flake8 = self.args.use_flake8 + docs_deps = self.tox_option('docs-deps', default=[]) self.meta_cfg['tox']['use-flake8'] = use_flake8 self.copy_with_meta( 'tox.ini.j2', @@ -458,7 +459,7 @@ def tox(self): with_future_python=self.with_future_python, with_pypy=self.with_pypy, with_sphinx_doctests=self.with_sphinx_doctests, - with_config_type=self.config_type, + docs_deps=docs_deps, ) def tests_yml(self): diff --git a/config/default/tox-docs.j2 b/config/default/tox-docs.j2 index 525fd98..4e199af 100644 --- a/config/default/tox-docs.j2 +++ b/config/default/tox-docs.j2 @@ -3,6 +3,12 @@ [testenv:docs] basepython = python3 skip_install = false +{% if docs_deps %} +deps = + {% for line in docs_deps %} + %(line)s + {% endfor %} +{% endif %} {% if not with_sphinx_doctests %} extras = docs diff --git a/config/default/tox-testenv.j2 b/config/default/tox-testenv.j2 index 5b24a6e..f264940 100644 --- a/config/default/tox-testenv.j2 +++ b/config/default/tox-testenv.j2 @@ -1,7 +1,7 @@ [testenv] usedevelop = true -{% if with_config_type == "pure-python" %} +{% if config_type == "pure-python" %} package = wheel wheel_build_env = .pkg {% endif %} From 145eaa0e2c2e88cf874ed91712cd85e3c0e28dc4 Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Wed, 27 Sep 2023 08:31:30 +0200 Subject: [PATCH 2/2] Update config/README.rst Co-authored-by: Jens Vagelpohl --- config/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/README.rst b/config/README.rst index 7eede2e..620dfd2 100644 --- a/config/README.rst +++ b/config/README.rst @@ -489,7 +489,7 @@ coverage-additional docs-deps This option allows to add additional install dependencies for ``[testenv:docs]`` in ``tox.ini``. This option has to be a list of strings - and is empty by default. Caution: The values set for this option overwrite + and is empty by default. Caution: The values set for this option override the ones set in ``[testenv]``. use-flake8