Skip to content

Commit daf263c

Browse files
author
a.pirogov
committed
feat: add somesy support
1 parent c7423f3 commit daf263c

12 files changed

Lines changed: 187 additions & 83 deletions

File tree

.pre-commit-config.yaml

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,13 @@ exclude: "^{{ cookiecutter.*" # <-- added
33
# See https://pre-commit.com for more information
44
# See https://pre-commit.com/hooks.html for more hooks
55
repos:
6-
7-
# Various general + format-specific helpers
8-
- repo: https://github.com/pre-commit/pre-commit-hooks
9-
rev: v4.4.0
10-
hooks:
11-
- id: check-symlinks
12-
- id: trailing-whitespace
13-
- id: mixed-line-ending
14-
args: [--fix=lf]
15-
- id: check-yaml
16-
exclude: 'mkdocs.yml'
17-
- id: check-toml
18-
- id: check-json
19-
- id: check-ast
20-
- id: debug-statements
21-
- id: check-merge-conflict
22-
- id: check-shebang-scripts-are-executable
23-
- id: check-added-large-files
24-
args: [--maxkb=10000]
6+
# GH Actions
257
- repo: https://github.com/python-jsonschema/check-jsonschema
268
rev: '0.22.0'
279
hooks:
2810
- id: check-github-workflows
11+
12+
# General Python linters and formatters
2913
- repo: https://github.com/pycqa/isort
3014
rev: '5.12.0'
3115
hooks:
@@ -80,8 +64,27 @@ repos:
8064
hooks:
8165
- id: reuse
8266

83-
- repo: https://github.com/Materials-Data-Science-and-Informatics/dev-utils
84-
rev: 'v0.1.0'
67+
- repo: https://github.com/Materials-Data-Science-and-Informatics/somesy
68+
rev: "e8bf980" # "0.1.0" TODO: set to tag once released
8569
hooks:
86-
- id: update-codemeta
87-
files: ^pyproject.toml$
70+
- id: somesy
71+
72+
# Various general + format-specific helpers
73+
- repo: https://github.com/pre-commit/pre-commit-hooks
74+
rev: v4.4.0
75+
hooks:
76+
- id: check-symlinks
77+
- id: trailing-whitespace
78+
exclude: 'CITATION.cff'
79+
- id: mixed-line-ending
80+
args: [--fix=lf]
81+
- id: check-yaml
82+
exclude: 'mkdocs.yml'
83+
- id: check-toml
84+
- id: check-json
85+
- id: check-ast
86+
- id: debug-statements
87+
- id: check-merge-conflict
88+
- id: check-shebang-scripts-are-executable
89+
- id: check-added-large-files
90+
args: [--maxkb=10000]

.reuse/dep5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Files: {{ cookiecutter*
77
Copyright: 2023 Forschungszentrum Jülich GmbH - Institute for Materials Data Science and Informatics (IAS9) - Stefan Sandfeld <s.sandfeld@fz-juelich.de>
88
License: CC0-1.0
99

10-
Files: .gitignore pyproject.toml poetry.lock .pre-commit-config.yaml codemeta.json CITATION.cff README.md RELEASE_NOTES.md CHANGELOG.md CODE_OF_CONDUCT.md AUTHORS.md CONTRIBUTING.md .github/* mkdocs.yml docs/*
10+
Files: .gitignore pyproject.toml poetry.lock .pre-commit-config.yaml .somesy.toml codemeta.json CITATION.cff README.md RELEASE_NOTES.md CHANGELOG.md CODE_OF_CONDUCT.md AUTHORS.md CONTRIBUTING.md .github/* mkdocs.yml docs/*
1111
Copyright: 2023 Forschungszentrum Jülich GmbH - Institute for Materials Data Science and Informatics (IAS9) - Stefan Sandfeld <s.sandfeld@fz-juelich.de>
1212
License: CC0-1.0
1313

.somesy.toml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
[project]
2+
name = "fair-python-cookiecutter"
3+
version = "0.1.1"
4+
description = "An opinionated cookiecutter template to kickstart a modern best-practice Python project with FAIR metadata. "
5+
6+
license = "MIT"
7+
keywords = [
8+
"fair",
9+
"metadata",
10+
"python",
11+
"cookiecutter",
12+
"template",
13+
]
14+
15+
repository = "https://github.com/Materials-Data-Science-and-Informatics/fair-python-cookiecutter"
16+
homepage = "https://materials-data-science-and-informatics.github.io/fair-python-cookiecutter"
17+
documentation = "https://materials-data-science-and-informatics.github.io/fair-python-cookiecutter"
18+
19+
[[project.people]]
20+
given-names = "Anton"
21+
family-names = "Pirogov"
22+
email = "a.pirogov@fz-juelich.de"
23+
orcid = "https://orcid.org/0000-0002-5077-7497"
24+
25+
author = true
26+
maintainer = true
27+
28+
[config]
29+
verbose = true

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ Here we provide notes that summarize the most important changes in each released
44

55
Please consult the changelog to inform yourself about breaking changes and security issues.
66

7+
## [v0.1.1](https://github.com/Materials-Data-Science-and-Informatics/fair-python-cookiecutter/tree/v0.1.0) <small>(2023-05-11)</small> { id="0.1.1" }
8+
9+
* Add [somesy](https:///Materials-Data-Science-and-Informatics/somesy) to manage and synchronize project metadata
10+
* Various minor fixes
11+
712
## [v0.1.0](https://github.com/Materials-Data-Science-and-Informatics/fair-python-cookiecutter/tree/v0.1.0) <small>(2023-05-11)</small> { id="0.1.0" }
813

914
* First release

CITATION.cff

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,28 @@ type: software
33
message: If you use this software, please cite it using this metadata.
44

55
title: "fair-python-cookiecutter"
6-
version: "0.1.0"
7-
abstract: "An opinionated cookiecutter template to kickstart a modern best-practice Python project with FAIR metadata. "
6+
version: "0.1.1"
7+
abstract: "An opinionated cookiecutter template to kickstart a modern best-practice
8+
Python project with FAIR metadata."
89
repository-code: "https://github.com/Materials-Data-Science-and-Informatics/fair-python-cookiecutter"
910
license: "MIT"
10-
keywords: [
11-
"fair",
12-
"metadata",
13-
"python",
14-
"cookiecutter",
15-
"template"
16-
]
17-
11+
keywords:
12+
- fair
13+
- metadata
14+
- python
15+
- cookiecutter
16+
- template
1817
authors:
19-
- family-names: "Pirogov"
20-
given-names: "Anton"
21-
email: "a.pirogov@fz-juelich.de"
22-
orcid: "https://orcid.org/0000-0002-5077-7497"
23-
affiliation: "Forschungszentrum Jülich GmbH - Institute for Materials Data Science and Informatics (IAS9)"
24-
18+
- family-names: Pirogov
19+
given-names: Anton
20+
email: a.pirogov@fz-juelich.de
21+
orcid: https://orcid.org/0000-0002-5077-7497
22+
affiliation: Forschungszentrum Jülich GmbH - Institute for Materials Data Science
23+
and Informatics (IAS9)
24+
contact:
25+
- orcid: https://orcid.org/0000-0002-5077-7497
26+
given-names: Anton
27+
family-names: Pirogov
28+
email: a.pirogov@fz-juelich.de
29+
url:
30+
https://materials-data-science-and-informatics.github.io/fair-python-cookiecutter

codemeta.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,27 @@
1010
"audience": [
1111
{
1212
"@type": "Audience",
13-
"audienceType": "Science/Research"
13+
"audienceType": "Developers"
1414
},
1515
{
1616
"@type": "Audience",
17-
"audienceType": "Developers"
17+
"audienceType": "Science/Research"
1818
}
1919
],
2020
"author": [
2121
{
22+
"@id": "https://orcid.org/0000-0002-5077-7497",
2223
"@type": "Person",
23-
"email": "a.pirogov@fz-juelich.de",
24+
"affiliation": {
25+
"@type": "Organization",
26+
"legalName": "Forschungszentrum Jülich GmbH - Institute for Materials Data Science and Informatics (IAS9)"
27+
},
2428
"familyName": "Pirogov",
2529
"givenName": "Anton"
2630
}
2731
],
2832
"codeRepository": "https://github.com/Materials-Data-Science-and-Informatics/fair-python-cookiecutter",
29-
"description": "An opinionated cookiecutter template to kickstart a modern best-practice Python project with FAIR metadata. ",
33+
"description": "An opinionated cookiecutter template to kickstart a modern best-practice Python project with FAIR metadata.",
3034
"identifier": "fair-python-cookiecutter",
3135
"keywords": [
3236
"cookiecutter",
@@ -54,5 +58,6 @@
5458
"version": "^3.8"
5559
}
5660
],
61+
"url": "https://materials-data-science-and-informatics.github.io/fair-python-cookiecutter",
5762
"version": "0.1.1"
5863
}

hooks/post_gen_project.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,25 @@ rm tests/test_api.py
2424
# {% endif %}
2525
# ----
2626

27+
2728
# finalize repo setup
2829
git init
2930
poetry install --with docs
3031
poetry run poe init-dev # init git repo + register pre-commit
3132
poetry run pip install pipx # install pipx into venv without adding it as dep
3233
poetry run pipx run reuse download --all # get license files for REUSE compliance
33-
poetry run poe lint update-codemeta --files pyproject.toml # to create codemeta.json
34+
35+
# ----
36+
# if we use somesy, CITATION.cff + codemeta.json is created automatically
37+
rm CITATION.cff # using somesy -> will be created from pyproject.toml
38+
if [ -f "CITATION.cff" ]; then
39+
# not using somesy -> create a minimal codemeta.json based on the CITATION.cff
40+
# (avoiding the buggy codemetapy pyproject.toml parsing)
41+
pipx run cffconvert -i CITATION.cff -f codemeta -o codemeta.json
42+
fi
43+
# ----
44+
# use somesy to create CITATION.cff + codemeta.json
45+
poetry run poe lint somesy --files pyproject.toml
3446

3547
# create first commit
3648
git add .

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# basic configuration:
22
site_name: "fair-python-cookiecutter"
3-
site_description: "An opinionated cookiecutter template to kickstart a modern best-practice Python project with FAIR metadata. "
3+
site_description: "An opinionated cookiecutter template to kickstart a modern best-practice Python project with FAIR metadata."
44
site_url: "https://materials-data-science-and-informatics.github.io/fair-python-cookiecutter"
55
repo_url: "https://github.com/Materials-Data-Science-and-Informatics/fair-python-cookiecutter"
66
edit_uri: "blob/main/docs/"

pyproject.toml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,23 @@
11
[tool.poetry]
2+
# ---- managed by somesy, see .somesy.toml ----
23
name = "fair-python-cookiecutter"
34
version = "0.1.1"
4-
description = "An opinionated cookiecutter template to kickstart a modern best-practice Python project with FAIR metadata. "
5+
description = "An opinionated cookiecutter template to kickstart a modern best-practice Python project with FAIR metadata."
56
authors = ["Anton Pirogov <a.pirogov@fz-juelich.de>"]
7+
maintainers = ["Anton Pirogov <a.pirogov@fz-juelich.de>"]
68
license = "MIT"
79

8-
readme = "README.md"
10+
keywords = ["fair", "metadata", "python", "cookiecutter", "template"]
911
repository = "https://github.com/Materials-Data-Science-and-Informatics/fair-python-cookiecutter"
1012
homepage = "https://materials-data-science-and-informatics.github.io/fair-python-cookiecutter"
1113
documentation = "https://materials-data-science-and-informatics.github.io/fair-python-cookiecutter"
14+
# ---- managed by somesy, see .somesy.toml ----
1215

13-
keywords = [
14-
"fair",
15-
"metadata",
16-
"python",
17-
"cookiecutter",
18-
"template"
19-
]
2016
classifiers = [
2117
"Intended Audience :: Science/Research",
2218
"Intended Audience :: Developers",
2319
]
20+
readme = "README.md"
2421

2522
[tool.poetry.dependencies]
2623
python = "^3.8"

{{ cookiecutter.__project_slug }}/.pre-commit-config.yaml

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,13 @@
11
# See https://pre-commit.com for more information
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
4-
5-
# Various general + format-specific helpers
6-
- repo: https://github.com/pre-commit/pre-commit-hooks
7-
rev: v4.4.0
8-
hooks:
9-
- id: check-symlinks
10-
- id: trailing-whitespace
11-
- id: mixed-line-ending
12-
args: [--fix=lf]
13-
- id: check-yaml
14-
exclude: 'mkdocs.yml'
15-
- id: check-toml
16-
- id: check-json
17-
- id: check-ast
18-
- id: debug-statements
19-
- id: check-merge-conflict
20-
- id: check-shebang-scripts-are-executable
21-
- id: check-added-large-files
22-
args: [--maxkb=10000]
4+
# GH Actions
235
- repo: https://github.com/python-jsonschema/check-jsonschema
246
rev: '0.22.0'
257
hooks:
268
- id: check-github-workflows
9+
10+
# General Python linters and formatters
2711
- repo: https://github.com/pycqa/isort
2812
rev: '5.12.0'
2913
hooks:
@@ -67,7 +51,7 @@ repos:
6751
args: ['-q', '-c', 'pyproject.toml']
6852
additional_dependencies: [ '.[toml]' ]
6953

70-
# Metadata
54+
# License Metadata
7155
- repo: https://github.com/citation-file-format/cff-converter-python
7256
rev: '44e8fc9'
7357
hooks:
@@ -77,8 +61,29 @@ repos:
7761
hooks:
7862
- id: reuse
7963

80-
- repo: https://github.com/Materials-Data-Science-and-Informatics/dev-utils
81-
rev: 'v0.1.0'
64+
# Project Metadata
65+
- repo: https://github.com/Materials-Data-Science-and-Informatics/somesy
66+
rev: "e8bf980" # "0.1.0" TODO: set to tag once released
8267
hooks:
83-
- id: update-codemeta
84-
files: ^pyproject.toml$
68+
- id: somesy
69+
70+
# Various general + format-specific helpers
71+
# (run last to fix general syntactic defects)
72+
- repo: https://github.com/pre-commit/pre-commit-hooks
73+
rev: v4.4.0
74+
hooks:
75+
- id: check-symlinks
76+
- id: trailing-whitespace
77+
exclude: 'CITATION.cff'
78+
- id: mixed-line-ending
79+
args: [--fix=lf]
80+
- id: check-yaml
81+
exclude: 'mkdocs.yml'
82+
- id: check-toml
83+
- id: check-json
84+
- id: check-ast
85+
- id: debug-statements
86+
- id: check-merge-conflict
87+
- id: check-shebang-scripts-are-executable
88+
- id: check-added-large-files
89+
args: [--maxkb=10000]

0 commit comments

Comments
 (0)