Skip to content

Commit

Permalink
Add auto-generated API documention (pypa#810)
Browse files Browse the repository at this point in the history
* Add API docs

Via `sphinx-apidoc -T -M -e -o docs/api twine`

* Update autodoc configuration

* Silence Sphinx build errors

* Move apidoc to internal directory

* Add warning re: public API

* Flatten toctree
  • Loading branch information
bhrutledge authored Sep 20, 2021
1 parent 3be41f6 commit 28d8571
Show file tree
Hide file tree
Showing 20 changed files with 116 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8
# Mininum supported Python version
python-version: 3.6
- name: Install dependencies
run: python -m pip install tox
- name: Build docs
Expand Down
3 changes: 2 additions & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ formats:
- epub

python:
version: 3.8
# Mininum supported Python version
version: "3.6"
install:
- requirements: docs/requirements.txt
- method: pip
Expand Down
21 changes: 21 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,31 @@
"https://github.com/pypa/twine/issues/*",
# Avoid errors from channels interpreted as anchors
"https://web.libera.chat/#",
# Avoid error from InvalidPyPIUploadURL docstring
"https://upload.pypi.org/legacy",
]

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {"https://docs.python.org/": None}

# Be strict about the invalid references:
nitpicky = True

# TODO: Try to add these to intersphinx_mapping
nitpick_ignore_regex = [
(r"py:.*", r"(pkginfo|requests|IO).*"),
]

# -- Options for apidoc output ------------------------------------------------

autodoc_default_options = {
"members": True,
"private-members": True,
"undoc-members": True,
"member-order": "bysource",
}

autodoc_class_signature = "separated"
autodoc_preserve_defaults = True
# autodoc_typehints = "both"
# autodoc_typehints_description_target = "documented"
7 changes: 7 additions & 0 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,13 @@ specify either as a default, in the :file:`.pypirc` file, or pass on
the command line), and the methods that upload the package securely to
a URL.

For more details, refer to the source documentation (currently a
`work in progress <https://github.com/pypa/twine/issues/635>`_):

.. toctree::

internal/twine

Where Twine gets configuration and credentials
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
4 changes: 4 additions & 0 deletions docs/internal/twine.auth.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
twine.auth module
=================

.. automodule:: twine.auth
4 changes: 4 additions & 0 deletions docs/internal/twine.cli.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
twine.cli module
================

.. automodule:: twine.cli
4 changes: 4 additions & 0 deletions docs/internal/twine.commands.check.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
twine.commands.check module
===========================

.. automodule:: twine.commands.check
4 changes: 4 additions & 0 deletions docs/internal/twine.commands.register.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
twine.commands.register module
==============================

.. automodule:: twine.commands.register
11 changes: 11 additions & 0 deletions docs/internal/twine.commands.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
twine.commands package
======================

.. automodule:: twine.commands

.. toctree::
:maxdepth: 4

twine.commands.check
twine.commands.register
twine.commands.upload
4 changes: 4 additions & 0 deletions docs/internal/twine.commands.upload.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
twine.commands.upload module
============================

.. automodule:: twine.commands.upload
4 changes: 4 additions & 0 deletions docs/internal/twine.exceptions.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
twine.exceptions module
=======================

.. automodule:: twine.exceptions
4 changes: 4 additions & 0 deletions docs/internal/twine.package.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
twine.package module
====================

.. automodule:: twine.package
4 changes: 4 additions & 0 deletions docs/internal/twine.repository.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
twine.repository module
=======================

.. automodule:: twine.repository
18 changes: 18 additions & 0 deletions docs/internal/twine.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
twine package
=============

.. automodule:: twine

.. toctree::
:maxdepth: 4

twine.commands
twine.auth
twine.cli
twine.exceptions
twine.package
twine.repository
twine.settings
twine.utils
twine.wheel
twine.wininst
4 changes: 4 additions & 0 deletions docs/internal/twine.settings.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
twine.settings module
=====================

.. automodule:: twine.settings
4 changes: 4 additions & 0 deletions docs/internal/twine.utils.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
twine.utils module
==================

.. automodule:: twine.utils
4 changes: 4 additions & 0 deletions docs/internal/twine.wheel.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
twine.wheel module
==================

.. automodule:: twine.wheel
4 changes: 4 additions & 0 deletions docs/internal/twine.wininst.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
twine.wininst module
====================

.. automodule:: twine.wininst
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ deps =
-rdocs/requirements.txt
sphinx-autobuild
commands =
sphinx-autobuild -W -b html -d {envtmpdir}/doctrees \
sphinx-autobuild -b html -d {envtmpdir}/doctrees \
--watch twine \
{posargs:--host 127.0.0.1} \
docs docs/_build/html

Expand Down
5 changes: 5 additions & 0 deletions twine/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
"""Top-level module for Twine.
The contents of this package are not a public API. For more details, see
https://github.com/pypa/twine/issues/194 and https://github.com/pypa/twine/issues/665.
"""
# Copyright 2018 Donald Stufft and individual contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down

0 comments on commit 28d8571

Please sign in to comment.