From 45dc71f3c770c6b9525fb567a05805c183c36964 Mon Sep 17 00:00:00 2001 From: Michael Goerz Date: Thu, 27 May 2021 15:10:16 -0400 Subject: [PATCH 1/7] Update migration instructions --- HISTORY.rst | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index f61050e..276d8a2 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -27,12 +27,16 @@ Migration from ``doctr-versions-menu`` The ``doctr-versions-menu`` package was renamed to ``docs-versions-menu`` to reflect that Travis_ and thus Doctr_ is `no longer a viable option to deploy documentation `_. Switching from ``doctr-versions-menu`` to ``docs-versions-menu`` requires the following steps: * Consider switching from Travis_ to `Github Actions`_ -* Replace the ``doctr-versions-menu`` package with ``docs-versions-menu`` in the project requirements and the environment files for continous integration. -* Replace calls to ``doctr-versions-menu`` with calls to ``docs-versions-menu`` +* Update your Sphinx configuration (``conf.py``): + * Rename the ``doctr_versions_menu_conf`` dictionary of settings to ``docs_versions_menu_conf``. + * Change the name of the ``doctr_versions_menu`` extension in the ``extensions`` list to ``docs_versions_menu``. + * If using a custom ``doctr-versions-menu.js_t`` template, rename the file to ``docs-versions-menu.js_t`` +* Update your continuous-integration setup: + * Replace the ``doctr-versions-menu`` package with ``docs-versions-menu`` in the project requirements (``setup.py``/``setup.cfg``) + * Replace the installation of the ``doctr-versions-menu`` package with ``docs-versions-menu`` in your CI script or environment files + * Replace calls to the ``doctr-versions-menu`` executable with calls to ``docs-versions-menu`` + * If using environment variables for configuration, change the ``DOCTR_VERSIONS_MENU`` prefix to ``DOCS_VERSIONS_MENU`` * For any project using a ``doctr-versions-menu.conf`` file in the ``gh-pages`` root, set up equivalent ``DOCS_VERSIONS_MENU_*`` environment variables -* For any project using environment variables to configure the ``doctr-versions-menu`` utility, change the ``DOCTR_VERSIONS_MENU`` prefix to ``DOCS_VERSIONS_MENU`` -* For any project using a custom ``doctr-versions-menu.js_t`` template, rename the file to ``docs-versions-menu.js_t`` -* Rename ``doctr_versions_menu_conf`` in your Sphinx ``conf.py`` file to ``docs_versions_menu_conf``. To ease migration, the new ``docs-versions-menu`` will still process ``doctr_versions_menu_conf``, ``DOCTR_VERSIONS_MENU`` environment variables, and a ``doctr-versions-menu.js_t`` template, while emitting a warning. This limited backwards-compatibility may be removed in later versions. From e3dd06a21d5809bb30af8d129fe6010987ef25c8 Mon Sep 17 00:00:00 2001 From: Michael Goerz Date: Fri, 28 May 2021 00:32:47 -0400 Subject: [PATCH 2/7] Fix docstring in test Make the latest version of Black happy --- tests/test_cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_cli.py b/tests/test_cli.py index b175e53..a3e28f4 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -437,7 +437,7 @@ def test_custom_suffix(caplog): def test_custom_envvars(caplog): - """Test using environment variables for configuration. """ + """Test using environment variables for configuration.""" root = Path(__file__).with_suffix('') / 'gh_pages_envvars' # DOCS_VERSIONS_MENU and DOCTR_VERSIONS_MENU can be mixed env = { From 3df7e4ca04d783dbdf387ed40ed015d0b88b18fa Mon Sep 17 00:00:00 2001 From: Michael Goerz Date: Wed, 16 Nov 2022 22:06:09 -0500 Subject: [PATCH 3/7] Adapt to Click 8.1 Work around changes in https://github.com/pallets/click/issues/2146, https://github.com/pallets/click/pull/2223 --- src/docs_versions_menu/cli.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/docs_versions_menu/cli.py b/src/docs_versions_menu/cli.py index 5fe25c5..d2bcb9d 100644 --- a/src/docs_versions_menu/cli.py +++ b/src/docs_versions_menu/cli.py @@ -315,11 +315,23 @@ def main( logger = logging.getLogger(__name__) if debug: logger.setLevel(logging.DEBUG) + if downloads_file == "_downloads": + # Work around changes in click 8.1, see + # https://github.com/pallets/click/issues/2146 + # For backward compatibility, we want a defined but empty environment + # variable to disable the downloads file, not set it to the default. + if "DOCS_VERSIONS_MENU_DOWNLOADS_FILE" in os.environ: + if os.environ["DOCS_VERSIONS_MENU_DOWNLOADS_FILE"] == "": + downloads_file = None + elif "DOCTR_VERSIONS_MENU_DOWNLOADS_FILE" in os.environ: + if os.environ["DOCTR_VERSIONS_MENU_DOWNLOADS_FILE"] == "": + downloads_file = None if no_downloads_file: downloads_file = None logger.debug("Start of docs-versions-menu") logger.debug("arguments = %s", pprint.pformat(locals())) logger.debug("cwd: %s", Path.cwd()) + logger.debug("ENV: %s", os.environ) logger.debug("Gather versions info") if Path('doctr-versions-menu.conf').is_file(): click.echo( From c7c8911c75598d03f665adfad04ff8a5b351e404 Mon Sep 17 00:00:00 2001 From: Michael Goerz Date: Wed, 16 Nov 2022 22:23:51 -0500 Subject: [PATCH 4/7] Drop support for Python 3.6, extend to Python 3.11 --- .github/workflows/docs.yml | 2 +- .github/workflows/pypi.yml | 6 +++--- .github/workflows/test.yml | 22 +++++++++++----------- Makefile | 19 +++++++++++-------- docs/conf.py | 6 +++--- setup.py | 5 +++-- tox.ini | 20 +++++++++++--------- 7 files changed, 43 insertions(+), 37 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 8600401..7c4fba0 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -6,7 +6,7 @@ jobs: build_docs: name: Build and Deploy Documentation - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 container: # We run this workflow in a docker container that has a full LaTeX # environment installed, so that we can build the PDF version of the diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 096d2fe..e65fde9 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -20,15 +20,15 @@ jobs: pypi_release: name: PyPI - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 - name: Install Python 3.8 + name: Install Python 3.10 with: - python-version: 3.8 + python-version: "3.10" - name: Install Prerequisites run: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f0aa5e9..7ab3f9f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,26 +14,26 @@ jobs: matrix: include: - title: Codestyle and Main Tests - os: ubuntu-18.04 - python: 3.8 + os: ubuntu-20.04 + python: "3.10" commands: | $tox -e run-blackcheck,run-isortcheck - $tox -e py38-test + $tox -e py310-test coverage: true - title: Oldest supported Python - os: ubuntu-18.04 - python: 3.6 - commands: $tox -e py36-test + os: ubuntu-20.04 + python: "3.7" + commands: $tox -e py37-test coverage: true - title: Windows os: windows-latest - python: 3.8 - commands: tox -e py38-test + python: "3.9" + commands: tox -e py39-test coverage: false - title: MacOS os: macos-latest - python: 3.9 - commands: $tox -e py39-test + python: "3.11" + commands: $tox -e py311-test coverage: true steps: @@ -58,7 +58,7 @@ jobs: if: matrix.coverage == true shell: bash run: | - runenv=$(echo "${{ matrix.python }}" | sed 's/\([2-3]\)\.\([0-9]\)/py\1\2-runcmd/') + runenv=$(echo "${{ matrix.python }}" | sed 's/\([2-3]\)\.\([0-9]*\)/py\1\2-runcmd/') $tox -e $runenv -- python -m coverage xml - uses: codecov/codecov-action@v1 diff --git a/Makefile b/Makefile index 1d57f56..0104b2b 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: help clean clean-build clean-pyc clean-test clean-venv flake8-check pylint-check test test35 test36 test37 test38 docs docs-pdf clean-docs black-check black isort-check isort coverage test-upload upload release release-help dist dist-check +.PHONY: help clean clean-build clean-pyc clean-test clean-venv flake8-check pylint-check test test37 test38 test39 test310 test311 docs docs-pdf clean-docs black-check black isort-check isort coverage test-upload upload release release-help dist dist-check .DEFAULT_GOAL := help @@ -50,10 +50,7 @@ pylint-check: bootstrap ## check style with pylint test: bootstrap ## run tests for all supported Python versions - $(TOX) -e py36-test,py37-test,py38-test,py39-test -- $(TESTS) - -test36: bootstrap ## run tests for Python 3.6 - $(TOX) -e py36-test -- $(TESTS) + $(TOX) -e py37-test,py38-test,py39-test,py310-test,py311-test -- $(TESTS) test37: bootstrap ## run tests for Python 3.7 $(TOX) -e py37-test -- $(TESTS) @@ -64,6 +61,12 @@ test38: bootstrap ## run tests for Python 3.8 test39: bootstrap ## run tests for Python 3.9 $(TOX) -e py39-test -- $(TESTS) +test310: bootstrap ## run tests for Python 3.10 + $(TOX) -e py310-test -- $(TESTS) + +test311: bootstrap ## run tests for Python 3.11 + $(TOX) -e py311-test -- $(TESTS) + docs: bootstrap ## generate Sphinx HTML documentation, including API docs $(TOX) -e docs @echo "open docs/_build/html/index.html" @@ -84,7 +87,7 @@ isort-check: bootstrap ## Check all src and test files for correctly sorted impo isort: bootstrap ## Sort imports in all src and test files $(TOX) -e run-isort -coverage: test38 ## generate coverage report in ./htmlcov +coverage: test310 ## generate coverage report in ./htmlcov $(TOX) -e coverage @echo "open htmlcov/index.html" @@ -97,12 +100,12 @@ upload: bootstrap clean-build dist ## package and upload a release to pypi.org $(TOX) -e run-cmd -- twine upload dist/* release: clean bootstrap ## Create a new version, package and upload it - python3.8 -m venv .venv/release + python3.10 -m venv .venv/release .venv/release/bin/python -m pip install click .venv/release/bin/python ./scripts/release.py $(ARGS) release-help: bootstrap ## Show help on the release script - python3.8 -m venv .venv/release + python3.10 -m venv .venv/release .venv/release/bin/python -m pip install click .venv/release/bin/python ./scripts/release.py --help diff --git a/docs/conf.py b/docs/conf.py index 8311bdb..d811266 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- import datetime -from pathlib import Path import os import sys +from pathlib import Path import git @@ -40,8 +40,8 @@ spelling_ignore_pypi_package_names = True intersphinx_mapping = { - 'python': ('https://docs.python.org/3.8', None), - 'sphinx': ('https://www.sphinx-doc.org/en/3.x/', None), + 'python': ('https://docs.python.org/3.10', None), + 'sphinx': ('https://www.sphinx-doc.org/en/master/', None), } # Add any paths that contain templates here, relative to this directory. diff --git a/setup.py b/setup.py index 11e724b..68c90cb 100644 --- a/setup.py +++ b/setup.py @@ -80,13 +80,14 @@ def get_version(filename): 'Topic :: Utilities', 'Programming Language :: JavaScript', 'Programming Language :: Python :: 3 :: Only', - 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', ], description="A versions menu for Sphinx-based documentation", - python_requires='>=3.6', + python_requires='>=3.7', install_requires=requirements, extras_require={'dev': dev_requirements}, license="MIT license", diff --git a/tox.ini b/tox.ini index d6f3562..4f00e67 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] minversion = 3.14 -envlist = py36-{test,runcmd}, py37-{test,runcmd}, py38-{test,runcmd}, py39-{test,runcmd}, run-{cmd,blackcheck,black,isort,isortcheck}, docs, coverage +envlist = py37-{test,runcmd}, py38-{test,runcmd}, py39-{test,runcmd}, py310-{test,runcmd}, py311-{test,runcmd}, run-{cmd,blackcheck,black,isort,isortcheck}, docs, coverage [testenv:.tox] envdir = {toxworkdir}/.tox @@ -8,15 +8,17 @@ envdir = {toxworkdir}/.tox [testenv] basepython = + py311: python3.11 + py310,run,docs,coverage,clean,bootstrap: python3.10 py39: python3.9 - py38,run,docs,coverage,clean,bootstrap: python3.8 + py38: python3.8 py37: python3.7 - py36: python3.6 envdir = + py311: {toxworkdir}/py311 + py310,run,docs,coverage: {toxworkdir}/py310 py39: {toxworkdir}/py39 - py38,run,docs,coverage: {toxworkdir}/py38 + py38: {toxworkdir}/py38 py37: {toxworkdir}/py37 - py36: {toxworkdir}/py36 deps = usedevelop = true extras= @@ -25,13 +27,13 @@ setenv = PY_IGNORE_IMPORTMISMATCH = 1 passenv = HOME CI TRAVIS TRAVIS_* GITHUB_* COVERALLS* CODECOV* SPELLCHECK SSH_AUTH_SOCK http_proxy https_proxy no_proxy description = - py{36,37,38,39}-test: Run tests in the corresponding environment - py{36,37,38,39}-runcmd: Run arbitrary command following "--" in the corresponding environment + py{37,38,39,310,311}-test: Run tests in the corresponding environment + py{37,38,39,310,311}-runcmd: Run arbitrary command following "--" in the corresponding environment commands_pre = python -V commands = - py{36,37,38,39}-runcmd: {posargs:python -c 'print("No command")'} - py{36,37,38,39}-test: py.test -vvv --doctest-modules --cov=docs_versions_menu --durations=10 -x -s {posargs:src tests README.rst} + py{37,38,39,310,311}-runcmd: {posargs:python -c 'print("No command")'} + py{37,38,39,310,311}-test: py.test -vvv --doctest-modules --cov=docs_versions_menu --durations=10 -x -s {posargs:src tests README.rst} [testenv:docs] From f4dcf2b52a23b1d18d365ffe43020ad4e8f5f60f Mon Sep 17 00:00:00 2001 From: Michael Goerz Date: Wed, 16 Nov 2022 23:10:28 -0500 Subject: [PATCH 5/7] Adapt to latest Sphinx --- docs/conf.py | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index d811266..394f819 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -95,20 +95,6 @@ napoleon_use_param = True napoleon_use_rtype = True -# -- Monkeypatch for instance attribs (sphinx bug #2044) ----------------------- - -from sphinx.ext.autodoc import ( - ClassLevelDocumenter, - InstanceAttributeDocumenter, -) - - -def iad_add_directive_header(self, sig): - ClassLevelDocumenter.add_directive_header(self, sig) - - -InstanceAttributeDocumenter.add_directive_header = iad_add_directive_header - # -- Options for HTML output --------------------------------------------------- html_theme = "alabaster" From 184353cde002469016b7af333d829a1738436594 Mon Sep 17 00:00:00 2001 From: Michael Goerz Date: Thu, 17 Nov 2022 07:07:19 -0500 Subject: [PATCH 6/7] Release 0.5.0 --- HISTORY.rst | 18 ++++++------------ src/docs_versions_menu/__init__.py | 2 +- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 276d8a2..59330b5 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -2,25 +2,19 @@ History ======= -0.5.0-rc2 (2021-04-04) ----------------------- - -* Improvements to the workflow and documentation. -* Update of conda-feedstock_ - -Use this release to test migration from ``doctr-versions-menu`` to ``docs-versions-menu``. - - -0.5.0-rc1 (2021-03-25) +0.5.0 (2022-11-17) ---------------------- * Renamed project to ``docs-versions-menu`` (`#13`_) * Changed: Removed support for a config file (`#9`_) -* Dropped support for Python 3.5 - +* Dropped support for Python 3.5 and Python 3.6 +* Added support for Python 3.10 and 3.11 +* Improvements to the workflow and documentation. +* Update of conda-feedstock_ .. _migration: + Migration from ``doctr-versions-menu`` -------------------------------------- diff --git a/src/docs_versions_menu/__init__.py b/src/docs_versions_menu/__init__.py index 85c9cb1..ab035be 100644 --- a/src/docs_versions_menu/__init__.py +++ b/src/docs_versions_menu/__init__.py @@ -4,7 +4,7 @@ extension and a command line program. """ -__version__ = '0.5.0-dev' +__version__ = '0.5.0' # All members whose name does not start with an underscore must be listed # either in __all__ or in __private__ From 2ead9164065629b58fb19df885d91b971702d91a Mon Sep 17 00:00:00 2001 From: Michael Goerz Date: Thu, 17 Nov 2022 07:15:07 -0500 Subject: [PATCH 7/7] Bump version to 0.5.0+dev --- src/docs_versions_menu/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/docs_versions_menu/__init__.py b/src/docs_versions_menu/__init__.py index ab035be..c765a2b 100644 --- a/src/docs_versions_menu/__init__.py +++ b/src/docs_versions_menu/__init__.py @@ -4,7 +4,7 @@ extension and a command line program. """ -__version__ = '0.5.0' +__version__ = '0.5.0+dev' # All members whose name does not start with an underscore must be listed # either in __all__ or in __private__