Skip to content

Commit cb0fa5d

Browse files
author
a.pirogov
committed
fix docs building
1 parent 0be20be commit cb0fa5d

7 files changed

Lines changed: 30 additions & 16 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ jobs:
138138
# ----
139139

140140
deploy_demo:
141-
needs: docs
142-
if: startswith(github.ref, 'refs/tags/v')
141+
# needs: docs # TODO: uncomment when feature works
142+
# if: startswith(github.ref, 'refs/tags/v')
143143
secrets: inherit
144144
uses: "./.github/workflows/deploy_demo.yml"
145145

.github/workflows/deploy_demo.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
name: Deploy the demo repository
2-
# TODO: could use current version tag of template to match the demo
3-
# and think how to preserve old branches / docs
42

53
on: [workflow_dispatch, workflow_call]
64

@@ -37,9 +35,19 @@ jobs:
3735
- name: Install cookiecutter
3836
run: pip install cookiecutter==2.1.1
3937

40-
- name: Instantiate demo repository
38+
- name: Prepare cookiecutter configuration
4139
run: |
42-
cookiecutter ./fair-python-cookiecutter --no-input --config-file=./fair-python-cookiecutter/tests/demo.yaml
40+
TEMPLATE_VERSION=$(grep -e "^version" ./fair-python-cookiecutter/pyproject.toml | sed 's/^.*=//')
41+
echo "extracted template version:" $TEMPLATE_VERSION
42+
SED_CMD_PREF='s/\(^.*version:\).*/\1'
43+
SED_CMD="${SED_CMD_PREF}${TEMPLATE_VERSION}/"
44+
echo "running sed to insert version:" $SED_CMD
45+
sed "$SED_CMD" ./fair-python-cookiecutter/tests/demo.yaml > cconf.yaml
46+
echo "resulting repo cookiecutter configuration:"
47+
cat cconf.yaml
48+
49+
- name: Instantiate demo repository
50+
run: cookiecutter ./fair-python-cookiecutter --no-input --config-file=cconf.yaml
4351

4452
- name: Deploy generated repository
4553
run: |

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ This will spawn an interactive prompt, where you have to provide some informatio
8585
a starting skeleton for your software project. Don't worry, you can always adapt this
8686
information later on by hand. After this cookiecutter will initate your software project.
8787

88-
The generated repository will include a copy of a [developer guide](./dev_guide.md),
88+
You can find a demo repository generated from this template
89+
[here](https://github.com/Materials-Data-Science-and-Informatics/fair-python-cookiecutter-demo).
90+
91+
Your new project repository will also include a copy of a [developer guide](./dev_guide.md),
8992
containing more information about the structure and features of the generated project.
9093
Feel free to either remove it, or keep (and possibly adjust) it as extended technical
9194
project documentation for yourself and other future project contributors.

codemeta.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
"audience": [
1111
{
1212
"@type": "Audience",
13-
"audienceType": "Developers"
13+
"audienceType": "Science/Research"
1414
},
1515
{
1616
"@type": "Audience",
17-
"audienceType": "Science/Research"
17+
"audienceType": "Developers"
1818
}
1919
],
2020
"author": [
@@ -54,5 +54,5 @@
5454
"version": "^3.8"
5555
}
5656
],
57-
"version": "0.1.0"
57+
"version": "0.1.1"
5858
}

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "fair-python-cookiecutter"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
description = "An opinionated cookiecutter template to kickstart a modern best-practice Python project with FAIR metadata. "
55
authors = ["Anton Pirogov <a.pirogov@fz-juelich.de>"]
66
license = "MIT"

tests/test_template.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,16 @@ def gen_project(**cc_args):
7171
return gen_project
7272

7373

74+
DEMO_PROJ_SLUG = "fair_python_cookiecutter_demo"
75+
76+
7477
def test_cookiecutter(gen):
7578
# generate with default values
7679
dir = gen()
7780
sanity_check_project(dir)
7881
# should NOT have the code files
79-
assert not (dir / "src/my_amazing_app/api.py").is_file()
80-
assert not (dir / "src/my_amazing_app/cli.py").is_file()
82+
assert not (dir / f"src/{DEMO_PROJ_SLUG}api.py").is_file()
83+
assert not (dir / f"src/{DEMO_PROJ_SLUG}/cli.py").is_file()
8184
assert not (dir / "tests/test_api.py").is_file()
8285
assert not (dir / "tests/test_cli.py").is_file()
8386
# and the expected license (MIT)
@@ -89,8 +92,8 @@ def test_cookiecutter(gen):
8992
dir = gen(config_file="./tests/demo.yaml")
9093
sanity_check_project(dir)
9194
# should have the code files
92-
assert (dir / "src/my_amazing_app/api.py").is_file()
93-
assert (dir / "src/my_amazing_app/cli.py").is_file()
95+
assert (dir / f"src/{DEMO_PROJ_SLUG}/api.py").is_file()
96+
assert (dir / f"src/{DEMO_PROJ_SLUG}/cli.py").is_file()
9497
assert (dir / "tests/test_api.py").is_file()
9598
assert (dir / "tests/test_cli.py").is_file()
9699
# and the expected license (Unlicense)

{{ cookiecutter.__project_slug }}/docs/scripts/coverage_status.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"""Colors for overall coverage percentage (0-100)."""
2121

2222

23-
def on_pre_build(_config):
23+
def on_pre_build(config): # noqa
2424
"""Generate coverage report if it is missing and create a badge."""
2525
if not Path("htmlcov").is_dir() or not Path(".coverage").is_file():
2626
log.info("Missing htmlcov or .coverage, running pytest to collect.")

0 commit comments

Comments
 (0)