Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MNT: Bump Python and Sphinx, use Actions, new matrix #139

Merged
merged 4 commits into from Dec 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 17 additions & 8 deletions .coveragerc
@@ -1,12 +1,21 @@
[run]
source = sphinx_automodapi
omit = */tests/*

[paths]
source =
sphinx_automodapi/
*/site-packages/sphinx_automodapi
*\site-packages\sphinx_automodapi
omit =
sphinx_automodapi/tests/*
*/sphinx_automodapi/tests/*

[report]
omit = */tests/*
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover
# Don't complain about packages we have installed
except ImportError
# Don't complain if tests don't hit assertions
raise AssertionError
raise NotImplementedError
# Don't complain about script hooks
def main\(.*\):
# Ignore branches that don't pertain to this version of Python
pragma: py{ignore_python_version}
# Don't complain about IPython completion helper
def _ipython_key_completions_
102 changes: 102 additions & 0 deletions .github/workflows/ci_workflows.yml
@@ -0,0 +1,102 @@
name: CI

on:
pull_request:
push:
branches: [ main ]
tags:
workflow_dispatch:
schedule:
# Monthly cron
- cron: '0 8 1 * *'

jobs:
tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
include:
- name: Code style checks
os: ubuntu-latest
python-version: 3.x
toxenv: codestyle

# Linux - test different Sphinx versions
- os: ubuntu-latest
python-version: 3.7
toxenv: py37-test-sphinx24
- os: ubuntu-latest
python-version: 3.8
toxenv: py38-test-sphinx35
- os: ubuntu-latest
python-version: 3.8
toxenv: py38-test-sphinx40
- os: ubuntu-latest
python-version: 3.9
toxenv: py39-test-sphinx41
- os: ubuntu-latest
python-version: 3.9
toxenv: py39-test-sphinx42
- os: ubuntu-latest
python-version: '3.10'
toxenv: py310-test-sphinx43-cov-clocale
- os: ubuntu-latest
python-version: '3.10'
toxenv: py310-test-sphinxdev

# MacOS X - just the oldest, stable, and dev
- os: macos-latest
python-version: 3.7
toxenv: py37-test-sphinx24
- os: macos-latest
python-version: 3.8
toxenv: py38-test-sphinx43-clocale
- os: macos-latest
python-version: 3.9
toxenv: py39-test-sphinxdev

# Windows - just the oldest, stable, and dev
- os: windows-latest
python-version: 3.7
toxenv: py37-test-sphinx24
- os: windows-latest
python-version: 3.8
toxenv: py38-test-sphinx43-clocale
- os: windows-latest
python-version: 3.9
toxenv: py39-test-sphinxdev

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install graphviz on Linux
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install graphviz
- name: Install graphviz on OSX
if: startsWith(matrix.os, 'macos')
run: |
brew update
brew install graphviz
- name: Install graphviz on Windows
if: startsWith(matrix.os, 'windows')
run: choco install graphviz
- name: Install tox
run: python -m pip install tox
- name: Install codecov
if: ${{ contains(matrix.toxenv,'-cov') }}
run: python -m pip install codecov
- name: Run tox
run: tox ${{ matrix.toxargs }} -v -e ${{ matrix.toxenv }}
- name: Upload coverage to codecov
if: ${{ contains(matrix.toxenv,'-cov') }}
uses: codecov/codecov-action@v2
with:
file: ./coverage.xml
12 changes: 8 additions & 4 deletions .github/workflows/publish.yml
Expand Up @@ -20,8 +20,11 @@ jobs:
with:
python-version: 3.8

- name: Install python-build and twine
run: python -m pip install pip build "twine>=3.3" -U
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install graphviz
python -m pip install pip build "twine>=3.3" -U

- name: Build package
run: python -m build --sdist --wheel .
Expand All @@ -36,8 +39,9 @@ jobs:
run: |
cd ..
python -m venv testenv
testenv/bin/pip install pytest sphinx_automodapi/dist/*.whl
testenv/bin/pytest sphinx_automodapi
testenv/bin/pip install pip -U
testenv/bin/pip install pytest cython sphinx-automodapi/dist/*.whl
testenv/bin/pytest sphinx-automodapi/sphinx_automodapi/tests

- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
Expand Down
3 changes: 2 additions & 1 deletion CHANGES.rst
Expand Up @@ -11,7 +11,8 @@ Changes in sphinx-automodapi
- Add ``:include:`` option to do the opposite of ``:skip:``. [#127]

- Various infrastructure/packaging updates and code clean-ups.
[#120, #124, #126, #133]
Minimum supported Python version is now 3.7 and Sphinx 2.
[#120, #124, #126, #133, #139]

0.13 (2020-09-24)
-----------------
Expand Down
8 changes: 4 additions & 4 deletions README.rst
@@ -1,4 +1,4 @@
|Azure Status| |Coverage Status| |PyPI|
|CI Status| |Coverage Status| |PyPI|

About
=====
Expand All @@ -20,12 +20,12 @@ or if you have `tox <https://tox.readthedocs.io/en/latest/>`_ installed::

tox -e test

.. |Azure Status| image:: https://dev.azure.com/astropy-project/sphinx-automodapi/_apis/build/status/astropy.sphinx-automodapi?branchName=main
:target: https://dev.azure.com/astropy-project/sphinx-automodapi/_build/latest?definitionId=2&branchName=main
.. |CI Status| image:: https://github.com/astropy/sphinx-automodapi/workflows/CI/badge.svg
:target: https://github.com/astropy/sphinx-automodapi/actions
.. |Coverage Status| image:: https://codecov.io/gh/astropy/sphinx-automodapi/branch/main/graph/badge.svg
:target: https://codecov.io/gh/astropy/sphinx-automodapi
.. |PyPI| image:: https://img.shields.io/pypi/v/sphinx-automodapi.svg
:target: https://pypi.python.org/pypi/sphinx-automodapi
:target: https://pypi.python.org/pypi/sphinx-automodapi

Development status
------------------
Expand Down
55 changes: 0 additions & 55 deletions azure-pipelines.yml

This file was deleted.

9 changes: 5 additions & 4 deletions setup.cfg
Expand Up @@ -18,17 +18,17 @@ classifiers =
[options]
zip_safe = False
packages = find:
python_requires = >=3.6
python_requires = >=3.7
install_requires =
sphinx>=1.7
sphinx>=2

[options.extras_require]
test =
pytest
pytest-cov
cython
codecov
coverage < 5.0
coverage

[options.package_data]
sphinx_automodapi = templates/*/*.rst
Expand All @@ -45,4 +45,5 @@ filterwarnings =
ignore:'environmentfilter' is renamed to 'pass_environment':DeprecationWarning

[flake8]
max-line-length = 100
max-line-length = 125
exclude = sphinx_automodapi/tests/test_autodoc_enhancements.py,sphinx_automodapi/tests/test_automodapi.py
2 changes: 1 addition & 1 deletion sphinx_automodapi/automodsumm.py
Expand Up @@ -260,7 +260,7 @@ def process_automodsumm_generation(app):
if lines: # empty list means no automodsumm entry is in the file
outfn = os.path.join(app.srcdir, sfn) + '.automodsumm'
with open(outfn, 'w') as f:
for l in lines:
for l in lines: # noqa: E741
f.write(l)
f.write('\n')

Expand Down
31 changes: 20 additions & 11 deletions tox.ini
@@ -1,29 +1,38 @@
[tox]
envlist = py{36,37,38}-test-sphinx{17,18,20,21,22,23,24,30,31,32,dev}{-clocale,}
envlist = py{37,38,39,310}-test-sphinx{24,35,40,41,42,43,dev}{,-cov}{-clocale,}
requires = pip >= 18.0
setuptools >= 30.3.0
isolated_build = true

[testenv]
changedir = .tmp/{envname}
deps =
sphinx17: sphinx==1.7.*
sphinx18: sphinx==1.8.*
sphinx20: sphinx==2.0.*
sphinx21: sphinx==2.1.*
sphinx22: sphinx==2.2.*
sphinx23: sphinx==2.3.*
sphinx24: sphinx==2.4.*
sphinx30: sphinx==3.0.*
sphinx31: sphinx==3.1.*
sphinx32: sphinx==3.2.*
sphinx35: sphinx==3.5.*
sphinx40: sphinx==4.0.*
sphinx41: sphinx==4.1.*
sphinx42: sphinx==4.2.*
sphinx43: sphinx==4.3.*
sphinxdev: git+https://github.com/sphinx-doc/sphinx.git
extras =
test: test
commands =
test: pytest --pyargs sphinx_automodapi
pip freeze
!cov: pytest --pyargs sphinx_automodapi
cov: pytest --pyargs sphinx_automodapi --cov sphinx_automodapi --cov-config={toxinidir}/setup.cfg {posargs}
cov: coverage xml -o {toxinidir}/coverage.xml
passenv = HOME WINDIR LC_ALL LC_CTYPE LANG CC CI
setenv =
cov: CFLAGS = --coverage -fno-inline-functions -O0
clocale: LC_CTYPE=C
clocale: LC_ALL=C
clocale: LANG=C
platform =
clocale: linux|darwin

[testenv:codestyle]
skip_install = true
changedir = {toxinidir}
description = Run all style and file checks with pre-commit
deps = flake8
commands = flake8 sphinx_automodapi --count