Skip to main content

Python-Deployment

Documentation Status

Examples of Python Deployment Workflows

Documentation with Sphinx and Read the Docs

Setting up Sphinx

In order to generate a documentation from the docstrings we are going to use Sphinx.

  1. Create a docs directory in your projects main directory.
mkdir docs
cd docs
  1. Use the quickstart script provided by Sphinx.
sphinx-quickstart

And use the following settings.

sphinx-quickstart

  1. Change source/conf.py. The first thing to do is to uncomment and change following lines at the top of the file.
import os
import sys
sys.path.insert(0, os.path.abspath('../../'))

A few extra extensions should also be added. The autosummary extension generates function/method/attribute summary lists from the docstrings, napoleon enables Sphinx to parse Numpy and Google style docstrings. Finally, the numpydoc extension loads several extensions for better support of Numpy.

extensions = ['sphinx.ext.autodoc',
    'sphinx.ext.intersphinx',
    'sphinx.ext.coverage',
    'sphinx.ext.imgmath',
    'sphinx.ext.ifconfig',
    'sphinx.ext.viewcode',
    'sphinx.ext.autosummery',
    'sphinx.ext.napoleon',
    'numpydoc']

And some more changes:

  • master_doc = 'contents' for a better overview page, which we will later add.
  • html_style = 'sphinx_rtd_theme' for a nicer theme.
  • For compatibility with Read the Docs:
html_theme_options = {
    #    'canonical_url': '',
    #    'analytics_id': '',
    'logo_only': False,
    'display_version': True,
    'prev_next_buttons_location': "top",
    #    'style_external_links': False,
    #    'vcs_pageview_mode': '',
    # Toc options
    'collapse_navigation': False,
    'sticky_navigation': True,
    'navigation_depth': 4,
    'includehidden': True,
    'titles_only': False,
}
  • Comment out # html_static_path = ['_static']
  • In case you use pictures hosted somewhere, add
suppress_warnings = [
    "image.nonlocal_uri",
    #    'app.add_directive',  # this evtl. suppresses the numpydoc induced warning
]
  • And finally add some intersphinx mappings for links:
intersphinx_mapping = {
    "Python 3.7": ("https://docs.python.org/3.6", None),
    "Python": ("https://docs.python.org/", None),
    "NumPy": ("http://docs.scipy.org/doc/numpy/", None),
    "SciPy": ("http://docs.scipy.org/doc/scipy/reference", None),
    "matplotlib": ("http://matplotlib.org", None),
}

Now you are ready to create your docs. Have a look at the docs/source/ folder for an example and how to use autosummary in the source files.

Publishing on Read the Docs

  1. In the docs/ folder create a file requirements.txt with a content like
numpy>=1.14.5
numpydoc
  1. Log in or sign up on Read the Docs
  2. Click on Import a Project and select your repository on GitHub and activate advanced options.
  3. Select Python as the programming language.
  4. Add docs/requirements.txt path to the Requirements file field.
  5. Tick Use system packages.

Now, your documentation should be ready and hosted on Read the Docs. With every push to your repo, the documentation will automatically be built by Read the Docs.

In case you want to add a readthedocs badge, have a look at the first line after the heading of the README.md of this project.

Metadata

Release files for python-deployment 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-deployment 0.0.1
File Size Uploaded
python-deployment-0.0.1.tar.gz 118.9 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for python-deployment 0.0.1
File
python_deployment-0.0.1-cp36-cp36m-manylinux1_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 Details
python_deployment-0.0.1-cp36-cp36m-manylinux1_i686.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-32 Details
python_deployment-0.0.1-cp27-cp27mu-manylinux1_x86_64.whl CPython 2.7 CPython 2.7 pymalloc wide-unicode Linux glibc 2.5+ x86-64 Details
python_deployment-0.0.1-cp27-cp27mu-manylinux1_i686.whl CPython 2.7 CPython 2.7 pymalloc wide-unicode Linux glibc 2.5+ x86-32 Details
python_deployment-0.0.1-cp27-cp27m-manylinux1_x86_64.whl CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.5+ x86-64 Details
python_deployment-0.0.1-cp27-cp27m-manylinux1_i686.whl CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.5+ x86-32 Details

Total release size: 2.4 MB

Release files / python-deployment-0.0.1.tar.gz

Download URL python-deployment-0.0.1.tar.gz
Size 118.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e696ef79a10675bd2be823650e7c48b1031fbc42685061806fdad751dcc5e45f
BLAKE2b-256 checksum
How to use checksums
fa795c17dab5671d0a7bd4e389b5927080437eca089f693ee3612e1feecf54e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

Release files / python_deployment-0.0.1-cp36-cp36m-manylinux1_x86_64.whl

Download URL python_deployment-0.0.1-cp36-cp36m-manylinux1_x86_64.whl
Size 397.9 kB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
0430d690528eb474359fba19a52f2c4b5c6ff3a529bb836b79fb28ce21928d47
BLAKE2b-256 checksum
How to use checksums
244492b412fd34beea3a363a9fad525d298dd4a1211397d07ecf2d75a9fe5ea1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

Release files / python_deployment-0.0.1-cp36-cp36m-manylinux1_i686.whl

Download URL python_deployment-0.0.1-cp36-cp36m-manylinux1_i686.whl
Size 377.8 kB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-32
SHA-256 checksum
How to use checksums
6dfdfe9979689c731795e160823c115cfae3582f5813646d892569dc98d0a839
BLAKE2b-256 checksum
How to use checksums
1b08f9812e71eac228c6fe5f2afef8f1e071351811805476d8935d4dadfc0e4b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

Release files / python_deployment-0.0.1-cp27-cp27mu-manylinux1_x86_64.whl

Download URL python_deployment-0.0.1-cp27-cp27mu-manylinux1_x86_64.whl
Size 395.9 kB
Tags CPython 2.7 CPython 2.7 pymalloc wide-unicode Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
3d45085a47e2b0adf7368c051a048b376aa9a91e5a2b14250888ffe83413cfc1
BLAKE2b-256 checksum
How to use checksums
f22d3e77b09a077e7d0d5e2e215a55416ebb5362f25510ab3e6300c1bb32ec1b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.16

Release files / python_deployment-0.0.1-cp27-cp27mu-manylinux1_i686.whl

Download URL python_deployment-0.0.1-cp27-cp27mu-manylinux1_i686.whl
Size 378.4 kB
Tags CPython 2.7 CPython 2.7 pymalloc wide-unicode Linux glibc 2.5+ x86-32
SHA-256 checksum
How to use checksums
016f3aeec0b337ea1da150ef8d61eb56974fdad2a26e9f53abb741e7c719e6c3
BLAKE2b-256 checksum
How to use checksums
9127deff1e05a8cf2dc41c7eaf7b394b3b7a42b4f75a0e1904a4b091a7c3ec05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.16

Release files / python_deployment-0.0.1-cp27-cp27m-manylinux1_x86_64.whl

Download URL python_deployment-0.0.1-cp27-cp27m-manylinux1_x86_64.whl
Size 396.0 kB
Tags CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
4272985f7682022707c48308a3e42fd8fd84876484e29ee66b24a72b6044bed2
BLAKE2b-256 checksum
How to use checksums
abeaf824e8c77da70e0d0d9af3e268045756c9351e4fa788bf51871270443ca1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.16

Release files / python_deployment-0.0.1-cp27-cp27m-manylinux1_i686.whl

Download URL python_deployment-0.0.1-cp27-cp27m-manylinux1_i686.whl
Size 378.4 kB
Tags CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.5+ x86-32
SHA-256 checksum
How to use checksums
95f41f6550ec4f9f8b10d3cdd69e279bf0fbad52e3bdb572b46240e4d4c5fac9
BLAKE2b-256 checksum
How to use checksums
aa59d51c680c5ca2b8f66ad28ee2476dc8918b0a7df804b67eb4a4231ad1d141
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.16

Release history Release notifications | RSS feed

This release

0.0.1 This release

7 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page