diff --git a/copier.yaml b/copier.yaml index 55b513c..c5125d5 100644 --- a/copier.yaml +++ b/copier.yaml @@ -195,3 +195,9 @@ copyright_license: GNU Lesser General Public License v3.0 only: LGPL-3.0 ISC License: ISC MIT License: MIT + +template_attribution: + type: bool + qmark: 🪧 + help: Add copier-python attribution to README.md? + default: no diff --git a/template/README.md.jinja b/template/README.md.jinja index 1931760..cb03e80 100644 --- a/template/README.md.jinja +++ b/template/README.md.jinja @@ -23,4 +23,12 @@ pip install {{ project_name }} ``` {%- endif %} +{%- if template_attribution %} + +## Project template + +This project is generated and maintained with [copier-python][copier-python]. + +[copier-python]: https://smkent.github.io/copier-python +{%- endif %} {#- vim: set ft=markdown: #} diff --git a/tests/__snapshots__/test_readme.ambr b/tests/__snapshots__/test_readme.ambr index 73a9117..58daec7 100644 --- a/tests/__snapshots__/test_readme.ambr +++ b/tests/__snapshots__/test_readme.ambr @@ -1,5 +1,99 @@ # serializer version: 1 -# name: test_readme_features[no_pypi-coverage] +# name: test_readme_features[attribution-no_pypi-coverage] + ''' + # PKFire + + Onett Little League + + [![License](https://img.shields.io/github/license/ness/PKFire)](https://github.com/ness/PKFire/blob/main/LICENSE) + [![CI](https://github.com/ness/PKFire/actions/workflows/ci.yaml/badge.svg)](https://github.com/ness/PKFire/actions/workflows/ci.yaml) + [![Coverage](https://codecov.io/gh/ness/PKFire/branch/main/graph/badge.svg)](https://codecov.io/gh/ness/PKFire) + [![Renovate](https://img.shields.io/badge/renovate-enabled-brightgreen?logo=renovatebot)](https://renovatebot.com) + [![GitHub stars](https://img.shields.io/github/stars/ness/PKFire?style=social)](https://github.com/ness/PKFire) + + ## Project template + + This project is generated and maintained with [copier-python][copier-python]. + + [copier-python]: https://smkent.github.io/copier-python + + ''' +# --- +# name: test_readme_features[attribution-no_pypi-no_coverage] + ''' + # PKFire + + Onett Little League + + [![License](https://img.shields.io/github/license/ness/PKFire)](https://github.com/ness/PKFire/blob/main/LICENSE) + [![CI](https://github.com/ness/PKFire/actions/workflows/ci.yaml/badge.svg)](https://github.com/ness/PKFire/actions/workflows/ci.yaml) + [![Renovate](https://img.shields.io/badge/renovate-enabled-brightgreen?logo=renovatebot)](https://renovatebot.com) + [![GitHub stars](https://img.shields.io/github/stars/ness/PKFire?style=social)](https://github.com/ness/PKFire) + + ## Project template + + This project is generated and maintained with [copier-python][copier-python]. + + [copier-python]: https://smkent.github.io/copier-python + + ''' +# --- +# name: test_readme_features[attribution-pypi-coverage] + ''' + # PKFire + + Onett Little League + + [![License](https://img.shields.io/github/license/ness/PKFire)](https://github.com/ness/PKFire/blob/main/LICENSE) + [![PyPI](https://img.shields.io/pypi/v/PKFire)](https://pypi.org/project/PKFire/) + [![Python](https://img.shields.io/pypi/pyversions/PKFire)](https://pypi.org/project/PKFire/) + [![CI](https://github.com/ness/PKFire/actions/workflows/ci.yaml/badge.svg)](https://github.com/ness/PKFire/actions/workflows/ci.yaml) + [![Coverage](https://codecov.io/gh/ness/PKFire/branch/main/graph/badge.svg)](https://codecov.io/gh/ness/PKFire) + [![Renovate](https://img.shields.io/badge/renovate-enabled-brightgreen?logo=renovatebot)](https://renovatebot.com) + [![GitHub stars](https://img.shields.io/github/stars/ness/PKFire?style=social)](https://github.com/ness/PKFire) + + ## Installation + + ```sh + pip install PKFire + ``` + + ## Project template + + This project is generated and maintained with [copier-python][copier-python]. + + [copier-python]: https://smkent.github.io/copier-python + + ''' +# --- +# name: test_readme_features[attribution-pypi-no_coverage] + ''' + # PKFire + + Onett Little League + + [![License](https://img.shields.io/github/license/ness/PKFire)](https://github.com/ness/PKFire/blob/main/LICENSE) + [![PyPI](https://img.shields.io/pypi/v/PKFire)](https://pypi.org/project/PKFire/) + [![Python](https://img.shields.io/pypi/pyversions/PKFire)](https://pypi.org/project/PKFire/) + [![CI](https://github.com/ness/PKFire/actions/workflows/ci.yaml/badge.svg)](https://github.com/ness/PKFire/actions/workflows/ci.yaml) + [![Renovate](https://img.shields.io/badge/renovate-enabled-brightgreen?logo=renovatebot)](https://renovatebot.com) + [![GitHub stars](https://img.shields.io/github/stars/ness/PKFire?style=social)](https://github.com/ness/PKFire) + + ## Installation + + ```sh + pip install PKFire + ``` + + ## Project template + + This project is generated and maintained with [copier-python][copier-python]. + + [copier-python]: https://smkent.github.io/copier-python + + ''' +# --- +# name: test_readme_features[no_attribution-no_pypi-coverage] ''' # PKFire @@ -13,7 +107,7 @@ ''' # --- -# name: test_readme_features[no_pypi-no_coverage] +# name: test_readme_features[no_attribution-no_pypi-no_coverage] ''' # PKFire @@ -26,7 +120,7 @@ ''' # --- -# name: test_readme_features[pypi-coverage] +# name: test_readme_features[no_attribution-pypi-coverage] ''' # PKFire @@ -48,7 +142,7 @@ ''' # --- -# name: test_readme_features[pypi-no_coverage] +# name: test_readme_features[no_attribution-pypi-no_coverage] ''' # PKFire diff --git a/tests/test_readme.py b/tests/test_readme.py index 4c47fe5..690a899 100644 --- a/tests/test_readme.py +++ b/tests/test_readme.py @@ -15,15 +15,25 @@ "enable_pypi", [pytest.param(True, id="pypi"), pytest.param(False, id="no_pypi")], ) +@pytest.mark.parametrize( + "template_attribution", + [ + pytest.param(True, id="attribution"), + pytest.param(False, id="no_attribution"), + ], +) def test_readme_features( render_template: Callable[..., Path], snapshot: SnapshotAssertion, *, enable_coverage: bool, enable_pypi: bool, + template_attribution: bool, ) -> None: rendered = render_template( - enable_coverage=enable_coverage, enable_pypi=enable_pypi + enable_coverage=enable_coverage, + enable_pypi=enable_pypi, + template_attribution=template_attribution, ) assert (rendered / "README.md").read_text() == snapshot