Skip to main content

Internal utilities for projects following git-pull python package spec

Project description

gp-libs · Python Package License Code Coverage

Incubating / dogfooding some sphinx extensions and pytest plugins on git-pull projects, e.g. cihai, vcs-python, or tmux-python.

doctest helpers (for docutils)

Two parts:

  1. doctest module: Same specification as doctest, but can parse reStructuredText and markdown
  2. pytest plugin: Collects pytest for reStructuredText and markdown files

doctest module

This extends standard library doctest to support anything docutils can parse. It can parse reStructuredText (.rst) and markdown (.md).

See more: https://gp-libs.git-pull.com/doctest/

Writing doctests

It supports two barebones directives:

  • docutils' doctest_block

    >>> 2 + 2
    4
    
  • .. doctest:: directive

    reStructuredText:

    .. doctest::
    
       >>> 2 + 2
       4
    

    Markdown (requires myst-parser):

    ```{doctest}
    >>> 2 + 2
    4
    ```
    

Test your docs

reStructuredText
$ python -m doctest_docutils README.rst -v

That's what doctest does by design.

Markdown

If you install myst-parser, doctest will run on .md files.

$ python -m doctest_docutils README.md -v

pytest plugin

This plugin integrates with the above module.

$ pytest docs/

Like the above module, it supports docutils' own doctest_block and a basic .. doctest:: directive.

See more: https://gp-libs.git-pull.com/doctest/pytest.html

sphinx plugins

Plain-text issue linker (linkify-issues)

We need to parse plain text, e.g. #99999, to point to the project tracker at https://github.com/git-pull/gp-libs/issues/99999. This way the markdown looks good anywhere you render it, including GitHub and GitLab.

Configuration

In your conf.py:

  1. Add 'linkify_issues' to extensions

    extensions = [
        # ...
        "linkify_issues",
    ]
    
  2. Configure your issue URL, issue_url_tpl:

    # linkify_issues
    issue_url_tpl = 'https://github.com/git-pull/gp-libs/issues/{issue_id}'
    

    The config variable is formatted via {meth}str.format where issue_id is 42 if the text is #42.

See more: https://gp-libs.git-pull.com/linkify_issues/

Table of contents for autodoc

sphinx.ext.autodoc doesn't link objects in the table of contents. So we need a plugin to help.

See more: https://gp-libs.git-pull.com/sphinx_toctree_autodoc_fix/

Configuration

  1. Add 'sphinx_toctree_autodoc_fix' to extensions

    extensions = [
        # ...
        "sphinx_toctree_autodoc_fix",
    ]
    

Install

$ pip install --user gp-libs

Developmental releases

You can test the unpublished version of g before its released.

  • pip:

    $ pip install --user --upgrade --pre gp-libs
    

More information

Docs Build Status

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gp-libs-0.0.1a6.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

gp_libs-0.0.1a6-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file gp-libs-0.0.1a6.tar.gz.

File metadata

  • Download URL: gp-libs-0.0.1a6.tar.gz
  • Upload date:
  • Size: 17.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for gp-libs-0.0.1a6.tar.gz
Algorithm Hash digest
SHA256 f3251c4c9d7c65282dfc79b0129b3a93ccf00610c13fb79c33da6a8798da0b81
MD5 42fc3ad67dbe8386ccb8dd06c4882b16
BLAKE2b-256 0021fb0011103fe04e6d8a54262031b493d4765d1af2c7277a9f64d863d41209

See more details on using hashes here.

File details

Details for the file gp_libs-0.0.1a6-py3-none-any.whl.

File metadata

  • Download URL: gp_libs-0.0.1a6-py3-none-any.whl
  • Upload date:
  • Size: 15.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for gp_libs-0.0.1a6-py3-none-any.whl
Algorithm Hash digest
SHA256 9dfa4acb72271af5e2c07df87dee4bf947ed6a8a1582eadf488cde1db14e7f27
MD5 d0e4c3cb0ff60996dc13b9fb5a3ed774
BLAKE2b-256 f0e35ba0d87e287625f1aa46acb66fc51202d2a57c1f25e0235dfc9ce91edd83

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page