Skip to main content
This package on the Python Package Index Tests

readme_patcher

Generate README files from templates. Allow input from functions calls and cli output.

cd your-project
vim README_template.rst
poetry add --group dev readme-patcher
poetry shell
readme-patcher # README.rst

Global objects

py_project

{{ py_project.repository }}

github

https://docs.github.com/en/rest/repos/repos#get-a-repository

https://api.github.com/repos/Josef-Friedrich/readme_patcher

{{ github.name }}
{{ github.full_name }}
{{ github.description }}
{{ github.owner.login }}

badge

{{ badge.pypi }}
{{ badge.github_workflow('tests' 'Tests') }}
{{ badge.readthedocs }}

Functions

cli (Command line interface): Combined output (stdout and stderr) of command line interfaces (scripts / binaries)

{{ cli('awk --help') }}

It is recommended to use the cli function together with the literal filter.

{{ cli('awk --help') | literal }}

func: return values of Python functions

{{ func('os.getcwd') }}

read: read text files

{{ read('code/example.py') | code('python') }}

Filters

code

{{ 'print("example")' | code('python') }}
.. code-block:: python

    print("example")

literal

{{ func('os.getcwd') | literal }}
::

    /home/repos/project

heading

{{ 'heading 1' | heading(1) }}

{{ 'heading 2' | heading(2) }}

{{ 'heading 3' | heading(3) }}

{{ 'heading 4' | heading(4) }}
heading 1
=========

heading 2
---------

heading 3
^^^^^^^^^

heading 4
"""""""""

Examples

{% for command in [
                  'dns-ipv6-prefix.py',
                  'extract-pdftext.py',
                  'find-dupes-by-size.py',
                  'list-files.py',
                  'mac-to-eui64.py',
                  'pdf-compress.py',
                  'image-into-pdf.py'
                  ]
%}

``{{ command }}``

{{ cli('{} --help'.format(command)) | literal }}
{% endfor %}

Configuration

[[tool.readme_patcher.file]]
src = "README_template.rst"
dest = "README.rst"
variables = { cwd = "func:os.getcwd", fortune = "cli:fortune --help" }

Metadata

Release files for readme_patcher 0.7.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for readme_patcher 0.7.2
File Size Uploaded
readme_patcher-0.7.2.tar.gz 52.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for readme_patcher 0.7.2
File Interpreter ABI Platform
readme_patcher-0.7.2-py3-none-any.whl Python 3 none any Details

Total release size: 62.4 kB

Release files / readme_patcher-0.7.2.tar.gz

Download URL readme_patcher-0.7.2.tar.gz
Size 52.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ba3ab38806a7adaca7e6600c36913ac8ee55e7745e15ff94f21caa85a616405d
BLAKE2b-256 checksum
How to use checksums
c6dd13a4a5ac6b2cdaa2cfaf89b688e14ca1cd4adc344067bb4b4a231cf79dba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.7.8

Release files / readme_patcher-0.7.2-py3-none-any.whl

Download URL readme_patcher-0.7.2-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9121a9ee699cb349ad8f1d45680ccb0805e6c8b0b700fb99d2f2651b18cb3579
BLAKE2b-256 checksum
How to use checksums
4c00a195f1b2f24b4dfc6fbcfe04afeb1fc130445fd71fb3fbffd79752fea5bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.7.8

Release history Release notifications | RSS feed

This release

0.7.2 This release

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page