Skip to main content

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

Project description

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" }

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

readme_patcher-0.7.2.tar.gz (52.2 kB view details)

Uploaded Source

Built Distribution

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

readme_patcher-0.7.2-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file readme_patcher-0.7.2.tar.gz.

File metadata

  • Download URL: readme_patcher-0.7.2.tar.gz
  • Upload date:
  • Size: 52.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.7.8

File hashes

Hashes for readme_patcher-0.7.2.tar.gz
Algorithm Hash digest
SHA256 ba3ab38806a7adaca7e6600c36913ac8ee55e7745e15ff94f21caa85a616405d
MD5 8f2791bc104de0ca365c9a07a33867b3
BLAKE2b-256 c6dd13a4a5ac6b2cdaa2cfaf89b688e14ca1cd4adc344067bb4b4a231cf79dba

See more details on using hashes here.

File details

Details for the file readme_patcher-0.7.2-py3-none-any.whl.

File metadata

File hashes

Hashes for readme_patcher-0.7.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9121a9ee699cb349ad8f1d45680ccb0805e6c8b0b700fb99d2f2651b18cb3579
MD5 f46ea156470a2371da51a12b520ee9dd
BLAKE2b-256 4c00a195f1b2f24b4dfc6fbcfe04afeb1fc130445fd71fb3fbffd79752fea5bc

See more details on using hashes here.

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