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 for reStructured and markdown

Two components:

  1. doctest_docutils module: Same specification as doctest, but can parse reStructuredText and markdown

  2. pytest_doctest_docutils: Pytest plugin, collects test items for pytest for reStructuredText and markdown files

    This means you can do:

    $ pytest docs
    

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/

Supported styles

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
    ```
    

Usage

The doctest_docutils module preserves standard library's usage conventions:

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 disables pytest's standard doctest plugin.

This plugin integrates with the doctest_docutils module with pytest to enable seamless testing of docs, conftest.py fixtures and all.

$ 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/

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
    

Minimum requirements

To lift the development burden of supporting legacy APIs, as this package is lightly used, minimum constraints have been pinned:

  • docutils: 0.20.1+
  • myst-parser: 2.0.0+

If you have even passing interested in supporting legacy versions, file an issue on the tracker.

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.17.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gp_libs-0.0.17-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file gp_libs-0.0.17.tar.gz.

File metadata

  • Download URL: gp_libs-0.0.17.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gp_libs-0.0.17.tar.gz
Algorithm Hash digest
SHA256 e7f0fa2913f79d0403ae9c38468d02d28d8348edccba949de40dba8e72c419ce
MD5 24ff8c5d13955a1dc430b6815d01346a
BLAKE2b-256 613800b2d342ee47102225054c0a3e9507e99a988bd6a89da3948f21bad4ddb0

See more details on using hashes here.

Provenance

The following attestation bundles were made for gp_libs-0.0.17.tar.gz:

Publisher: tests.yml on git-pull/gp-libs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gp_libs-0.0.17-py3-none-any.whl.

File metadata

  • Download URL: gp_libs-0.0.17-py3-none-any.whl
  • Upload date:
  • Size: 16.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gp_libs-0.0.17-py3-none-any.whl
Algorithm Hash digest
SHA256 7ce96d5e09980c0dc82062ab3e3b911600bd44da97a64fb78379f1af9a79d4d3
MD5 f9672a5893c6d59f8e9b1af586082ca5
BLAKE2b-256 18f95d78d1dda9cb0f27d6f2305e95a58edbff935a62d53ec3227a3518cb4f72

See more details on using hashes here.

Provenance

The following attestation bundles were made for gp_libs-0.0.17-py3-none-any.whl:

Publisher: tests.yml on git-pull/gp-libs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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