Skip to content

Commit 620fa60

Browse files
authored
Merge pull request #20 from Materials-Data-Science-and-Informatics/custom-cli
Refactor to use a custom CLI tool to enable more flexibility, add better GitLab support
2 parents e6d1030 + 7c3918c commit 620fa60

71 files changed

Lines changed: 1695 additions & 874 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
temp/
2+
scratch/
3+
14
# don't add vscode stuff
25
.vscode
36

.pre-commit-config.yaml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
exclude: "^{{ cookiecutter.*" # <-- added
1+
exclude: "src/fair_python_cookiecutter/template/*" # <-- added
22
# ---- copy from template below ----
33
# See https://pre-commit.com for more information
44
# See https://pre-commit.com/hooks.html for more hooks
@@ -26,12 +26,6 @@ repos:
2626
args: [--no-strict-optional, --ignore-missing-imports]
2727
# NOTE: you might need to add some deps here:
2828
additional_dependencies: []
29-
- repo: https://github.com/PyCQA/bandit
30-
rev: '1.7.5'
31-
hooks:
32-
- id: bandit
33-
args: ['-q', '-c', 'pyproject.toml']
34-
additional_dependencies: [ '.[toml]' ]
3529

3630
# Metadata
3731
- repo: https://github.com/citation-file-format/cff-converter-python
@@ -44,7 +38,7 @@ repos:
4438
- id: reuse
4539

4640
- repo: https://github.com/Materials-Data-Science-and-Informatics/somesy
47-
rev: 'v0.2.0'
41+
rev: 'v0.2.1'
4842
hooks:
4943
- id: somesy
5044

.somesy.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "fair-python-cookiecutter"
3-
version = "0.1.0"
3+
version = "0.2.0"
44
description = "An opinionated cookiecutter template to kickstart a modern best-practice Python project with FAIR metadata. "
55

66
license = "MIT"

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ 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.2.0](https://github.com/Materials-Data-Science-and-Informatics/fair-python-cookiecutter/tree/v0.2.0) <small>(2024-01-05)</small> { id="0.2.0" }
8+
9+
* Refactored into custom tool `fair-python-cookiecutter` for more versatility and convenience
10+
711
## [v0.1.0](https://github.com/Materials-Data-Science-and-Informatics/fair-python-cookiecutter/tree/v0.1.0) <small>(2023-07-24)</small> { id="0.1.0" }
812

913
* First release

CITATION.cff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ 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"
6+
version: "0.2.0"
77
abstract: "An opinionated cookiecutter template to kickstart a modern best-practice
88
Python project with FAIR metadata."
99
repository-code: "https://github.com/Materials-Data-Science-and-Informatics/fair-python-cookiecutter"

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{{ cookiecutter.__project_slug }}/CODE_OF_CONDUCT.md
1+
src/fair_python_cookiecutter/template/{{ cookiecutter.project_slug }}/CODE_OF_CONDUCT.md

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{{ cookiecutter.__project_slug }}/CONTRIBUTING.md
1+
src/fair_python_cookiecutter/template/{{ cookiecutter.project_slug }}/CONTRIBUTING.md

README.md

Lines changed: 47 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,25 @@
66
](https://github.com/Materials-Data-Science-and-Informatics/fair-python-cookiecutter/actions/workflows/ci.yml)
77

88
<!-- --8<-- [start:abstract] -->
9+
10+
<br />
11+
<div>
12+
<img style="center-align: middle;" alt="FAIR Python Cookiecutter Logo" src="https://raw.githubusercontent.com/Materials-Data-Science-and-Informatics/Logos/main/FAIRPythonCookiecutter/FAIRPYTHONCOOKIECUTTER_Logo_Text.png" width=70% height=70% />
13+
&nbsp;&nbsp;
14+
</div>
15+
<br />
16+
917
# fair-python-cookiecutter
1018

1119
An opinionated cookiecutter template to kickstart a modern best-practice Python project with FAIR metadata.
1220

1321
<!-- NOTE: For technical reasons, it is much easier to use GitHub
1422
for hosting the mindmap than adding it to the repository -->
15-
![FAIR Software Mindmap](https://github.com/Materials-Data-Science-and-Informatics/fair-python-cookiecutter/assets/371708/1eba8eaf-663f-4475-b6ce-39fac1a183b5)
23+
![FAIR Software Mindmap](https://github.com/Materials-Data-Science-and-Informatics/fair-python-cookiecutter/assets/371708/ef566ee1-8965-4d58-9ede-18eeb49a476e)
1624

17-
*Check out a demo repository generated from this template
18-
:point_right: [here](https://github.com/Materials-Data-Science-and-Informatics/fair-python-cookiecutter-demo)*
25+
*Check out the
26+
[demo repository](https://github.com/Materials-Data-Science-and-Informatics/fair-python-cookiecutter-demo)
27+
generated from this template!*
1928

2029
## Overview
2130

@@ -77,27 +86,37 @@ recommendations on the state of software citation in academic practice.
7786

7887
## Getting Started
7988

80-
First, make sure that you have a recent version of
81-
[cookiecutter](https://www.cookiecutter.io/) (`cookiecutter>=2.1`).
82-
This template does not work with older versions, because they lack some needed features.
89+
To install the template, run `pip install fair-python-cookiecutter`.
8390

84-
To install `cookiecutter`, you can run `pip install cookiecutter`.
85-
86-
To generate a new Python project from this template, run:
91+
Now you can run the tool to generate a new Python project:
8792

8893
```bash
89-
cookiecutter https://github.com/Materials-Data-Science-and-Informatics/fair-python-cookiecutter
94+
fair-python-cookiecutter YourProjectName
9095
```
9196

92-
This will spawn an interactive prompt, where you have to provide some information and select
93-
a starting skeleton for your software project. Don't worry, you can always adapt this
94-
information later on by hand. After this cookiecutter will initate your software project.
97+
This will spawn an interactive prompt, where you have to provide some information and
98+
make some choices for your new software project. Don't worry, you can always adapt
99+
everything later on by hand. After this, your software project will be created in
100+
a new directory.
101+
102+
To save you some time answering the questions, we recommend that you create an empty repository
103+
in GitHub or GitLab of your choice (i.e., the location where you plan to push your new project).
104+
105+
If you already have created an empty remote repository or know exactly its future
106+
location, you can provide the URL, which already will provide many required inputs:
107+
108+
```bash
109+
fair-python-cookiecutter --repo-url https://github.com/YourOrganization/YourProjectName
110+
```
95111

96112
Your new project repository will also include a copy of a
97113
[developer guide](https://materials-data-science-and-informatics.github.io/fair-python-cookiecutter-demo/latest/dev_guide),
98114
containing more information about the structure and features of the generated project.
99-
Feel free to either remove it, or keep (and possibly adjust) it as extended technical
100-
project documentation for yourself and other future project contributors.
115+
116+
**Please familiarize yourself with the generated structures, files and the contents of the
117+
developer guide.** Feel free to either remove the guide afterwards, or keep (and possibly
118+
adjust) it as extended technical project documentation for yourself and other future
119+
project contributors.
101120

102121
You can find a demo repository generated from this template [here](https://github.com/Materials-Data-Science-and-Informatics/fair-python-cookiecutter-demo).
103122

@@ -109,15 +128,15 @@ you might want to configure some template variables in your `~/.cookiecutterrc`.
109128
Here is an example cookiecutter configuration:
110129

111130
```yaml
112-
default_context:
113-
__org_name: "Your Institution"
114-
__org_mail_suffix: "your-institution.org"
115-
__org_rep: "Your Boss <your.boss@your-institution.org>"
116-
__org_gh: "Your-Github-Organization"
117-
118-
author_last_name: "Lastname"
119-
author_first_name: "Firstname"
120-
author_orcid: "0000-0000-1234-5678"
131+
fair_python_cookiecutter:
132+
last_name: "Carberry"
133+
first_name: "Josiah"
134+
project_keywords: "psychoceramics analytics"
135+
email: "josiah.carberry@brown.edu"
136+
orcid: "0000-0002-1825-0097"
137+
affiliation: "Brown University"
138+
copyright_holder: "Brown University"
139+
license: "MIT"
121140
```
122141
123142
This information will be already pre-filled when you use the template,
@@ -132,8 +151,9 @@ it to get your own copy. Then you can do the desired changes and use the URL of
132151
template repository instead of this one to kickstart your projects.
133152
134153
However, if you think that your changes are of general interest and would improve this
135-
template, consider to get in touch
136-
and [contribute](https://materials-data-science-and-informatics.github.io/fair-python-cookiecutter/main/contributing/)!
154+
template for a majority of users, please get in touch
155+
and [contribute](https://materials-data-science-and-informatics.github.io/fair-python-cookiecutter/main/contributing/)
156+
or [suggest](https://github.com/Materials-Data-Science-and-Informatics/fair-python-cookiecutter/issues) an improvement!
137157
138158
In any case we are very happy to know about any similar or derivative templates, e.g. for
139159
more specific use-cases or based on other tool preferences.
@@ -148,7 +168,7 @@ from this template, there are two main ways to do so:
148168
149169
If your project currently has no sophisticated setup of tools or strong preferences about
150170
them, option 1 might be the simplest way to adopt the template. Your code then needs to be
151-
moved into the `YOUR_PROJECT/src` subdirectory.
171+
moved into the `YOUR_PROJECT/src/YOUR_PACKAGE` subdirectory.
152172

153173
On the other hand, if you already have a working setup that you do not wish to replace
154174
completely, you can take a look at

codemeta.json

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,26 +57,61 @@
5757
"runtimePlatform": "Python 3",
5858
"version": "^2.1.1"
5959
},
60+
{
61+
"@type": "SoftwareApplication",
62+
"identifier": "importlib-resources",
63+
"name": "importlib-resources",
64+
"runtimePlatform": "Python 3",
65+
"version": "^6.1.1"
66+
},
67+
{
68+
"@type": "SoftwareApplication",
69+
"identifier": "platformdirs",
70+
"name": "platformdirs",
71+
"runtimePlatform": "Python 3",
72+
"version": "^4.1.0"
73+
},
6074
{
6175
"@type": "SoftwareApplication",
6276
"identifier": "pydantic",
6377
"name": "pydantic",
6478
"runtimePlatform": "Python 3",
6579
"version": "^2.5.2"
6680
},
81+
{
82+
"@type": "SoftwareApplication",
83+
"identifier": "pydantic-yaml",
84+
"name": "pydantic-yaml",
85+
"runtimePlatform": "Python 3",
86+
"version": "^1.2.0"
87+
},
6788
{
6889
"@type": "SoftwareApplication",
6990
"identifier": "python",
7091
"name": "python",
7192
"runtimePlatform": "Python 3",
7293
"version": "^3.8"
7394
},
95+
{
96+
"@type": "SoftwareApplication",
97+
"identifier": "spdx-lookup",
98+
"name": "spdx-lookup",
99+
"runtimePlatform": "Python 3",
100+
"version": "^0.3.3"
101+
},
74102
{
75103
"@type": "SoftwareApplication",
76104
"identifier": "typer",
77105
"name": "typer",
78106
"runtimePlatform": "Python 3",
79107
"version": "^0.9.0"
108+
},
109+
{
110+
"@type": "SoftwareApplication",
111+
"identifier": "typing-extensions",
112+
"name": "typing-extensions",
113+
"runtimePlatform": "Python 3",
114+
"version": "^4.8.0"
80115
}
81116
],
82117
"targetProduct": {
@@ -86,5 +121,5 @@
86121
"runtimePlatform": "Python 3"
87122
},
88123
"url": "https://materials-data-science-and-informatics.github.io/fair-python-cookiecutter",
89-
"version": "0.1.0"
124+
"version": "0.2.0"
90125
}

cookiecutter.json

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)