Skip to content

Commit

Permalink
Merge remote-tracking branch 'up/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
awoimbee committed Jan 25, 2023
2 parents e06dfe9 + 2ead916 commit 6dd1aff
Show file tree
Hide file tree
Showing 11 changed files with 72 additions and 70 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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
Expand Down
32 changes: 15 additions & 17 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,35 @@
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``
--------------------------------------

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 <TravisDemiseHN_>`_. 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.

Expand Down
19 changes: 11 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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)
Expand All @@ -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"
Expand All @@ -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"

Expand All @@ -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

Expand Down
20 changes: 3 additions & 17 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
import datetime
from pathlib import Path
import os
import sys
from pathlib import Path

import git

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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"
Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/docs_versions_menu/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
extension and a command line program.
"""

__version__ = '0.5.0-dev'
__version__ = '0.5.0+dev'

# All members whose name does not start with an underscore must be listed
# either in __all__ or in __private__
Expand Down
12 changes: 12 additions & 0 deletions src/docs_versions_menu/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
20 changes: 11 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
[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


[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=
Expand All @@ -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]
Expand Down

0 comments on commit 6dd1aff

Please sign in to comment.