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

Add Sphinx 4.0 compatibility, drop EOLed Pythons #17

Merged
merged 24 commits into from
May 25, 2022
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
69cdfaf
Drop EOLed Pythons, add supported Pythons
stevepiercy May 11, 2021
ed4e178
DRY when setting README and CHANGES
stevepiercy May 11, 2021
7f5ad44
Add python_requires
stevepiercy May 16, 2021
bcd3931
Blackify
stevepiercy May 16, 2021
544b388
Add GitHub Actions
stevepiercy May 16, 2021
4413ab9
Remove optional author_email because it lacks an MX record and is pro…
stevepiercy May 16, 2021
3213650
Remove deprecated sphinx.util.force_decode
stevepiercy May 16, 2021
4e04ccc
Add change log entries
stevepiercy May 16, 2021
ca824fd
Replace six.StringIO with io.StringIO
stevepiercy May 16, 2021
1765c02
Temporarily add for CI on stevepiercy's fork on the branch sphinx-40-…
stevepiercy May 16, 2021
6b58256
Update badge for CI
stevepiercy May 16, 2021
f4a0b20
Update installation method
stevepiercy May 16, 2021
54e9b80
Add lint to tox
stevepiercy May 16, 2021
6f0f5b7
Fix warning about long_description_content_type
stevepiercy May 16, 2021
40eef0d
Break apart tox env lint into format and build, temporarily commentin…
stevepiercy May 16, 2021
1663057
Replace `setuptools` with `build` package
stevepiercy May 17, 2021
0ad316e
Fix compatibility with Sphinx 4 and 5b1.
May 17, 2022
8590958
Use an existing PyPy3 version.
May 18, 2022
ae7ce32
Merge pull request #1 from icemac/sphinx-40-compat
stevepiercy May 18, 2022
b02bd50
Attempt to jigger a test build.
stevepiercy May 18, 2022
9915e71
Restore Python 3.5 and add Python 3.10
stevepiercy May 18, 2022
23a32ab
Restore Python 3.5 and add Python 3.10
stevepiercy May 18, 2022
d9177c4
Revert restoration of Python 3.5
stevepiercy May 18, 2022
8e0176c
Change release number to 1.0.0
stevepiercy May 21, 2022
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
67 changes: 67 additions & 0 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Build and test

on:
# Build on pushes to master
push:
branches:
- master
# Temporarily add for CI on stevepiercy's fork
- sphinx-40-compat
tags:
# Build pull requests
pull_request:

jobs:
test:
strategy:
matrix:
py:
- "3.6"
- "3.7"
- "3.8"
- "3.9"
- "pypy3"
os:
- "ubuntu-latest"
- "windows-latest"
- "macos-latest"
architecture:
- x64
- x86

exclude:
# Linux and macOS don't have x86 python
- os: "ubuntu-latest"
architecture: x86
- os: "macos-latest"
architecture: x86
# PyPy3 on Windows doesn't seem to work
- os: "windows-latest"
py: "pypy3"

name: "Python: ${{ matrix.py }}-${{ matrix.architecture }} on ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.py }}
architecture: ${{ matrix.architecture }}
- run: pip install tox
- name: Running tox
run: tox -e py -- ${{ matrix.pytest-args }}
# This block is temporarily commented out to speed up testing and until I add
# a lint tox env.
# lint:
# runs-on: ubuntu-latest
# name: Lint the package
# steps:
# - uses: actions/checkout@v2
# - name: Setup python
# uses: actions/setup-python@v2
# with:
# python-version: 3.9
# architecture: x64
# - run: pip install tox
# - run: tox -e lint
9 changes: 5 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
language: python
sudo: false
python:
- 2.7
- 3.4
- 3.5
- pypy
- 3.6
- 3.7
- 3.8
- 3.9
- pypy3
script:
- zope-testrunner --test-path=. --auto-color --auto-progress

Expand Down
9 changes: 9 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ repoze.sphinx.autointerface Changelog
0.8.1 (unreleased)
------------------

- Remove sphinx.util.force_decode. Previously we hacked it in to support Python
2 and Sphinx 3.x, but Sphinx 4.0 deprecated it and dropped Python 2 support.

- Replace Travis-CI with GitHub Actions

- Add support for Python 3.6, 3.7, 3.8, 3.9, and PyPy3.

- Drop support for Python 2.7, 3.3, 3.4, 3.5, and PyPy.

- Update to work with newer Sphinx versions:
* Sphinx.domains -> Sphinx.registry.domains
* Sphinx.override_domain(D) -> Sphinx.add_domain(D, override=True)
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,4 @@ Contributors

- Tres Seaver, 2011/03/22
- Jason Madden, 2013/01/10
- Steve Piercy, 2021/05/11
12 changes: 12 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
graft repoze

include README.rst
include CHANGES.rst
include CONTRIBUTORS.txt LICENSE.txt COPYRIGHT.txt

include tox.ini .travis.yml
include TODO.txt
graft .github

global-exclude __pycache__ *.py[cod]
global-exclude .DS_Store
48 changes: 26 additions & 22 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,64 +1,68 @@
repoze.sphinx.autointerface README
==================================

.. image:: https://travis-ci.org/repoze/repoze.sphinx.autointerface.png?branch=master
:target: https://travis-ci.org/repoze/repoze.sphinx.autointerface
.. image:: https://github.com/repoze/repoze.sphinx.autointerface/actions/workflows/ci-tests.yml/badge.svg
:target: https://github.com/repoze/repoze.sphinx.autointerface/actions/workflows/ci-tests.yml

.. image:: https://img.shields.io/pypi/v/repoze.sphinx.autointerface.svg
:target: https://pypi.python.org/pypi/repoze.sphinx.autointerface
:target: https://pypi.python.org/pypi/repoze.sphinx.autointerface

.. image:: https://img.shields.io/pypi/pyversions/repoze.sphinx.autointerface.svg
:target: https://pypi.python.org/pypi/repoze.sphinx.autointerface
:target: https://pypi.python.org/pypi/repoze.sphinx.autointerface


Overview
--------

Thie package defines an extension for the
`Sphinx <http://sphinx.pocool.org>`_ documentation system. The extension
allows generation of API documentation by introspection of
`zope.interface <http://pypi.python.org/pypi/zope.interface>`_ instances in
`Sphinx <https://www.sphinx-doc.org/en/master/>`_ documentation system.
The extension allows generation of API documentation by introspection of
`zope.interface <https://pypi.org/project/zope.interface/>`_ instances in
code.


Installation
------------

Install via `easy_install
<http://peak.telecommunity.com/DevCenter/EasyInstall>`_::
Install via ``pip``:

$ bin/easy_install repoze.sphinx.autointerface
.. code-block:: bash

or any other means which gets the package on your ``PYTHONPATH``.
pip install repoze.sphinx.autointerface


Registering the Extension
-------------------------

Add ``repoze.sphinx.autointerface`` to the ``extensions`` list in the
``conf.py`` of the Sphinx documentation for your product. E.g.::
``conf.py`` of the Sphinx documentation for your product.

.. code-block:: python

extensions = ['sphinx.ext.autodoc',
'sphinx.ext.doctest',
'repoze.sphinx.autointerface',
]
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.doctest",
"repoze.sphinx.autointerface",
]


Using the Extension
-------------------

At appropriate points in your document, call out the interface
autodocs via::
At appropriate points in your document, call out the autodoc interface.

.. code-block:: rst

.. autointerface:: yourpackage.interfaces.IFoo
.. autointerface:: yourpackage.interfaces.IFoo

Output from the directive includes

- the fully-qualified interface name
- any base interfaces
- the doctstring from the interface, rendered as reSTX.
- the members of the interface (methods and attributes).
- the docstring from the interface, rendered as reStructuredText
- the members of the interface (methods and attributes)

* For each attribute, the output includes the attribute name
and its description.
* For each method, the output includes the method name, its signature,
and its docstring (also rendered as reSTX).
and its docstring (also rendered as reStructuredText).
9 changes: 1 addition & 8 deletions repoze/sphinx/autointerface.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@
from zope.interface.interface import InterfaceClass


if sys.version_info < (3,):
from sphinx.util import force_decode
else:
def force_decode(s, encoding):
return s


class InterfaceDesc(PyClasslike):
def get_index_text(self, modname, name_cls):
return '%s (interface in %s)' % (name_cls[0], modname)
Expand Down Expand Up @@ -95,7 +88,7 @@ def keyfunc(entry):
self.add_line(u'', '<autointerface>')
self.indent += self.content_indent
sourcename = u'docstring of %s.%s' % (self.fullname, name)
docstrings = [prepare_docstring(force_decode(doc, None))]
docstrings = [prepare_docstring(doc, None)]
for i, line in enumerate(self.process_doc(docstrings)):
self.add_line(line, sourcename, i)
self.add_line(u'', '<autointerface>')
Expand Down
2 changes: 1 addition & 1 deletion repoze/sphinx/tests/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import tempfile
import shutil

from six import StringIO
from io import StringIO

from sphinx import application
from sphinx.builders.latex import LaTeXBuilder
Expand Down
84 changes: 44 additions & 40 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,56 +12,60 @@
#
##############################################################################

import os

from setuptools import setup, find_packages

here = os.path.abspath(os.path.dirname(__file__))

with open(os.path.join(here, 'README.rst')) as f:
README = f.read()
def readfile(name):
with open(name) as f:
return f.read()


with open(os.path.join(here, 'CHANGES.rst')) as f:
CHANGES = f.read()
README = readfile("README.rst")
CHANGES = readfile("CHANGES.rst")

tests_require = [
'zope.testrunner',
"zope.testrunner",
]

setup(name='repoze.sphinx.autointerface',
version='0.8.1.dev0',
description='Sphinx extension: auto-generates API docs '
'from Zope interfaces',
long_description=README + '\n\n' + CHANGES,
classifiers=[
setup(
name="repoze.sphinx.autointerface",
version="0.8.1.dev0",
stevepiercy marked this conversation as resolved.
Show resolved Hide resolved
description="Sphinx extension: auto-generates API docs " "from Zope interfaces",
long_description=README + "\n\n" + CHANGES,
long_description_content_type='text/x-rst',
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
],
keywords='web wsgi zope',
author="Agendaless Consulting",
author_email="repoze-dev@lists.repoze.org",
url="http://www.repoze.org",
license="BSD-derived (http://www.repoze.org/LICENSE.txt)",
packages=find_packages(),
include_package_data=True,
namespace_packages=['repoze', 'repoze.sphinx'],
zip_safe=False,
tests_require = tests_require,
install_requires=[
'zope.interface',
'Sphinx>=1.0',
'setuptools',
],
extras_require = {
'test': tests_require,
},
#test_suite="repoze.",
)
],
keywords="web wsgi zope Sphinx",
author="Agendaless Consulting",
author_email="repoze-dev@lists.repoze.org",
url="https://github.com/repoze/repoze.sphinx.autointerface/",
project_urls={
"Documentation": "https://github.com/repoze/repoze.sphinx.autointerface/",
"Changelog": "https://github.com/repoze/repoze.sphinx.autointerface/blob/master/CHANGES.rst",
"Issue Tracker": "https://github.com/repoze/repoze.sphinx.autointerface/issues",
},
license="BSD-derived (Repoze)",
packages=find_packages(),
include_package_data=True,
namespace_packages=["repoze", "repoze.sphinx"],
zip_safe=False,
python_requires=">=3.6",
tests_require=tests_require,
install_requires=[
"zope.interface",
"Sphinx>=1.0",
"setuptools",
],
extras_require={
"test": tests_require,
},
)
30 changes: 29 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,37 @@
[tox]
envlist =
py27,py33,py34,,py35,pypy
py36,py37,py38,py39,pypy3

[testenv]
commands =
zope-testrunner --test-path={toxinidir}
deps =
zope.testrunner

;[testenv:format]
;skip_install = true
;commands =
; flake8 repoze tests setup.py
; isort --check-only --df repoze tests setup.py
; black --check --diff repoze tests setup.py
;deps =
; flake8
; black
; isort

[testenv:build]
skip_install = true
commands =
# clean up build/ and dist/ folders
python -c 'import shutil; shutil.rmtree("dist", ignore_errors=True)'
python setup.py clean --all

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer call setup.py directly, use the new build package instead (replaces the pep517.build)

This also does away with he sdist call/pip wheel call.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @bertjwregeer! Updated in 1663057. Please let me know.

# build sdist
python setup.py sdist --dist-dir {toxinidir}/dist
# check long_description via CHANGES and README
twine check dist/*
check-manifest
# build wheel from sdist
pip wheel -v --no-deps --no-index --no-build-isolation --wheel-dir {toxinidir}/dist --find-links {toxinidir}/dist repoze.sphinx.autointerface
deps =
check-manifest
twine