pyprefab 0.2.0__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyprefab-0.2.0 → pyprefab-0.3.0}/.github/workflows/publish-pypi.yml +0 -1
- pyprefab-0.3.0/PKG-INFO +123 -0
- pyprefab-0.3.0/README.md +107 -0
- {pyprefab-0.2.0 → pyprefab-0.3.0}/pyproject.toml +19 -5
- pyprefab-0.3.0/src/pyprefab/__init__.py +32 -0
- pyprefab-0.3.0/src/pyprefab/cli.py +90 -0
- pyprefab-0.3.0/src/pyprefab/templates/.gitignore.j2 +173 -0
- pyprefab-0.3.0/src/pyprefab/templates/.pre-commit-config.yaml.j2 +25 -0
- pyprefab-0.3.0/src/pyprefab/templates/README.md.j2 +4 -0
- pyprefab-0.3.0/src/pyprefab/templates/pyproject.toml.j2 +57 -0
- pyprefab-0.2.0/src/hello_world/util/logs.py → pyprefab-0.3.0/src/pyprefab/templates/src/{{ project_name }}/__init__.py.j2 +7 -15
- pyprefab-0.3.0/src/pyprefab/templates/src/{{ project_name }}/app.py.j2 +13 -0
- pyprefab-0.3.0/src/pyprefab/templates/test/test_app.py +4 -0
- pyprefab-0.3.0/src/pyprefab.egg-info/PKG-INFO +123 -0
- {pyprefab-0.2.0 → pyprefab-0.3.0}/src/pyprefab.egg-info/SOURCES.txt +10 -7
- pyprefab-0.3.0/src/pyprefab.egg-info/entry_points.txt +2 -0
- pyprefab-0.3.0/src/pyprefab.egg-info/requires.txt +4 -0
- pyprefab-0.3.0/src/pyprefab.egg-info/top_level.txt +1 -0
- pyprefab-0.3.0/test/test_pyprefab.py +2 -0
- {pyprefab-0.2.0 → pyprefab-0.3.0}/uv.lock +151 -31
- pyprefab-0.2.0/PKG-INFO +0 -82
- pyprefab-0.2.0/README.md +0 -68
- pyprefab-0.2.0/src/hello_world/__init__.py +0 -1
- pyprefab-0.2.0/src/hello_world/app.py +0 -20
- pyprefab-0.2.0/src/hello_world/util/__init__.py +0 -0
- pyprefab-0.2.0/src/hello_world/util/date.py +0 -15
- pyprefab-0.2.0/src/pyprefab.egg-info/PKG-INFO +0 -82
- pyprefab-0.2.0/src/pyprefab.egg-info/entry_points.txt +0 -2
- pyprefab-0.2.0/src/pyprefab.egg-info/requires.txt +0 -2
- pyprefab-0.2.0/src/pyprefab.egg-info/top_level.txt +0 -1
- pyprefab-0.2.0/tests/hello_world/test_app.py +0 -9
- pyprefab-0.2.0/tests/hello_world/unit/util/test_date.py +0 -11
- {pyprefab-0.2.0 → pyprefab-0.3.0}/.github/workflows/publish-pypi-test.yml +0 -0
- {pyprefab-0.2.0 → pyprefab-0.3.0}/.github/workflows/pythonapp-workflow.yml +0 -0
- {pyprefab-0.2.0 → pyprefab-0.3.0}/.gitignore +0 -0
- {pyprefab-0.2.0 → pyprefab-0.3.0}/.pre-commit-config.yaml +0 -0
- {pyprefab-0.2.0 → pyprefab-0.3.0}/.python-version +0 -0
- {pyprefab-0.2.0 → pyprefab-0.3.0}/LICENSE +0 -0
- {pyprefab-0.2.0 → pyprefab-0.3.0}/setup.cfg +0 -0
- {pyprefab-0.2.0 → pyprefab-0.3.0}/src/pyprefab.egg-info/dependency_links.txt +0 -0
pyprefab-0.3.0/PKG-INFO
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: pyprefab
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Python application template for personal use
|
|
5
|
+
License: MIT License
|
|
6
|
+
Project-URL: Repository, https://github.com/bsweger/pyprefab.git
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Requires-Python: >=3.9
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: structlog
|
|
13
|
+
Requires-Dist: rich
|
|
14
|
+
Requires-Dist: typer
|
|
15
|
+
Requires-Dist: jinja2>=3.1.5
|
|
16
|
+
|
|
17
|
+
# pyprefab
|
|
18
|
+
|
|
19
|
+
Creates a new Python package from an opinioned set of templates.
|
|
20
|
+
|
|
21
|
+
## Installing pyprefab
|
|
22
|
+
|
|
23
|
+
To install this package via pip:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install pyprefab
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Generating boilerplate for a new Python package
|
|
30
|
+
|
|
31
|
+
Use pyprefab's command line interface to create a new Python package:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
➜ pyprefab-create --help
|
|
35
|
+
|
|
36
|
+
Usage: pyprefab-create [OPTIONS] NAME
|
|
37
|
+
|
|
38
|
+
Generate a new Python project from templates.
|
|
39
|
+
|
|
40
|
+
╭─ Arguments ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
|
|
41
|
+
│ * name TEXT Name of the project [default: None] [required] │
|
|
42
|
+
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
|
43
|
+
╭─ Options ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
|
|
44
|
+
│ * --author TEXT Project author [default: None] [required] │
|
|
45
|
+
│ --description TEXT Project description │
|
|
46
|
+
│ --directory PATH Directory that will contain the project (defaults to current directory) [default: None] │
|
|
47
|
+
│ --install-completion Install completion for the current shell. │
|
|
48
|
+
│ --show-completion Show completion for the current shell, to copy it or customize the installation. │
|
|
49
|
+
│ --help Show this message and exit. │
|
|
50
|
+
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
For example:
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
pyprefab-create project_test --author lassie --description "this is a pet project for lassie" --directory ~/code/lassie
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Setting up the package's dev environment
|
|
60
|
+
|
|
61
|
+
Follow the steps below to create a development environment for the package.
|
|
62
|
+
|
|
63
|
+
These directions use `uv`, but you can use your preferred tooling.
|
|
64
|
+
|
|
65
|
+
1. `cd` to the directory of the new Python package
|
|
66
|
+
|
|
67
|
+
2. Create a virtual environment seeded with pip:
|
|
68
|
+
|
|
69
|
+
```script
|
|
70
|
+
uv venv --seed
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
3. Install dependencies + project as editable module
|
|
74
|
+
|
|
75
|
+
```script
|
|
76
|
+
uv sync
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
4. Test the project setupt:
|
|
80
|
+
|
|
81
|
+
```script
|
|
82
|
+
uv run <your_package_name>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
You should see a log output stating that the project has been set up correctly.
|
|
86
|
+
|
|
87
|
+
For example:
|
|
88
|
+
`2025-01-13 02:29:08 [info ] project_test successfully created.`
|
|
89
|
+
|
|
90
|
+
You can also run the tests:
|
|
91
|
+
|
|
92
|
+
```script
|
|
93
|
+
uv run pytest
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Note:** `uv run` runs commands in the virtual environment created by uv
|
|
97
|
+
(see step 2). Alternately, you can activate the virtual environment the
|
|
98
|
+
old-fashioned way and then run commands without the `uv run` prefix:
|
|
99
|
+
|
|
100
|
+
```script
|
|
101
|
+
source .venv/bin/activate
|
|
102
|
+
<your package name>
|
|
103
|
+
pytest
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**Optional:**
|
|
107
|
+
|
|
108
|
+
- Add the new project to a git repository:
|
|
109
|
+
|
|
110
|
+
```script
|
|
111
|
+
git init
|
|
112
|
+
git add .
|
|
113
|
+
git commit -am "Initial commit"
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
- If you use [pre-commit](https://pre-commit.com/), pyprefab's boilerplate
|
|
117
|
+
includes a baseline `pre-commit-config.yaml` configuration. To use it, make
|
|
118
|
+
sure the project has been added to git (see above) and run the following
|
|
119
|
+
command to install the pre-commit git hook scripts:
|
|
120
|
+
|
|
121
|
+
```script
|
|
122
|
+
pre-commit install
|
|
123
|
+
```
|
pyprefab-0.3.0/README.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# pyprefab
|
|
2
|
+
|
|
3
|
+
Creates a new Python package from an opinioned set of templates.
|
|
4
|
+
|
|
5
|
+
## Installing pyprefab
|
|
6
|
+
|
|
7
|
+
To install this package via pip:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install pyprefab
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Generating boilerplate for a new Python package
|
|
14
|
+
|
|
15
|
+
Use pyprefab's command line interface to create a new Python package:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
➜ pyprefab-create --help
|
|
19
|
+
|
|
20
|
+
Usage: pyprefab-create [OPTIONS] NAME
|
|
21
|
+
|
|
22
|
+
Generate a new Python project from templates.
|
|
23
|
+
|
|
24
|
+
╭─ Arguments ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
|
|
25
|
+
│ * name TEXT Name of the project [default: None] [required] │
|
|
26
|
+
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
|
27
|
+
╭─ Options ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
|
|
28
|
+
│ * --author TEXT Project author [default: None] [required] │
|
|
29
|
+
│ --description TEXT Project description │
|
|
30
|
+
│ --directory PATH Directory that will contain the project (defaults to current directory) [default: None] │
|
|
31
|
+
│ --install-completion Install completion for the current shell. │
|
|
32
|
+
│ --show-completion Show completion for the current shell, to copy it or customize the installation. │
|
|
33
|
+
│ --help Show this message and exit. │
|
|
34
|
+
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
For example:
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
pyprefab-create project_test --author lassie --description "this is a pet project for lassie" --directory ~/code/lassie
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Setting up the package's dev environment
|
|
44
|
+
|
|
45
|
+
Follow the steps below to create a development environment for the package.
|
|
46
|
+
|
|
47
|
+
These directions use `uv`, but you can use your preferred tooling.
|
|
48
|
+
|
|
49
|
+
1. `cd` to the directory of the new Python package
|
|
50
|
+
|
|
51
|
+
2. Create a virtual environment seeded with pip:
|
|
52
|
+
|
|
53
|
+
```script
|
|
54
|
+
uv venv --seed
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
3. Install dependencies + project as editable module
|
|
58
|
+
|
|
59
|
+
```script
|
|
60
|
+
uv sync
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
4. Test the project setupt:
|
|
64
|
+
|
|
65
|
+
```script
|
|
66
|
+
uv run <your_package_name>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
You should see a log output stating that the project has been set up correctly.
|
|
70
|
+
|
|
71
|
+
For example:
|
|
72
|
+
`2025-01-13 02:29:08 [info ] project_test successfully created.`
|
|
73
|
+
|
|
74
|
+
You can also run the tests:
|
|
75
|
+
|
|
76
|
+
```script
|
|
77
|
+
uv run pytest
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**Note:** `uv run` runs commands in the virtual environment created by uv
|
|
81
|
+
(see step 2). Alternately, you can activate the virtual environment the
|
|
82
|
+
old-fashioned way and then run commands without the `uv run` prefix:
|
|
83
|
+
|
|
84
|
+
```script
|
|
85
|
+
source .venv/bin/activate
|
|
86
|
+
<your package name>
|
|
87
|
+
pytest
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Optional:**
|
|
91
|
+
|
|
92
|
+
- Add the new project to a git repository:
|
|
93
|
+
|
|
94
|
+
```script
|
|
95
|
+
git init
|
|
96
|
+
git add .
|
|
97
|
+
git commit -am "Initial commit"
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
- If you use [pre-commit](https://pre-commit.com/), pyprefab's boilerplate
|
|
101
|
+
includes a baseline `pre-commit-config.yaml` configuration. To use it, make
|
|
102
|
+
sure the project has been added to git (see above) and run the following
|
|
103
|
+
command to install the pre-commit git hook scripts:
|
|
104
|
+
|
|
105
|
+
```script
|
|
106
|
+
pre-commit install
|
|
107
|
+
```
|
|
@@ -13,6 +13,8 @@ dynamic = ['version']
|
|
|
13
13
|
dependencies = [
|
|
14
14
|
'structlog',
|
|
15
15
|
'rich',
|
|
16
|
+
"typer",
|
|
17
|
+
"jinja2>=3.1.5",
|
|
16
18
|
]
|
|
17
19
|
|
|
18
20
|
[dependency-groups]
|
|
@@ -26,33 +28,39 @@ dev = [
|
|
|
26
28
|
'ruff',
|
|
27
29
|
]
|
|
28
30
|
|
|
31
|
+
[project.scripts]
|
|
32
|
+
pyprefab-create = "pyprefab.cli:app"
|
|
33
|
+
|
|
29
34
|
[project.urls]
|
|
30
35
|
Repository = "https://github.com/bsweger/pyprefab.git"
|
|
31
36
|
|
|
32
37
|
[project.entry-points.'console_scripts']
|
|
33
|
-
|
|
38
|
+
pyprefab = 'pyprefab.app:main'
|
|
34
39
|
|
|
35
40
|
[build-system]
|
|
36
41
|
# Minimum requirements for the build system to execute.
|
|
37
|
-
requires = ['setuptools', 'wheel', "setuptools_scm>=8"]
|
|
42
|
+
requires = ['setuptools>=45', 'wheel', "setuptools_scm>=8"]
|
|
38
43
|
build-backend = "setuptools.build_meta"
|
|
39
44
|
|
|
40
45
|
[tool.setuptools.packages.find]
|
|
41
46
|
namespaces = true
|
|
42
47
|
where = ["src"]
|
|
43
48
|
|
|
49
|
+
[tool.setuptools.package-data]
|
|
50
|
+
"pyprojgen.templates" = ["*.j2", "*.jinja2", "*"]
|
|
51
|
+
|
|
44
52
|
[tool.setuptools_scm]
|
|
45
53
|
local_scheme = "no-local-version"
|
|
46
54
|
|
|
47
|
-
[tool.
|
|
55
|
+
[tool.pyprefab]
|
|
48
56
|
# to write json-formatted logs to disk, uncomment the following line specify the file location
|
|
49
|
-
# log_file = '/path/to/logs/files/
|
|
57
|
+
# log_file = '/path/to/logs/files/pyprefab.log'
|
|
50
58
|
|
|
51
59
|
[tool.pytest.ini_options]
|
|
52
60
|
addopts = "--random-order"
|
|
53
61
|
tmp_path_retention_policy = "none"
|
|
54
62
|
testpaths = [
|
|
55
|
-
"
|
|
63
|
+
"test",
|
|
56
64
|
]
|
|
57
65
|
|
|
58
66
|
[tool.ruff]
|
|
@@ -64,3 +72,9 @@ inline-quotes = 'single'
|
|
|
64
72
|
|
|
65
73
|
[tool.ruff.format]
|
|
66
74
|
quote-style = 'single'
|
|
75
|
+
|
|
76
|
+
[tool.uv]
|
|
77
|
+
# ensure setuptools_scm generates a version number that reflects latest tags
|
|
78
|
+
# https://docs.astral.sh/uv/concepts/cache/#dynamic-metadata
|
|
79
|
+
cache-keys = [{ git = { commit = true, tags = true } }]
|
|
80
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""pyprefab initialization."""
|
|
2
|
+
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
import structlog
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def setup_logging():
|
|
9
|
+
shared_processors = [
|
|
10
|
+
structlog.processors.TimeStamper(fmt='%Y-%m-%d %H:%M:%S'),
|
|
11
|
+
structlog.processors.add_log_level,
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
if sys.stderr.isatty():
|
|
15
|
+
# If we're in a terminal, pretty print the logs.
|
|
16
|
+
processors = shared_processors + [
|
|
17
|
+
structlog.dev.ConsoleRenderer(),
|
|
18
|
+
]
|
|
19
|
+
else:
|
|
20
|
+
# Otherwise, output logs in JSON format
|
|
21
|
+
processors = shared_processors + [
|
|
22
|
+
structlog.processors.dict_tracebacks,
|
|
23
|
+
structlog.processors.JSONRenderer(),
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
structlog.configure(
|
|
27
|
+
processors=processors,
|
|
28
|
+
cache_logger_on_first_use=True,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
setup_logging()
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"""Command-line interface for the pyprefab package."""
|
|
2
|
+
import shutil
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Optional
|
|
5
|
+
|
|
6
|
+
import typer
|
|
7
|
+
from jinja2 import Environment, FileSystemLoader
|
|
8
|
+
from rich import print
|
|
9
|
+
from rich.panel import Panel
|
|
10
|
+
|
|
11
|
+
app = typer.Typer(help='Generate python project scaffolding based on pyprefab.')
|
|
12
|
+
|
|
13
|
+
def validate_project_name(name: str) -> bool:
|
|
14
|
+
"""Validate project name follows Python package naming conventions."""
|
|
15
|
+
return name.isidentifier() and name.islower()
|
|
16
|
+
|
|
17
|
+
@app.command()
|
|
18
|
+
def create(
|
|
19
|
+
name: str = typer.Argument(..., help='Name of the project'),
|
|
20
|
+
author: str = typer.Option(..., '--author', help='Project author'),
|
|
21
|
+
description: str = typer.Option('', '--description', help='Project description'),
|
|
22
|
+
project_dir: Optional[Path] = typer.Option(
|
|
23
|
+
None, '--directory', help='Directory that will contain the project (defaults to current directory)'
|
|
24
|
+
),
|
|
25
|
+
):
|
|
26
|
+
"""Generate a new Python project from templates."""
|
|
27
|
+
if not validate_project_name(name):
|
|
28
|
+
typer.secho(
|
|
29
|
+
f'Error: {name} is not a valid Python package name',
|
|
30
|
+
fg=typer.colors.RED,
|
|
31
|
+
)
|
|
32
|
+
raise typer.Exit(1)
|
|
33
|
+
|
|
34
|
+
templates_dir = Path(__file__).parent / 'templates'
|
|
35
|
+
target_dir = project_dir or Path.cwd() / name
|
|
36
|
+
|
|
37
|
+
try:
|
|
38
|
+
# Create project directory
|
|
39
|
+
target_dir.mkdir(parents=True, exist_ok=True)
|
|
40
|
+
|
|
41
|
+
# Template context
|
|
42
|
+
context = {
|
|
43
|
+
'project_name': name,
|
|
44
|
+
'author': author,
|
|
45
|
+
'description': description,
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
# Process templates
|
|
49
|
+
env = Environment(loader=FileSystemLoader(templates_dir))
|
|
50
|
+
path_env = Environment() # For rendering path names
|
|
51
|
+
#env = Environment(loader=FileSystemLoader(templates_dir))
|
|
52
|
+
for template_file in templates_dir.rglob('*'):
|
|
53
|
+
if template_file.is_file():
|
|
54
|
+
rel_path = template_file.relative_to(templates_dir)
|
|
55
|
+
template = env.get_template(str(rel_path))
|
|
56
|
+
output = template.render(**context)
|
|
57
|
+
|
|
58
|
+
# Process path parts through Jinja
|
|
59
|
+
path_parts = []
|
|
60
|
+
for part in rel_path.parts:
|
|
61
|
+
# Render each path component through Jinja
|
|
62
|
+
rendered_part = path_env.from_string(part).render(**context)
|
|
63
|
+
if rendered_part.endswith('.j2'):
|
|
64
|
+
rendered_part = rendered_part[:-3]
|
|
65
|
+
path_parts.append(rendered_part)
|
|
66
|
+
|
|
67
|
+
# Create destination path preserving structure
|
|
68
|
+
dest_file = target_dir.joinpath(*path_parts)
|
|
69
|
+
dest_file.parent.mkdir(parents=True, exist_ok=True)
|
|
70
|
+
dest_file.write_text(output)
|
|
71
|
+
|
|
72
|
+
print(Panel.fit(
|
|
73
|
+
f'✨ Created new project [bold green]{name}[/] in {target_dir}\n'
|
|
74
|
+
f'Author: [blue]{author}[/]\n'
|
|
75
|
+
f'Description: {description}',
|
|
76
|
+
title='Project Created Successfully',
|
|
77
|
+
border_style='green',
|
|
78
|
+
))
|
|
79
|
+
|
|
80
|
+
except Exception as e:
|
|
81
|
+
typer.secho(f'Error creating project: {str(e)}', fg=typer.colors.RED)
|
|
82
|
+
if target_dir.exists():
|
|
83
|
+
shutil.rmtree(target_dir)
|
|
84
|
+
raise typer.Exit(1)
|
|
85
|
+
|
|
86
|
+
def main():
|
|
87
|
+
app()
|
|
88
|
+
|
|
89
|
+
if __name__ == '__main__':
|
|
90
|
+
main()
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
**/.DS_Store
|
|
2
|
+
|
|
3
|
+
# Byte-compiled / optimized / DLL files
|
|
4
|
+
__pycache__/
|
|
5
|
+
*.py[cod]
|
|
6
|
+
*$py.class
|
|
7
|
+
|
|
8
|
+
# C extensions
|
|
9
|
+
*.so
|
|
10
|
+
|
|
11
|
+
# Distribution / packaging
|
|
12
|
+
.Python
|
|
13
|
+
build/
|
|
14
|
+
develop-eggs/
|
|
15
|
+
dist/
|
|
16
|
+
downloads/
|
|
17
|
+
eggs/
|
|
18
|
+
.eggs/
|
|
19
|
+
lib/
|
|
20
|
+
lib64/
|
|
21
|
+
parts/
|
|
22
|
+
sdist/
|
|
23
|
+
var/
|
|
24
|
+
wheels/
|
|
25
|
+
share/python-wheels/
|
|
26
|
+
*.egg-info/
|
|
27
|
+
.installed.cfg
|
|
28
|
+
*.egg
|
|
29
|
+
MANIFEST
|
|
30
|
+
|
|
31
|
+
# PyInstaller
|
|
32
|
+
# Usually these files are written by a python script from a template
|
|
33
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
34
|
+
*.manifest
|
|
35
|
+
*.spec
|
|
36
|
+
|
|
37
|
+
# Installer logs
|
|
38
|
+
pip-log.txt
|
|
39
|
+
pip-delete-this-directory.txt
|
|
40
|
+
|
|
41
|
+
# Unit test / coverage reports
|
|
42
|
+
htmlcov/
|
|
43
|
+
.tox/
|
|
44
|
+
.nox/
|
|
45
|
+
.coverage
|
|
46
|
+
.coverage.*
|
|
47
|
+
.cache
|
|
48
|
+
nosetests.xml
|
|
49
|
+
coverage.xml
|
|
50
|
+
*.cover
|
|
51
|
+
*.py,cover
|
|
52
|
+
.hypothesis/
|
|
53
|
+
.pytest_cache/
|
|
54
|
+
cover/
|
|
55
|
+
|
|
56
|
+
# Translations
|
|
57
|
+
*.mo
|
|
58
|
+
*.pot
|
|
59
|
+
|
|
60
|
+
# Django stuff:
|
|
61
|
+
*.log
|
|
62
|
+
local_settings.py
|
|
63
|
+
db.sqlite3
|
|
64
|
+
db.sqlite3-journal
|
|
65
|
+
|
|
66
|
+
# Flask stuff:
|
|
67
|
+
instance/
|
|
68
|
+
.webassets-cache
|
|
69
|
+
|
|
70
|
+
# Scrapy stuff:
|
|
71
|
+
.scrapy
|
|
72
|
+
|
|
73
|
+
# Sphinx documentation
|
|
74
|
+
docs/_build/
|
|
75
|
+
|
|
76
|
+
# PyBuilder
|
|
77
|
+
.pybuilder/
|
|
78
|
+
target/
|
|
79
|
+
|
|
80
|
+
# Jupyter Notebook
|
|
81
|
+
.ipynb_checkpoints
|
|
82
|
+
|
|
83
|
+
# IPython
|
|
84
|
+
profile_default/
|
|
85
|
+
ipython_config.py
|
|
86
|
+
|
|
87
|
+
# pyenv
|
|
88
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
89
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
90
|
+
# .python-version
|
|
91
|
+
|
|
92
|
+
# pipenv
|
|
93
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
94
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
95
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
96
|
+
# install all needed dependencies.
|
|
97
|
+
#Pipfile.lock
|
|
98
|
+
|
|
99
|
+
# poetry
|
|
100
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
101
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
102
|
+
# commonly ignored for libraries.
|
|
103
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
104
|
+
#poetry.lock
|
|
105
|
+
|
|
106
|
+
# pdm
|
|
107
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
108
|
+
#pdm.lock
|
|
109
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
110
|
+
# in version control.
|
|
111
|
+
# https://pdm.fming.dev/#use-with-ide
|
|
112
|
+
.pdm.toml
|
|
113
|
+
|
|
114
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
115
|
+
__pypackages__/
|
|
116
|
+
|
|
117
|
+
# Celery stuff
|
|
118
|
+
celerybeat-schedule
|
|
119
|
+
celerybeat.pid
|
|
120
|
+
|
|
121
|
+
# SageMath parsed files
|
|
122
|
+
*.sage.py
|
|
123
|
+
|
|
124
|
+
# Environments
|
|
125
|
+
.env
|
|
126
|
+
.venv
|
|
127
|
+
env/
|
|
128
|
+
venv/
|
|
129
|
+
ENV/
|
|
130
|
+
env.bak/
|
|
131
|
+
venv.bak/
|
|
132
|
+
|
|
133
|
+
# pdm
|
|
134
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
135
|
+
#pdm.lock
|
|
136
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
137
|
+
# in version control.
|
|
138
|
+
# https://pdm.fming.dev/#use-with-ide
|
|
139
|
+
.pdm.toml
|
|
140
|
+
.pdm-python
|
|
141
|
+
.pdm-build/
|
|
142
|
+
|
|
143
|
+
# Spyder project settings
|
|
144
|
+
.spyderproject
|
|
145
|
+
.spyproject
|
|
146
|
+
|
|
147
|
+
# Rope project settings
|
|
148
|
+
.ropeproject
|
|
149
|
+
|
|
150
|
+
# mkdocs documentation
|
|
151
|
+
/site
|
|
152
|
+
|
|
153
|
+
# mypy
|
|
154
|
+
.mypy_cache/
|
|
155
|
+
.dmypy.json
|
|
156
|
+
dmypy.json
|
|
157
|
+
|
|
158
|
+
# Pyre type checker
|
|
159
|
+
.pyre/
|
|
160
|
+
|
|
161
|
+
# pytype static type analyzer
|
|
162
|
+
.pytype/
|
|
163
|
+
|
|
164
|
+
# Cython debug symbols
|
|
165
|
+
cython_debug/
|
|
166
|
+
|
|
167
|
+
# PyCharm
|
|
168
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
169
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
170
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
171
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
172
|
+
#.idea/
|
|
173
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
3
|
+
# Ruff version.
|
|
4
|
+
rev: v0.9.1
|
|
5
|
+
hooks:
|
|
6
|
+
# Run the linter.
|
|
7
|
+
- id: ruff
|
|
8
|
+
args: [ --fix ]
|
|
9
|
+
# Run the formatter.
|
|
10
|
+
- id: ruff-format
|
|
11
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
12
|
+
rev: v5.0.0
|
|
13
|
+
hooks:
|
|
14
|
+
- id: trailing-whitespace
|
|
15
|
+
- id: check-yaml
|
|
16
|
+
args: [--allow-multiple-documents]
|
|
17
|
+
- id: detect-aws-credentials
|
|
18
|
+
args: [--allow-missing-credentials]
|
|
19
|
+
- id: detect-private-key
|
|
20
|
+
- repo: https://github.com/codespell-project/codespell
|
|
21
|
+
rev: v2.3.0
|
|
22
|
+
hooks:
|
|
23
|
+
- id: codespell
|
|
24
|
+
|
|
25
|
+
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = '{{ project_name }}'
|
|
3
|
+
dynamic = ['version']
|
|
4
|
+
description = '{{ description }}'
|
|
5
|
+
authors = [{name = '{{ author }}'}]
|
|
6
|
+
maintainers = [{name = '{{ author }}'}]
|
|
7
|
+
license = {text = 'MIT License'}
|
|
8
|
+
|
|
9
|
+
requires-python = '>=3.9'
|
|
10
|
+
readme = 'README.md'
|
|
11
|
+
|
|
12
|
+
dependencies = [
|
|
13
|
+
'structlog',
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
[dependency-groups]
|
|
17
|
+
dev = [
|
|
18
|
+
'coverage',
|
|
19
|
+
'pre-commit',
|
|
20
|
+
'pytest',
|
|
21
|
+
'pytest-random-order>=1.1.1',
|
|
22
|
+
'ruff',
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[project.scripts]
|
|
26
|
+
{{ project_name }} = '{{ project_name }}.app:main'
|
|
27
|
+
|
|
28
|
+
[project.urls]
|
|
29
|
+
|
|
30
|
+
[build-system]
|
|
31
|
+
requires = ['setuptools>=45', 'wheel', 'setuptools_scm>=8']
|
|
32
|
+
build-backend = 'setuptools.build_meta'
|
|
33
|
+
|
|
34
|
+
[tool.setuptools.packages.find]
|
|
35
|
+
namespaces = true
|
|
36
|
+
where = ['src']
|
|
37
|
+
|
|
38
|
+
[tool.setuptools_scm]
|
|
39
|
+
fallback_version = '0.0.0.dev0'
|
|
40
|
+
local_scheme = 'no-local-version'
|
|
41
|
+
|
|
42
|
+
[tool.pytest.ini_options]
|
|
43
|
+
addopts = '--random-order'
|
|
44
|
+
testpaths = [
|
|
45
|
+
'test',
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
[tool.ruff]
|
|
49
|
+
line-length = 120
|
|
50
|
+
lint.extend-select = ['I', 'Q']
|
|
51
|
+
|
|
52
|
+
[tool.ruff.lint.flake8-quotes]
|
|
53
|
+
inline-quotes = 'single'
|
|
54
|
+
|
|
55
|
+
[tool.ruff.format]
|
|
56
|
+
quote-style = 'single'
|
|
57
|
+
|