.. image:: http://img.shields.io/pypi/v/readme-patcher.svg
:target: https://pypi.org/project/readme-patcher
:alt: This package on the Python Package Index
.. image:: https://github.com/Josef-Friedrich/readme_patcher/actions/workflows/tests.yml/badge.svg
:target: https://github.com/Josef-Friedrich/readme_patcher/actions/workflows/tests.yml
:alt: Tests
readme_patcher
==============
Generate README files from templates. Allow input from functions calls and cli
output.
.. code-block:: shell
cd your-project
vim README_template.rst
poetry add --group dev readme-patcher
poetry shell
readme-patcher # README.rst
Global objects
--------------
py_project
^^^^^^^^^^
.. code-block:: jinja
{{ py_project.repository }}
github
^^^^^^
https://docs.github.com/en/rest/repos/repos#get-a-repository
https://api.github.com/repos/Josef-Friedrich/readme_patcher
.. code-block:: jinja
{{ github.name }}
{{ github.full_name }}
{{ github.description }}
{{ github.owner.login }}
badge
^^^^^
.. code-block:: jinja
{{ badge.pypi }}
{{ badge.github_workflow('tests' 'Tests') }}
{{ badge.readthedocs }}
Functions
---------
cli: Combined output (stdout and stderr) of command line interfaces (scripts / binaries)
.. code-block:: jinja
{{ cli('awk --help') }}
func: return values of Python functions
.. code-block:: jinja
{{ func('os.getcwd') }}
read: read text files
.. code-block:: jinja
{{ read('code/example.py') | code('python') }}
Filters
-------
code
^^^^
.. code-block:: jinja
{{ 'print("example")' | code('python') }}
::
.. code-block:: python
print("example")
literal
^^^^^^^
.. code-block:: jinja
{{ func('os.getcwd') | literal }}
::
::
/home/repos/project
heading
^^^^^^^
.. code-block:: jinja
{{ '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
--------
.. code-block:: jinja
{% 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
-------------
.. code-block:: toml
[[tool.readme_patcher.file]]
src = "README_template.rst"
dest = "README.rst"
variables = { cwd = "func:os.getcwd", fortune = "cli:fortune --help" }
Raw data
{
"_id": null,
"home_page": "https://github.com/Josef-Friedrich/readme_patcher",
"name": "readme_patcher",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.8",
"maintainer_email": null,
"keywords": null,
"author": "Josef Friedrich",
"author_email": "josef@friedrich.rocks",
"download_url": "https://files.pythonhosted.org/packages/75/a9/bed5d98898b4e598869794a10c83df090f700cdfe1b53ba70e5444e1bfeb/readme_patcher-0.7.0.tar.gz",
"platform": null,
"description": ".. image:: http://img.shields.io/pypi/v/readme-patcher.svg\n :target: https://pypi.org/project/readme-patcher\n :alt: This package on the Python Package Index\n\n.. image:: https://github.com/Josef-Friedrich/readme_patcher/actions/workflows/tests.yml/badge.svg\n :target: https://github.com/Josef-Friedrich/readme_patcher/actions/workflows/tests.yml\n :alt: Tests\n\nreadme_patcher\n==============\n\nGenerate README files from templates. Allow input from functions calls and cli\noutput.\n\n.. code-block:: shell\n\n cd your-project\n vim README_template.rst\n poetry add --group dev readme-patcher\n poetry shell\n readme-patcher # README.rst\n\nGlobal objects\n--------------\n\npy_project\n^^^^^^^^^^\n\n.. code-block:: jinja\n\n {{ py_project.repository }}\n\ngithub\n^^^^^^\n\nhttps://docs.github.com/en/rest/repos/repos#get-a-repository\n\nhttps://api.github.com/repos/Josef-Friedrich/readme_patcher\n\n.. code-block:: jinja\n\n {{ github.name }}\n {{ github.full_name }}\n {{ github.description }}\n {{ github.owner.login }}\n\nbadge\n^^^^^\n\n.. code-block:: jinja\n\n {{ badge.pypi }}\n {{ badge.github_workflow('tests' 'Tests') }}\n {{ badge.readthedocs }}\n\nFunctions\n---------\n\ncli: Combined output (stdout and stderr) of command line interfaces (scripts / binaries)\n\n.. code-block:: jinja\n\n {{ cli('awk --help') }}\n\nfunc: return values of Python functions\n\n.. code-block:: jinja\n\n {{ func('os.getcwd') }}\n\nread: read text files\n\n.. code-block:: jinja\n\n {{ read('code/example.py') | code('python') }}\n\nFilters\n-------\n\ncode\n^^^^\n\n.. code-block:: jinja\n\n {{ 'print(\"example\")' | code('python') }}\n\n::\n\n .. code-block:: python\n\n print(\"example\")\n\nliteral\n^^^^^^^\n\n.. code-block:: jinja\n\n {{ func('os.getcwd') | literal }}\n\n::\n\n ::\n\n /home/repos/project\n\nheading\n^^^^^^^\n\n.. code-block:: jinja\n\n {{ 'heading 1' | heading(1) }}\n\n {{ 'heading 2' | heading(2) }}\n\n {{ 'heading 3' | heading(3) }}\n\n {{ 'heading 4' | heading(4) }}\n\n::\n\n heading 1\n =========\n\n heading 2\n ---------\n\n heading 3\n ^^^^^^^^^\n\n heading 4\n \"\"\"\"\"\"\"\"\"\n\nExamples\n--------\n\n.. code-block:: jinja\n\n {% for command in [\n 'dns-ipv6-prefix.py',\n 'extract-pdftext.py',\n 'find-dupes-by-size.py',\n 'list-files.py',\n 'mac-to-eui64.py',\n 'pdf-compress.py',\n 'image-into-pdf.py'\n ]\n %}\n\n ``{{ command }}``\n\n {{ cli('{} --help'.format(command)) | literal }}\n {% endfor %}\n\nConfiguration\n-------------\n\n.. code-block:: toml\n\n [[tool.readme_patcher.file]]\n src = \"README_template.rst\"\n dest = \"README.rst\"\n variables = { cwd = \"func:os.getcwd\", fortune = \"cli:fortune --help\" }\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Generate README files from templates. Allow input from functions calls and cli output.",
"version": "0.7.0",
"project_urls": {
"Homepage": "https://github.com/Josef-Friedrich/readme_patcher",
"Repository": "https://github.com/Josef-Friedrich/readme_patcher"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ec6106866837bf69ea0a44d09b9c2588e76b7140b96f46b5586438db9a7f692f",
"md5": "33d48e1b0c53867fafa81f499ea945eb",
"sha256": "f39d635b65e775a5c76c23bb9c977c9bdb1adcb2abcfcf342981b014e8926d32"
},
"downloads": -1,
"filename": "readme_patcher-0.7.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "33d48e1b0c53867fafa81f499ea945eb",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8",
"size": 9921,
"upload_time": "2024-04-12T16:50:46",
"upload_time_iso_8601": "2024-04-12T16:50:46.568807Z",
"url": "https://files.pythonhosted.org/packages/ec/61/06866837bf69ea0a44d09b9c2588e76b7140b96f46b5586438db9a7f692f/readme_patcher-0.7.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "75a9bed5d98898b4e598869794a10c83df090f700cdfe1b53ba70e5444e1bfeb",
"md5": "a4600be33191429d8b947f8c8950f728",
"sha256": "5f06988b84cf08113ccb2ba0a494c48c87d3a149b666348e4c2f8de0bac472bd"
},
"downloads": -1,
"filename": "readme_patcher-0.7.0.tar.gz",
"has_sig": false,
"md5_digest": "a4600be33191429d8b947f8c8950f728",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8",
"size": 7333,
"upload_time": "2024-04-12T16:50:47",
"upload_time_iso_8601": "2024-04-12T16:50:47.900331Z",
"url": "https://files.pythonhosted.org/packages/75/a9/bed5d98898b4e598869794a10c83df090f700cdfe1b53ba70e5444e1bfeb/readme_patcher-0.7.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-12 16:50:47",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Josef-Friedrich",
"github_project": "readme_patcher",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "readme_patcher"
}