create-pyproj 2.0.0__tar.gz → 2.2.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.
Files changed (103) hide show
  1. create_pyproj-2.2.0/PKG-INFO +124 -0
  2. create_pyproj-2.2.0/README.md +116 -0
  3. create_pyproj-2.2.0/pyproject.toml +91 -0
  4. create_pyproj-2.2.0/pyproject.toml.orig +75 -0
  5. create_pyproj-2.2.0/src/create_pyproj/__init__.py +5 -0
  6. create_pyproj-2.2.0/src/create_pyproj/main.py +135 -0
  7. create_pyproj-2.2.0/src/create_pyproj/scaffold.py +177 -0
  8. create_pyproj-2.2.0/src/create_pyproj/templater.py +99 -0
  9. create_pyproj-2.2.0/src/create_pyproj/templates/base/.env.example.tmpl +1 -0
  10. create_pyproj-2.2.0/src/create_pyproj/templates/base/.gitignore.tmpl +17 -0
  11. create_pyproj-2.2.0/src/create_pyproj/templates/base/.pre-commit-config.yaml.tmpl +20 -0
  12. create_pyproj-2.2.0/src/create_pyproj/templates/base/.python-version.tmpl +1 -0
  13. create_pyproj-2.2.0/src/create_pyproj/templates/base/.vscode/extensions.json.tmpl +7 -0
  14. create_pyproj-2.2.0/src/create_pyproj/templates/base/.vscode/settings.json.tmpl +22 -0
  15. create_pyproj-2.2.0/src/create_pyproj/templates/base/AGENTS.md.tmpl +42 -0
  16. create_pyproj-2.2.0/src/create_pyproj/templates/base/README.md.tmpl +155 -0
  17. create_pyproj-2.2.0/src/create_pyproj/templates/base/docs/api.md.tmpl +35 -0
  18. create_pyproj-2.2.0/src/create_pyproj/templates/base/docs/approach.md.tmpl +97 -0
  19. create_pyproj-2.2.0/src/create_pyproj/templates/base/docs/data-models.md.tmpl +6 -0
  20. create_pyproj-2.2.0/src/create_pyproj/templates/base/docs/domain-map.yml.tmpl +8 -0
  21. create_pyproj-2.2.0/src/create_pyproj/templates/base/docs/domain-model.md.tmpl +8 -0
  22. create_pyproj-2.2.0/src/create_pyproj/templates/base/docs/implementation.md.tmpl +27 -0
  23. create_pyproj-2.2.0/src/create_pyproj/templates/base/docs/index.md.tmpl +21 -0
  24. create_pyproj-2.2.0/src/create_pyproj/templates/base/docs/references.md.tmpl +6 -0
  25. create_pyproj-2.2.0/src/create_pyproj/templates/base/docs/topology.md.tmpl +24 -0
  26. create_pyproj-2.2.0/src/create_pyproj/templates/base/docs/use-cases.md.tmpl +6 -0
  27. create_pyproj-2.2.0/src/create_pyproj/templates/base/mise.toml.tmpl +63 -0
  28. create_pyproj-2.2.0/src/create_pyproj/templates/base/mkdocs.yml.tmpl +14 -0
  29. create_pyproj-2.2.0/src/create_pyproj/templates/base/pyproject.toml.tmpl +91 -0
  30. create_pyproj-2.2.0/src/create_pyproj/templates/base/renovate.json.tmpl +52 -0
  31. create_pyproj-2.2.0/src/create_pyproj/templates/base/src/${package_name}/__init__.py.tmpl +5 -0
  32. create_pyproj-2.2.0/src/create_pyproj/templates/base/src/${package_name}/application/__init__.py.tmpl +1 -0
  33. create_pyproj-2.2.0/src/create_pyproj/templates/base/src/${package_name}/domain/__init__.py.tmpl +1 -0
  34. create_pyproj-2.2.0/src/create_pyproj/templates/base/src/${package_name}/infrastructure/__init__.py.tmpl +1 -0
  35. create_pyproj-2.2.0/src/create_pyproj/templates/base/test/test_package.py.tmpl +17 -0
  36. create_pyproj-2.2.0/src/create_pyproj/templates/ci/github/.github/workflows/ci.yml.tmpl +43 -0
  37. create_pyproj-2.2.0/src/create_pyproj/templates/ci/gitlab/.gitlab-ci.yml.tmpl +52 -0
  38. create_pyproj-2.2.0/src/create_pyproj/templates/infra/terraform/terraform/README.md.tmpl +26 -0
  39. create_pyproj-2.2.0/src/create_pyproj/templates/infra/terraform/terraform/_config.tf.tmpl +24 -0
  40. create_pyproj-2.2.0/src/create_pyproj/templates/infra/terraform/terraform/main.tf.tmpl +14 -0
  41. create_pyproj-2.2.0/src/create_pyproj/templates/infra/terraform/terraform/outputs.tf.tmpl +14 -0
  42. create_pyproj-2.2.0/src/create_pyproj/templates/infra/terraform/terraform/variables.tf.tmpl +15 -0
  43. create_pyproj-2.2.0/src/create_pyproj/templates/interfaces/cli/src/${package_name}/cli.py.tmpl +22 -0
  44. create_pyproj-2.2.0/src/create_pyproj/templates/interfaces/cli/src/main.py.tmpl +4 -0
  45. create_pyproj-2.2.0/src/create_pyproj/templates/interfaces/cli/test/test_cli.py.tmpl +26 -0
  46. create_pyproj-2.2.0/src/create_pyproj/templates/interfaces/web/src/${package_name}/ui/__init__.py.tmpl +47 -0
  47. create_pyproj-2.2.0/src/create_pyproj/templates/interfaces/web/src/${package_name}/ui/static/app.css +64 -0
  48. create_pyproj-2.2.0/src/create_pyproj/templates/interfaces/web/src/${package_name}/ui/templates/_greeting.html.tmpl +1 -0
  49. create_pyproj-2.2.0/src/create_pyproj/templates/interfaces/web/src/${package_name}/ui/templates/base.html.tmpl +17 -0
  50. create_pyproj-2.2.0/src/create_pyproj/templates/interfaces/web/src/${package_name}/ui/templates/index.html.tmpl +11 -0
  51. create_pyproj-2.2.0/src/create_pyproj/templates/interfaces/web/src/${package_name}/web.py.tmpl +26 -0
  52. create_pyproj-2.2.0/src/create_pyproj/templates/interfaces/web/test/test_web.py.tmpl +66 -0
  53. create_pyproj-2.2.0/src/create_pyproj/versions.py +68 -0
  54. create-pyproj-2.0.0/LICENSE +0 -21
  55. create-pyproj-2.0.0/MANIFEST.in +0 -5
  56. create-pyproj-2.0.0/PKG-INFO +0 -30
  57. create-pyproj-2.0.0/VERSION +0 -1
  58. create-pyproj-2.0.0/pyproject.toml +0 -51
  59. create-pyproj-2.0.0/setup.cfg +0 -4
  60. create-pyproj-2.0.0/src/__init__.py +0 -1
  61. create-pyproj-2.0.0/src/create_pyproj/__init__.py +0 -3
  62. create-pyproj-2.0.0/src/create_pyproj/_config/__init__.py +0 -4
  63. create-pyproj-2.0.0/src/create_pyproj/_config/logger.py +0 -41
  64. create-pyproj-2.0.0/src/create_pyproj/_config/logging.yaml +0 -33
  65. create-pyproj-2.0.0/src/create_pyproj/_config/version.py +0 -10
  66. create-pyproj-2.0.0/src/create_pyproj/code/__init__.py.tmpl +0 -5
  67. create-pyproj-2.0.0/src/create_pyproj/code/_config/__init__.py +0 -10
  68. create-pyproj-2.0.0/src/create_pyproj/code/_config/logger.py +0 -58
  69. create-pyproj-2.0.0/src/create_pyproj/code/_config/logging.yaml +0 -33
  70. create-pyproj-2.0.0/src/create_pyproj/code/_config/settings.py +0 -57
  71. create-pyproj-2.0.0/src/create_pyproj/code/_config/version.py +0 -12
  72. create-pyproj-2.0.0/src/create_pyproj/code/main.py.tmpl +0 -54
  73. create-pyproj-2.0.0/src/create_pyproj/code/scripts/__init__.py +0 -0
  74. create-pyproj-2.0.0/src/create_pyproj/code/scripts/pre_commit.py +0 -53
  75. create-pyproj-2.0.0/src/create_pyproj/code/settings.yaml +0 -1
  76. create-pyproj-2.0.0/src/create_pyproj/code/test/__init__.py +0 -1
  77. create-pyproj-2.0.0/src/create_pyproj/code/test/conftest.py +0 -0
  78. create-pyproj-2.0.0/src/create_pyproj/code/test/test_main.py +0 -7
  79. create-pyproj-2.0.0/src/create_pyproj/createfile.py +0 -99
  80. create-pyproj-2.0.0/src/create_pyproj/figlet.py +0 -6
  81. create-pyproj-2.0.0/src/create_pyproj/initialise.py +0 -29
  82. create-pyproj-2.0.0/src/create_pyproj/main.py +0 -89
  83. create-pyproj-2.0.0/src/create_pyproj/templater.py +0 -37
  84. create-pyproj-2.0.0/src/create_pyproj/templates/package/LICENSE.tmpl +0 -21
  85. create-pyproj-2.0.0/src/create_pyproj/templates/package/MANIFEST.in.tmpl +0 -6
  86. create-pyproj-2.0.0/src/create_pyproj/templates/package/pyproject.toml.tmpl +0 -45
  87. create-pyproj-2.0.0/src/create_pyproj/templates/project/.env.tmpl +0 -1
  88. create-pyproj-2.0.0/src/create_pyproj/templates/project/.flake8.tmpl +0 -3
  89. create-pyproj-2.0.0/src/create_pyproj/templates/project/.gitignore.tmpl +0 -15
  90. create-pyproj-2.0.0/src/create_pyproj/templates/project/.gitlab-ci.yml.tmpl +0 -18
  91. create-pyproj-2.0.0/src/create_pyproj/templates/project/.pre-commit-config.yaml.tmpl +0 -19
  92. create-pyproj-2.0.0/src/create_pyproj/templates/project/Pipfile.tmpl +0 -28
  93. create-pyproj-2.0.0/src/create_pyproj/templates/project/README.md.tmpl +0 -110
  94. create-pyproj-2.0.0/src/create_pyproj/templates/project/VERSION.tmpl +0 -1
  95. create-pyproj-2.0.0/src/create_pyproj/templates/vscode/extensions.json.tmpl +0 -13
  96. create-pyproj-2.0.0/src/create_pyproj/templates/vscode/launch.json.tmpl +0 -27
  97. create-pyproj-2.0.0/src/create_pyproj/templates/vscode/settings.json.tmpl +0 -25
  98. create-pyproj-2.0.0/src/create_pyproj.egg-info/PKG-INFO +0 -30
  99. create-pyproj-2.0.0/src/create_pyproj.egg-info/SOURCES.txt +0 -48
  100. create-pyproj-2.0.0/src/create_pyproj.egg-info/dependency_links.txt +0 -1
  101. create-pyproj-2.0.0/src/create_pyproj.egg-info/entry_points.txt +0 -2
  102. create-pyproj-2.0.0/src/create_pyproj.egg-info/top_level.txt +0 -2
  103. create-pyproj-2.0.0/test/test_main.py +0 -32
@@ -0,0 +1,124 @@
1
+ Metadata-Version: 2.3
2
+ Name: create-pyproj
3
+ Version: 2.2.0
4
+ Summary: Scaffold uv-first Python projects with a DDD and hexagonal baseline.
5
+ Requires-Dist: mako>=1.3.5
6
+ Requires-Python: >=3.11
7
+ Description-Content-Type: text/markdown
8
+
9
+ # create-pyproj
10
+
11
+ `create-pyproj` scaffolds canonical Python projects with a `uv`-first workflow,
12
+ semantic-release, DDD and hexagonal defaults, optional CLI and web stubs,
13
+ starter MkDocs documentation, and an `AGENTS.md` tuned for the canonical
14
+ engineering skills.
15
+
16
+ ## What It Generates
17
+
18
+ The default scaffold includes:
19
+
20
+ - `.python-version`
21
+ - `pyproject.toml` built with `uv_build`, with `uv`-friendly dependency groups and Ruff configuration
22
+ - `mise.toml` with pinned tools and common tasks; it is the one source for the Python and uv versions, locally and in GitHub CI
23
+ - semantic-release configuration for version stamping in `pyproject.toml` and `src/<package>/__init__.py`
24
+ - `src/<package>` with `domain`, `application`, and `infrastructure` package structure
25
+ - `docs/` plus `mkdocs.yml`
26
+ - `AGENTS.md`
27
+ - `.vscode/`, `.pre-commit-config.yaml`, and `.env.example`
28
+ - `test/` with starter tests for each generated adapter
29
+ - `renovate.json` so Renovate keeps dependencies, tools and hooks current
30
+
31
+ Optional adapters:
32
+
33
+ - `--interface cli` adds an argparse-based CLI stub and console script entrypoint
34
+ - `--interface web` adds a FastAPI application stub plus a server-rendered UI:
35
+ Jinja2 templates and HTMX fragment swaps served by the same app
36
+
37
+ Optional CI:
38
+
39
+ - `--ci github`
40
+ - `--ci gitlab`
41
+
42
+ Both CI options include lint, test, and semantic-release jobs.
43
+
44
+ Optional infrastructure:
45
+
46
+ - `--terraform` adds a starter Terraform deployment skeleton
47
+
48
+ ## Usage
49
+
50
+ ```bash
51
+ create-pyproj demo-app --interface cli --interface web --ci github --terraform --no-install
52
+ ```
53
+
54
+ To install the local repo as a global command with `uv`:
55
+
56
+ ```bash
57
+ uv tool install --force .
58
+ ```
59
+
60
+ Common flags:
61
+
62
+ - `--python-version 3.15` (default: `PYTHON_DEFAULT` in `src/create_pyproj/versions.py`)
63
+ - `--description "Short project summary"`
64
+ - `--author "Your Name"`
65
+ - `--author-email "you@example.com"`
66
+ - `--output-dir /path/to/projects`
67
+ - `--terraform`
68
+ - `--no-git-init`
69
+ - `--no-install`
70
+
71
+ If the target directory already exists, `create-pyproj` will reuse it. Any
72
+ scaffold-managed files with the same path will be overwritten, while unrelated
73
+ existing files and folders are left in place.
74
+
75
+ ## Scaffold Contract
76
+
77
+ The generated project is intended to:
78
+
79
+ - keep the domain and application layers framework-independent
80
+ - make CLI and web adapters optional delivery concerns
81
+ - expose Mise, uv, Ruff, pytest, and pre-commit as the default workflow
82
+ - include semantic-release as the default CI/CD release toolset
83
+ - provide structure without inventing sample business behavior
84
+ - include the same semantic-release approach used elsewhere in this workspace
85
+ - add Terraform only when requested for a deployable service
86
+ - document the architecture and domain through MkDocs
87
+ - include an `AGENTS.md` that points contributors at the canonical skills
88
+
89
+ ## Development
90
+
91
+ ```bash
92
+ mise run setup
93
+ mise run lint
94
+ mise run complexity
95
+ mise run typecheck
96
+ mise run format
97
+ mise run test
98
+ mise run test-e2e
99
+ uv run python -m create_pyproj.main --help
100
+ ```
101
+
102
+ The local test suite verifies the emitted scaffold contract rather than just
103
+ individual template files. `mise run test-e2e` generates a project with every
104
+ option and runs its own gates; it needs the network.
105
+
106
+ ## Keeping Versions Current
107
+
108
+ - `src/create_pyproj/versions.py` holds every version the scaffold emits.
109
+ Templates and the CLI read from it.
110
+ - Renovate (`renovate.json`) updates that file and this repo's own pins, one
111
+ PR per dependency. Minor and patch updates automerge when CI passes.
112
+ - `test/test_versions.py` fails when this repo's pins drift from the scaffold's.
113
+ - The `Freshness` workflow runs weekly: the scaffolder and a generated project
114
+ against the newest packages, on the default Python and the next one.
115
+ - The default Python minor moves by hand under the policy in `AGENTS.md`.
116
+
117
+ ## Docs
118
+
119
+ This repo now includes MkDocs content for `create_pyproj` itself under `docs/`,
120
+ with navigation configured in `mkdocs.yml`.
121
+
122
+ ```bash
123
+ mise run docs
124
+ ```
@@ -0,0 +1,116 @@
1
+ # create-pyproj
2
+
3
+ `create-pyproj` scaffolds canonical Python projects with a `uv`-first workflow,
4
+ semantic-release, DDD and hexagonal defaults, optional CLI and web stubs,
5
+ starter MkDocs documentation, and an `AGENTS.md` tuned for the canonical
6
+ engineering skills.
7
+
8
+ ## What It Generates
9
+
10
+ The default scaffold includes:
11
+
12
+ - `.python-version`
13
+ - `pyproject.toml` built with `uv_build`, with `uv`-friendly dependency groups and Ruff configuration
14
+ - `mise.toml` with pinned tools and common tasks; it is the one source for the Python and uv versions, locally and in GitHub CI
15
+ - semantic-release configuration for version stamping in `pyproject.toml` and `src/<package>/__init__.py`
16
+ - `src/<package>` with `domain`, `application`, and `infrastructure` package structure
17
+ - `docs/` plus `mkdocs.yml`
18
+ - `AGENTS.md`
19
+ - `.vscode/`, `.pre-commit-config.yaml`, and `.env.example`
20
+ - `test/` with starter tests for each generated adapter
21
+ - `renovate.json` so Renovate keeps dependencies, tools and hooks current
22
+
23
+ Optional adapters:
24
+
25
+ - `--interface cli` adds an argparse-based CLI stub and console script entrypoint
26
+ - `--interface web` adds a FastAPI application stub plus a server-rendered UI:
27
+ Jinja2 templates and HTMX fragment swaps served by the same app
28
+
29
+ Optional CI:
30
+
31
+ - `--ci github`
32
+ - `--ci gitlab`
33
+
34
+ Both CI options include lint, test, and semantic-release jobs.
35
+
36
+ Optional infrastructure:
37
+
38
+ - `--terraform` adds a starter Terraform deployment skeleton
39
+
40
+ ## Usage
41
+
42
+ ```bash
43
+ create-pyproj demo-app --interface cli --interface web --ci github --terraform --no-install
44
+ ```
45
+
46
+ To install the local repo as a global command with `uv`:
47
+
48
+ ```bash
49
+ uv tool install --force .
50
+ ```
51
+
52
+ Common flags:
53
+
54
+ - `--python-version 3.15` (default: `PYTHON_DEFAULT` in `src/create_pyproj/versions.py`)
55
+ - `--description "Short project summary"`
56
+ - `--author "Your Name"`
57
+ - `--author-email "you@example.com"`
58
+ - `--output-dir /path/to/projects`
59
+ - `--terraform`
60
+ - `--no-git-init`
61
+ - `--no-install`
62
+
63
+ If the target directory already exists, `create-pyproj` will reuse it. Any
64
+ scaffold-managed files with the same path will be overwritten, while unrelated
65
+ existing files and folders are left in place.
66
+
67
+ ## Scaffold Contract
68
+
69
+ The generated project is intended to:
70
+
71
+ - keep the domain and application layers framework-independent
72
+ - make CLI and web adapters optional delivery concerns
73
+ - expose Mise, uv, Ruff, pytest, and pre-commit as the default workflow
74
+ - include semantic-release as the default CI/CD release toolset
75
+ - provide structure without inventing sample business behavior
76
+ - include the same semantic-release approach used elsewhere in this workspace
77
+ - add Terraform only when requested for a deployable service
78
+ - document the architecture and domain through MkDocs
79
+ - include an `AGENTS.md` that points contributors at the canonical skills
80
+
81
+ ## Development
82
+
83
+ ```bash
84
+ mise run setup
85
+ mise run lint
86
+ mise run complexity
87
+ mise run typecheck
88
+ mise run format
89
+ mise run test
90
+ mise run test-e2e
91
+ uv run python -m create_pyproj.main --help
92
+ ```
93
+
94
+ The local test suite verifies the emitted scaffold contract rather than just
95
+ individual template files. `mise run test-e2e` generates a project with every
96
+ option and runs its own gates; it needs the network.
97
+
98
+ ## Keeping Versions Current
99
+
100
+ - `src/create_pyproj/versions.py` holds every version the scaffold emits.
101
+ Templates and the CLI read from it.
102
+ - Renovate (`renovate.json`) updates that file and this repo's own pins, one
103
+ PR per dependency. Minor and patch updates automerge when CI passes.
104
+ - `test/test_versions.py` fails when this repo's pins drift from the scaffold's.
105
+ - The `Freshness` workflow runs weekly: the scaffolder and a generated project
106
+ against the newest packages, on the default Python and the next one.
107
+ - The default Python minor moves by hand under the policy in `AGENTS.md`.
108
+
109
+ ## Docs
110
+
111
+ This repo now includes MkDocs content for `create_pyproj` itself under `docs/`,
112
+ with navigation configured in `mkdocs.yml`.
113
+
114
+ ```bash
115
+ mise run docs
116
+ ```
@@ -0,0 +1,91 @@
1
+ [build-system]
2
+ requires = ["uv_build>=0.13.8,<0.14"]
3
+ build-backend = "uv_build"
4
+
5
+ [project]
6
+ name = "create-pyproj"
7
+ version = "2.2.0"
8
+ description = "Scaffold uv-first Python projects with a DDD and hexagonal baseline."
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ dependencies = ["mako>=1.3.5"]
12
+
13
+ [project.scripts]
14
+ create-pyproj = "create_pyproj.main:main"
15
+
16
+ [tool.ruff]
17
+ line-length = 88
18
+ target-version = "py311"
19
+
20
+ [tool.ruff.lint]
21
+ select = [
22
+ "E",
23
+ "F",
24
+ "W",
25
+ "I",
26
+ "S",
27
+ "C901",
28
+ ]
29
+ ignore = [
30
+ "E203",
31
+ "E501",
32
+ ]
33
+
34
+ [tool.ruff.lint.mccabe]
35
+ max-complexity = 10
36
+
37
+ [tool.ruff.lint.per-file-ignores]
38
+ "test/**" = ["S101"]
39
+
40
+ [tool.ruff.format]
41
+ docstring-code-format = true
42
+
43
+ [tool.semantic_release]
44
+ commit_message = "chore(release): {version} [skip ci]"
45
+ version_toml = ["pyproject.toml:project.version"]
46
+ version_variables = ["src/create_pyproj/__init__.py:__version__"]
47
+ build_command = "uv lock --upgrade-package create-pyproj && git add uv.lock"
48
+
49
+ [tool.semantic_release.remote]
50
+ type = "github"
51
+
52
+ [tool.semantic_release.branches.main]
53
+ match = "main"
54
+
55
+ [tool.semantic_release.branches.master]
56
+ match = "master"
57
+
58
+ [tool.semantic_release.branches.release]
59
+ match = "release"
60
+
61
+ [tool.pytest.ini_options]
62
+ addopts = "-vv -m 'not e2e'"
63
+ markers = ["e2e: generates a project and runs its gates; needs the network"]
64
+ pythonpath = [
65
+ "src",
66
+ "test",
67
+ ]
68
+ testpaths = ["test"]
69
+
70
+ [tool.ty.src]
71
+ include = [
72
+ "src",
73
+ "test",
74
+ ]
75
+
76
+ [dependency-groups]
77
+ dev = [
78
+ "fastapi>=0.163.1",
79
+ "httpx2>=2.16.2",
80
+ "jinja2>=3.1.4",
81
+ "python-multipart>=0.0.9",
82
+ "mkdocs",
83
+ "mkdocs-material",
84
+ "pre-commit>=4.0.1",
85
+ "python-semantic-release",
86
+ "pytest",
87
+ "hypothesis>=6.170.15",
88
+ "ruff>=0.17.5",
89
+ "twine",
90
+ "ty>=0.0.104,<0.1",
91
+ ]
@@ -0,0 +1,75 @@
1
+ [build-system]
2
+ requires = ["uv_build>=0.13.8,<0.14"]
3
+ build-backend = "uv_build"
4
+
5
+ [project]
6
+ name = "create-pyproj"
7
+ version = "2.2.0"
8
+ description = "Scaffold uv-first Python projects with a DDD and hexagonal baseline."
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ dependencies = ["mako>=1.3.5"]
12
+
13
+ [project.scripts]
14
+ create-pyproj = "create_pyproj.main:main"
15
+
16
+ [tool.ruff]
17
+ line-length = 88
18
+ target-version = "py311"
19
+
20
+ [tool.ruff.lint]
21
+ select = ["E", "F", "W", "I", "S", "C901"]
22
+ ignore = ["E203", "E501"]
23
+
24
+ [tool.ruff.lint.mccabe]
25
+ max-complexity = 10
26
+
27
+ [tool.ruff.lint.per-file-ignores]
28
+ # Tests assert; that is not a security finding.
29
+ "test/**" = ["S101"]
30
+
31
+ [tool.ruff.format]
32
+ docstring-code-format = true
33
+
34
+ [tool.semantic_release]
35
+ commit_message = "chore(release): {version} [skip ci]"
36
+ remote.type = "github"
37
+ version_toml = ["pyproject.toml:project.version"]
38
+ version_variables = ["src/create_pyproj/__init__.py:__version__"]
39
+ # Re-lock after the version stamp so the release commit carries a matching uv.lock.
40
+ build_command = "uv lock --upgrade-package create-pyproj && git add uv.lock"
41
+
42
+ [tool.semantic_release.branches.main]
43
+ match = "main"
44
+
45
+ [tool.semantic_release.branches.master]
46
+ match = "master"
47
+
48
+ [tool.semantic_release.branches.release]
49
+ match = "release"
50
+
51
+ [tool.pytest.ini_options]
52
+ addopts = "-vv -m 'not e2e'"
53
+ markers = ["e2e: generates a project and runs its gates; needs the network"]
54
+ pythonpath = ["src", "test"]
55
+ testpaths = ["test"]
56
+
57
+ [dependency-groups]
58
+ dev = [
59
+ "fastapi>=0.163.1",
60
+ "httpx2>=2.16.2",
61
+ "jinja2>=3.1.4",
62
+ "python-multipart>=0.0.9",
63
+ "mkdocs",
64
+ "mkdocs-material",
65
+ "pre-commit>=4.0.1",
66
+ "python-semantic-release",
67
+ "pytest",
68
+ "hypothesis>=6.170.15",
69
+ "ruff>=0.17.5",
70
+ "twine",
71
+ "ty>=0.0.104,<0.1",
72
+ ]
73
+
74
+ [tool.ty.src]
75
+ include = ["src", "test"]
@@ -0,0 +1,5 @@
1
+ """Utilities for scaffolding canonical Python projects."""
2
+
3
+ __all__ = ["__version__"]
4
+
5
+ __version__ = "2.2.0"
@@ -0,0 +1,135 @@
1
+ """CLI entrypoint for project scaffolding."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ from pathlib import Path
7
+
8
+ from . import __version__, versions
9
+ from .scaffold import ProjectOptions, create_project
10
+
11
+
12
+ def build_parser() -> argparse.ArgumentParser:
13
+ """Build the command-line parser."""
14
+
15
+ parser = argparse.ArgumentParser(
16
+ prog="create-pyproj",
17
+ description=(
18
+ "Create a uv-first Python scaffold with a DDD/hexagonal core and "
19
+ "optional CLI, web, and CI adapters."
20
+ ),
21
+ )
22
+ parser.add_argument(
23
+ "--version",
24
+ action="version",
25
+ version=f"%(prog)s {__version__}",
26
+ )
27
+ parser.add_argument(
28
+ "project_name",
29
+ help="The directory and package name for the new project.",
30
+ )
31
+ parser.add_argument(
32
+ "--python-version",
33
+ default=versions.PYTHON_DEFAULT,
34
+ help=(
35
+ "Version string to write to .python-version. "
36
+ f"Defaults to {versions.PYTHON_DEFAULT}."
37
+ ),
38
+ )
39
+ parser.add_argument(
40
+ "--description",
41
+ default="Canonical Python project scaffold.",
42
+ help="Short project description for pyproject.toml and README.md.",
43
+ )
44
+ parser.add_argument(
45
+ "--author",
46
+ default="",
47
+ help="Optional author name to include in pyproject.toml.",
48
+ )
49
+ parser.add_argument(
50
+ "--author-email",
51
+ default="",
52
+ help="Optional author email to include in pyproject.toml.",
53
+ )
54
+ parser.add_argument(
55
+ "--interface",
56
+ action="append",
57
+ choices=["library", "cli", "web"],
58
+ dest="interfaces",
59
+ help=(
60
+ "Interface to include. Repeat for multiple adapters. "
61
+ "Defaults to library only."
62
+ ),
63
+ )
64
+ parser.add_argument(
65
+ "--ci",
66
+ choices=["none", "github", "gitlab"],
67
+ default="none",
68
+ help="Optional CI provider template to include.",
69
+ )
70
+ parser.add_argument(
71
+ "--terraform",
72
+ action="store_true",
73
+ help="Include a starter Terraform deployment skeleton.",
74
+ )
75
+ parser.add_argument(
76
+ "--output-dir",
77
+ type=Path,
78
+ default=Path.cwd(),
79
+ help="Directory where the new project folder will be created.",
80
+ )
81
+ parser.add_argument(
82
+ "--no-git-init",
83
+ action="store_true",
84
+ help="Skip git init.",
85
+ )
86
+ parser.add_argument(
87
+ "--no-install",
88
+ action="store_true",
89
+ help="Skip uv sync and pre-commit installation.",
90
+ )
91
+ return parser
92
+
93
+
94
+ def main(argv: list[str] | None = None) -> int:
95
+ """Run the scaffolder CLI."""
96
+
97
+ parser = build_parser()
98
+ args = parser.parse_args(argv)
99
+ options = ProjectOptions(
100
+ project_name=args.project_name,
101
+ python_version=args.python_version,
102
+ description=args.description,
103
+ author=args.author,
104
+ author_email=args.author_email,
105
+ interfaces=tuple(args.interfaces or ("library",)),
106
+ ci_provider=args.ci,
107
+ terraform=args.terraform,
108
+ output_dir=args.output_dir,
109
+ git_init=not args.no_git_init,
110
+ install=not args.no_install,
111
+ )
112
+
113
+ try:
114
+ result = create_project(options)
115
+ except FileExistsError:
116
+ parser.error(
117
+ "Destination exists and is not a directory: "
118
+ f"{(args.output_dir / args.project_name)!s}"
119
+ )
120
+ except RuntimeError as error:
121
+ parser.exit(status=1, message=f"{error}\n")
122
+
123
+ if result.used_existing_directory:
124
+ print(
125
+ "Updated existing project at "
126
+ f"{result.project_dir}. Overwrote scaffold-managed files and kept "
127
+ "other existing files and folders."
128
+ )
129
+ else:
130
+ print(f"Created project at {result.project_dir}")
131
+ return 0
132
+
133
+
134
+ if __name__ == "__main__":
135
+ raise SystemExit(main())