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: Combined output (stdout and stderr) of command line interfaces (scripts / binaries)

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

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

Uploaded Source

Built Distribution

readme_patcher-0.7.0-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: readme_patcher-0.7.0.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.1 Linux/6.5.0-1017-azure

File hashes

Hashes for readme_patcher-0.7.0.tar.gz
Algorithm Hash digest
SHA256 5f06988b84cf08113ccb2ba0a494c48c87d3a149b666348e4c2f8de0bac472bd
MD5 a4600be33191429d8b947f8c8950f728
BLAKE2b-256 75a9bed5d98898b4e598869794a10c83df090f700cdfe1b53ba70e5444e1bfeb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: readme_patcher-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.1 Linux/6.5.0-1017-azure

File hashes

Hashes for readme_patcher-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f39d635b65e775a5c76c23bb9c977c9bdb1adcb2abcfcf342981b014e8926d32
MD5 33d48e1b0c53867fafa81f499ea945eb
BLAKE2b-256 ec6106866837bf69ea0a44d09b9c2588e76b7140b96f46b5586438db9a7f692f

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