Skip to main content

Run `pyupgrade` on python code blocks in documentation files

Project description

pyupgrade-docs

Run pyupgrade on python code blocks in documentation files.

install

pip install pyupgrade-docs

usage

pyupgrade-docs provides a single executable (pyupgrade-docs) which will modify .rst / .md files in place.

It currently supports the following pyupgrade options:

  • --keep-percent-format
  • --py3-plus --py3-only
  • --py36-plus

Following additional parameters can be used:

  • -E / --skip-errors

pyupgrade-docs will format code in the following block types:

(markdown)

    ```python
    def hello():
        print("hello world")
    ```

(rst)

    .. code-block:: python

        def hello():
            print("hello world")

usage with pre-commit

See pre-commit for instructions

Sample .pre-commit-config.yaml:

-   repo: https://github.com/verhovsky/pyupgrade-docs
    rev: v0.1.0
    hooks:
    -   id: pyupgrade-docs

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

pyupgrade_docs-0.1.1.tar.gz (3.8 kB view hashes)

Uploaded Source

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