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.1.tar.gz (52.4 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.1-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for readme_patcher-0.7.1.tar.gz
Algorithm Hash digest
SHA256 3999f0c7fb62cefaa6c179cdffda9e26261028e121cf13e13494b863075586fa
MD5 5d2fb86550d98f40dd42f4d10001bba6
BLAKE2b-256 379cd512ea4da84a446b52153c9002527d12ade4a1c4f95b05f39369fa809e7f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for readme_patcher-0.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 11cbd2bd0c236d600374221629c9f7d215189ba22633b7b76c4e05c87b22a367
MD5 c0366f70836511a8864136491b4d2d6b
BLAKE2b-256 796e72983cb5884cab476925f80c03fcab810768edd9b11d5c9216392b5e968b

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