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
    

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

Uploaded Source

Built Distribution

gp_libs-0.0.3-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gp_libs-0.0.3.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for gp_libs-0.0.3.tar.gz
Algorithm Hash digest
SHA256 405772d6d318e781fed2729299080f6315ab8c3a9949a0f287d855492edaf189
MD5 811ab368b9d6f15ad6906ef4fb8fa0e9
BLAKE2b-256 ed50acf9386d7a70aa0b31c978c72218ebf37d57a6d63840f156e96bc05c8521

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gp_libs-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 14.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for gp_libs-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 04ea24d36b61f5e76c97166a31b4af3e1a641300f2a523058126cb764bccf7ab
MD5 c51d92597a77935eb65edb8fb33c6f43
BLAKE2b-256 71c6c460b2d3e18f99a9f12ba1763a021dbc485fbc997f138bbd9da440cca0bf

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