Skip to content

Commit b39655d

Browse files
authored
Add repository generation via cookiecutter (frequenz-floss#39)
- Fix use of optional dependencies - Improve documentation - Don't raise if there are no dependencies - Revert "Use sets for config paths and sessions" - Deduplicate config paths - Add cookiecutter template to generate repositories Fixes frequenz-floss#21, fixes frequenz-floss#11.
2 parents b5f9c60 + f3599c8 commit b39655d

File tree

20 files changed

+1154
-33
lines changed

20 files changed

+1154
-33
lines changed

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,40 @@ repository for Frequenz projects.
55

66
If offers:
77

8+
* [Cookiecutter] templates for scaffolding new projects
89
* Trivial build of `noxfile.py` with some predefined sessions with all common
910
checks.
1011
* Tools to build protobuf/grpc files as Python, including type information.
12+
13+
14+
[Cookiecutter]: https://cookiecutter.readthedocs.io/en/stable
15+
16+
## Start a new projects
17+
18+
To start a new project you should first [install
19+
Cookiecutter](https://cookiecutter.readthedocs.io/en/stable/installation.html).
20+
It is normally available in any Linux distribution, but some have a very old
21+
version (for example, Ubuntu/Debian). You can [check which version your distro
22+
has in Repology](https://repology.org/project/cookiecutter/versions). You need
23+
**at least version 2.1.0**. To make sure to get an up to date version you can
24+
always uses `pip` and install in a `venv`:
25+
26+
```console
27+
$ python -m venv cookiecutter
28+
$ cd cookiecutter
29+
$ . bin/activate
30+
[cookiecutter] $ pip install cookiecutter
31+
Collecting cookiecutter
32+
...
33+
```
34+
35+
Then just run cookiecutter where you want to create the new project. A new
36+
directory will be created with the generated project name. For example:
37+
38+
```sh
39+
cd ~/devel
40+
cookiecutter gh:frequenz-floss/frequenz-repo-config-python --directory=cookiecutter
41+
```
42+
43+
This will prompt for the project type, name and other configuration and
44+
generate the whole project for you.

cookiecutter/cookiecutter.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"type": [
3+
"actor",
4+
"api",
5+
"app",
6+
"lib",
7+
"model"
8+
],
9+
"name": null,
10+
"description": null,
11+
"keywords": "(comma separated: 'frequenz', <type> and <name> are included automatically)",
12+
"github_org": "frequenz-floss",
13+
"license": [
14+
"MIT",
15+
"Proprietary"
16+
],
17+
"author_name": "Frequenz Energy-as-a-Service GmbH",
18+
"author_email": "[email protected]",
19+
"python_package": "{{cookiecutter | python_package}}",
20+
"pypi_package_name": "{{cookiecutter | pypi_package_name}}",
21+
"github_repo_name": "{{cookiecutter | github_repo_name}}",
22+
"_extensions": [
23+
"jinja2_time.TimeExtension",
24+
"local_extensions.github_repo_name",
25+
"local_extensions.keywords",
26+
"local_extensions.pypi_package_name",
27+
"local_extensions.python_package"
28+
]
29+
}

0 commit comments

Comments
 (0)