Skip to content

Commit d63bf0c

Browse files
authored
Merge pull request #44 from smkent/attribution
Add optional template attribution
2 parents 267e241 + cb76420 commit d63bf0c

4 files changed

Lines changed: 123 additions & 5 deletions

File tree

copier.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,3 +195,9 @@ copyright_license:
195195
GNU Lesser General Public License v3.0 only: LGPL-3.0
196196
ISC License: ISC
197197
MIT License: MIT
198+
199+
template_attribution:
200+
type: bool
201+
qmark: 🪧
202+
help: Add copier-python attribution to README.md?
203+
default: no

template/README.md.jinja

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,12 @@
2323
pip install {{ project_name }}
2424
```
2525
{%- endif %}
26+
{%- if template_attribution %}
27+
28+
## Project template
29+
30+
This project is generated and maintained with [copier-python][copier-python].
31+
32+
[copier-python]: https://smkent.github.io/copier-python
33+
{%- endif %}
2634
{#- vim: set ft=markdown: #}

tests/__snapshots__/test_readme.ambr

Lines changed: 98 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,99 @@
11
# serializer version: 1
2-
# name: test_readme_features[no_pypi-coverage]
2+
# name: test_readme_features[attribution-no_pypi-coverage]
3+
'''
4+
# PKFire
5+
6+
Onett Little League
7+
8+
[![License](https://img.shields.io/github/license/ness/PKFire)](https://github.com/ness/PKFire/blob/main/LICENSE)
9+
[![CI](https://github.com/ness/PKFire/actions/workflows/ci.yaml/badge.svg)](https://github.com/ness/PKFire/actions/workflows/ci.yaml)
10+
[![Coverage](https://codecov.io/gh/ness/PKFire/branch/main/graph/badge.svg)](https://codecov.io/gh/ness/PKFire)
11+
[![Renovate](https://img.shields.io/badge/renovate-enabled-brightgreen?logo=renovatebot)](https://renovatebot.com)
12+
[![GitHub stars](https://img.shields.io/github/stars/ness/PKFire?style=social)](https://github.com/ness/PKFire)
13+
14+
## Project template
15+
16+
This project is generated and maintained with [copier-python][copier-python].
17+
18+
[copier-python]: https://smkent.github.io/copier-python
19+
20+
'''
21+
# ---
22+
# name: test_readme_features[attribution-no_pypi-no_coverage]
23+
'''
24+
# PKFire
25+
26+
Onett Little League
27+
28+
[![License](https://img.shields.io/github/license/ness/PKFire)](https://github.com/ness/PKFire/blob/main/LICENSE)
29+
[![CI](https://github.com/ness/PKFire/actions/workflows/ci.yaml/badge.svg)](https://github.com/ness/PKFire/actions/workflows/ci.yaml)
30+
[![Renovate](https://img.shields.io/badge/renovate-enabled-brightgreen?logo=renovatebot)](https://renovatebot.com)
31+
[![GitHub stars](https://img.shields.io/github/stars/ness/PKFire?style=social)](https://github.com/ness/PKFire)
32+
33+
## Project template
34+
35+
This project is generated and maintained with [copier-python][copier-python].
36+
37+
[copier-python]: https://smkent.github.io/copier-python
38+
39+
'''
40+
# ---
41+
# name: test_readme_features[attribution-pypi-coverage]
42+
'''
43+
# PKFire
44+
45+
Onett Little League
46+
47+
[![License](https://img.shields.io/github/license/ness/PKFire)](https://github.com/ness/PKFire/blob/main/LICENSE)
48+
[![PyPI](https://img.shields.io/pypi/v/PKFire)](https://pypi.org/project/PKFire/)
49+
[![Python](https://img.shields.io/pypi/pyversions/PKFire)](https://pypi.org/project/PKFire/)
50+
[![CI](https://github.com/ness/PKFire/actions/workflows/ci.yaml/badge.svg)](https://github.com/ness/PKFire/actions/workflows/ci.yaml)
51+
[![Coverage](https://codecov.io/gh/ness/PKFire/branch/main/graph/badge.svg)](https://codecov.io/gh/ness/PKFire)
52+
[![Renovate](https://img.shields.io/badge/renovate-enabled-brightgreen?logo=renovatebot)](https://renovatebot.com)
53+
[![GitHub stars](https://img.shields.io/github/stars/ness/PKFire?style=social)](https://github.com/ness/PKFire)
54+
55+
## Installation
56+
57+
```sh
58+
pip install PKFire
59+
```
60+
61+
## Project template
62+
63+
This project is generated and maintained with [copier-python][copier-python].
64+
65+
[copier-python]: https://smkent.github.io/copier-python
66+
67+
'''
68+
# ---
69+
# name: test_readme_features[attribution-pypi-no_coverage]
70+
'''
71+
# PKFire
72+
73+
Onett Little League
74+
75+
[![License](https://img.shields.io/github/license/ness/PKFire)](https://github.com/ness/PKFire/blob/main/LICENSE)
76+
[![PyPI](https://img.shields.io/pypi/v/PKFire)](https://pypi.org/project/PKFire/)
77+
[![Python](https://img.shields.io/pypi/pyversions/PKFire)](https://pypi.org/project/PKFire/)
78+
[![CI](https://github.com/ness/PKFire/actions/workflows/ci.yaml/badge.svg)](https://github.com/ness/PKFire/actions/workflows/ci.yaml)
79+
[![Renovate](https://img.shields.io/badge/renovate-enabled-brightgreen?logo=renovatebot)](https://renovatebot.com)
80+
[![GitHub stars](https://img.shields.io/github/stars/ness/PKFire?style=social)](https://github.com/ness/PKFire)
81+
82+
## Installation
83+
84+
```sh
85+
pip install PKFire
86+
```
87+
88+
## Project template
89+
90+
This project is generated and maintained with [copier-python][copier-python].
91+
92+
[copier-python]: https://smkent.github.io/copier-python
93+
94+
'''
95+
# ---
96+
# name: test_readme_features[no_attribution-no_pypi-coverage]
397
'''
498
# PKFire
599

@@ -13,7 +107,7 @@
13107

14108
'''
15109
# ---
16-
# name: test_readme_features[no_pypi-no_coverage]
110+
# name: test_readme_features[no_attribution-no_pypi-no_coverage]
17111
'''
18112
# PKFire
19113

@@ -26,7 +120,7 @@
26120

27121
'''
28122
# ---
29-
# name: test_readme_features[pypi-coverage]
123+
# name: test_readme_features[no_attribution-pypi-coverage]
30124
'''
31125
# PKFire
32126

@@ -48,7 +142,7 @@
48142

49143
'''
50144
# ---
51-
# name: test_readme_features[pypi-no_coverage]
145+
# name: test_readme_features[no_attribution-pypi-no_coverage]
52146
'''
53147
# PKFire
54148

tests/test_readme.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,25 @@
1515
"enable_pypi",
1616
[pytest.param(True, id="pypi"), pytest.param(False, id="no_pypi")],
1717
)
18+
@pytest.mark.parametrize(
19+
"template_attribution",
20+
[
21+
pytest.param(True, id="attribution"),
22+
pytest.param(False, id="no_attribution"),
23+
],
24+
)
1825
def test_readme_features(
1926
render_template: Callable[..., Path],
2027
snapshot: SnapshotAssertion,
2128
*,
2229
enable_coverage: bool,
2330
enable_pypi: bool,
31+
template_attribution: bool,
2432
) -> None:
2533
rendered = render_template(
26-
enable_coverage=enable_coverage, enable_pypi=enable_pypi
34+
enable_coverage=enable_coverage,
35+
enable_pypi=enable_pypi,
36+
template_attribution=template_attribution,
2737
)
2838
assert (rendered / "README.md").read_text() == snapshot
2939

0 commit comments

Comments
 (0)