Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

Run `pyupgrade` on python code blocks in documentation files

Project description


Run pyupgrade on python code blocks in documentation files.


pip install pyupgrade-docs


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:


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


    .. code-block:: python

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

usage with pre-commit

See pre-commit for instructions

Sample .pre-commit-config.yaml:

-   repo:
    rev: v0.1.0
    -   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.

Files for pyupgrade-docs, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size pyupgrade_docs-0.1.1.tar.gz (3.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page