spinup-py 0.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.
- spinup_py-0.2.0/LICENSE +21 -0
- spinup_py-0.2.0/MANIFEST.in +3 -0
- spinup_py-0.2.0/PKG-INFO +150 -0
- spinup_py-0.2.0/README.md +120 -0
- spinup_py-0.2.0/cookiecutter.json +24 -0
- spinup_py-0.2.0/hooks/hooks.json +13 -0
- spinup_py-0.2.0/hooks/post_gen_project.py +86 -0
- spinup_py-0.2.0/hooks/pre_gen_project.py +20 -0
- spinup_py-0.2.0/hooks/scripts/install-cli.sh +32 -0
- spinup_py-0.2.0/pyproject.toml +143 -0
- spinup_py-0.2.0/setup.cfg +4 -0
- spinup_py-0.2.0/src/spinup_py/__init__.py +0 -0
- spinup_py-0.2.0/src/spinup_py/cli.py +72 -0
- spinup_py-0.2.0/src/spinup_py/prompts.py +201 -0
- spinup_py-0.2.0/src/spinup_py/scaffold.py +161 -0
- spinup_py-0.2.0/src/spinup_py/types.py +116 -0
- spinup_py-0.2.0/src/spinup_py/update.py +486 -0
- spinup_py-0.2.0/src/spinup_py.egg-info/PKG-INFO +150 -0
- spinup_py-0.2.0/src/spinup_py.egg-info/SOURCES.txt +89 -0
- spinup_py-0.2.0/src/spinup_py.egg-info/dependency_links.txt +1 -0
- spinup_py-0.2.0/src/spinup_py.egg-info/entry_points.txt +2 -0
- spinup_py-0.2.0/src/spinup_py.egg-info/requires.txt +5 -0
- spinup_py-0.2.0/src/spinup_py.egg-info/top_level.txt +1 -0
- spinup_py-0.2.0/tests/test_cookiecutter.py +274 -0
- spinup_py-0.2.0/tests/test_units.py +348 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/.devcontainer/.zshrc +159 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/.devcontainer/DISCOVER-DEPS.md +109 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/.devcontainer/README.md +223 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/.devcontainer/SETUP.md +133 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/.devcontainer/TOOLS.md +215 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/.devcontainer/custom-setup.sh +3 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/.devcontainer/devcontainer.json +124 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/.dockerignore +21 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/.editorconfig +26 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/.github/ISSUE_TEMPLATE/bug_report.md +31 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/.github/ISSUE_TEMPLATE/config.yml +4 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/.github/ISSUE_TEMPLATE/feature-request.md +23 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +27 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/.github/actions/setup-python-env/action.yml +30 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/.github/workflows/main.yml +72 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/.github/workflows/on-release-main.yml +90 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/.github/workflows/validate-codecov-config.yml +15 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/.gitignore +142 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/.pre-commit-config.yaml +29 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/.python-version +1 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/AGENTS.md +31 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/AUTHORS.md +3 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/CHANGELOG.md +8 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/CLAUDE.md +1 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/CONTRIBUTING.md +126 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/Dockerfile +26 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/LICENSE_APACHE +202 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/LICENSE_BSD +28 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/LICENSE_GPL +674 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/LICENSE_ISC +7 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/LICENSE_MIT +21 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/Makefile +67 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/README.md +87 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/codecov.yaml +9 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/docker-compose.yaml +9 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/docs/code-examples.md +24 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/docs/content-tabs.md +43 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/docs/diagram-examples.md +0 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/docs/docs/configuration.md +7 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/docs/docs/contributing.md +22 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/docs/docs/installation.md +29 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/docs/docs/intro.md +25 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/docs/docs/quickstart.md +13 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/docs/docs/usage.md +7 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/docs/docusaurus.config.ts +59 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/docs/getting-started.md +11 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/docs/index.md +8 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/docs/installation.md +0 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/docs/modules.md +1 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/docs/package-lock.json +18414 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/docs/package.json +33 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/docs/sidebars.ts +23 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/docs/src/css/custom.css +28 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/docs/static/.gitkeep +0 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/docs/tsconfig.json +6 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/docs/usage.md +0 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/pyproject.toml +183 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/setup.cfg +35 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/src/{{cookiecutter.project_slug}}/__init__.py +10 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/src/{{cookiecutter.project_slug}}/foo.py +16 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/src/{{cookiecutter.project_slug}}/py.typed +0 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/tests/__init__.py +0 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/tests/conftest.py +0 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/tests/test_foo.py +5 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/tox.ini +19 -0
- spinup_py-0.2.0/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}.code-workspace +40 -0
spinup_py-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
spinup_py-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: spinup-py
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Scaffold and maintain production-ready Python projects with a rich CLI and Claude Code plugin.
|
|
5
|
+
Author-email: Joe Black <me@joeblack.nyc>
|
|
6
|
+
Project-URL: Repository, https://github.com/joeblackwaslike/spinup-py
|
|
7
|
+
Project-URL: Documentation, https://joeblackwaslike.github.io/spinup-py/
|
|
8
|
+
Project-URL: Homepage, https://joeblackwaslike.github.io/spinup-py/
|
|
9
|
+
Keywords: python,scaffold,cli,template,uv,cookiecutter
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
21
|
+
Requires-Python: <4.0,>=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: cookiecutter>=2.1.1
|
|
25
|
+
Requires-Dist: typer[all]>=0.12
|
|
26
|
+
Requires-Dist: questionary>=2.0
|
|
27
|
+
Requires-Dist: pydantic>=2.0
|
|
28
|
+
Requires-Dist: tomlkit>=0.12
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
<p align="center">
|
|
32
|
+
<img width="600" src="https://raw.githubusercontent.com/joeblackwaslike/spinup-py/main/docs/static/cookiecutter.svg">
|
|
33
|
+
</p style = "margin-bottom: 2rem;">
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
[](https://github.com/joeblackwaslike/spinup-py/actions/workflows/main.yml?query=branch%3Amain)
|
|
38
|
+
[](https://github.com/joeblackwaslike/spinup-py/blob/main/pyproject.toml)
|
|
39
|
+
[](https://joeblackwaslike.github.io/spinup-py/)
|
|
40
|
+
[](https://img.shields.io/github/license/joeblackwaslike/spinup-py)
|
|
41
|
+
|
|
42
|
+
This is a modern Cookiecutter template that can be used to initiate a Python project with all the necessary tools for development, testing, and deployment. It supports the following features:
|
|
43
|
+
|
|
44
|
+
- [uv](https://docs.astral.sh/uv/) for dependency management
|
|
45
|
+
- Supports [src layout](https://packaging.python.org/en/latest/discussions/src-layout-vs-flat-layout/)
|
|
46
|
+
- CI/CD with [GitHub Actions](https://github.com/features/actions)
|
|
47
|
+
- Pre-commit hooks with [pre-commit](https://pre-commit.com/)
|
|
48
|
+
- Code quality with [ruff](https://github.com/charliermarsh/ruff), [mypy](https://mypy.readthedocs.io/en/stable/), [wemake-python-styleguide](https://wemake-python-styleguide.readthedocs.io/en/latest/pages/usage/setup.html), [deptry](https://github.com/joeblackwaslike/deptry/) and [prettier](https://prettier.io/)
|
|
49
|
+
- Publishing to [PyPI](https://pypi.org) by creating a new release on GitHub
|
|
50
|
+
- Testing and coverage with [pytest](https://docs.pytest.org/en/7.1.x/) and [codecov](https://about.codecov.io/)
|
|
51
|
+
- Documentation with [Docusaurus](https://docusaurus.io/)
|
|
52
|
+
- Compatibility testing for multiple versions of Python with [tox-uv](https://github.com/tox-dev/tox-uv)
|
|
53
|
+
- Containerization with [Docker](https://www.docker.com/)
|
|
54
|
+
- Development environment with [VSCode devcontainers](https://code.visualstudio.com/docs/devcontainers/containers)
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
<p align="center">
|
|
59
|
+
<a href="https://joeblackwaslike.github.io/spinup-py/">Documentation</a> - <a href="https://github.com/joeblackwaslike/spinup-py-example">Example</a>
|
|
60
|
+
</p>
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Quickstart
|
|
65
|
+
|
|
66
|
+
[](https://discord.com/channels/1486035859747897414/1509515362012626944) [](https://discord.gg/Fjc9zYHZyV)
|
|
67
|
+
|
|
68
|
+
Navigate to the directory where you want your new project and run:
|
|
69
|
+
|
|
70
|
+
```shell
|
|
71
|
+
uvx spinup-py my-project
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Or install globally first:
|
|
75
|
+
|
|
76
|
+
```shell
|
|
77
|
+
uv tool install spinup-py
|
|
78
|
+
spinup-py my-project
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Follow the guided prompts to configure your project. Once complete, a new directory `my-project/` will be created with everything set up.
|
|
82
|
+
|
|
83
|
+
To retrofit an existing project with the latest tooling:
|
|
84
|
+
|
|
85
|
+
```shell
|
|
86
|
+
spinup-py --update /path/to/existing-project
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
> `spinup-py` is the Python sibling of [`spinup-ts`](https://www.npmjs.com/package/spinup-ts), the equivalent TypeScript project scaffolder.
|
|
90
|
+
|
|
91
|
+
### Install from source
|
|
92
|
+
|
|
93
|
+
For local or development use (e.g. running it as a Claude Code plugin), install the checkout directly with an editable install:
|
|
94
|
+
|
|
95
|
+
```shell
|
|
96
|
+
uv tool install --editable .
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Usage
|
|
100
|
+
|
|
101
|
+
```shell
|
|
102
|
+
# Scaffold a new project (bare form — positional name)
|
|
103
|
+
spinup-py my-project
|
|
104
|
+
|
|
105
|
+
# Same thing via the explicit subcommand
|
|
106
|
+
spinup-py new my-project
|
|
107
|
+
|
|
108
|
+
# Retrofit an existing project with the current tooling
|
|
109
|
+
spinup-py update /path/to/existing-project
|
|
110
|
+
|
|
111
|
+
# Or via the root flag (equivalent to `update`)
|
|
112
|
+
spinup-py --update /path/to/existing-project
|
|
113
|
+
|
|
114
|
+
# Print the installed version
|
|
115
|
+
spinup-py --version
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Flags
|
|
119
|
+
|
|
120
|
+
| Flag / command | Description |
|
|
121
|
+
| -------------------------- | ---------------------------------------------------------------------------- |
|
|
122
|
+
| `spinup-py <name>` | Scaffold a new project with the given name (runs the guided prompts). |
|
|
123
|
+
| `spinup-py new [<name>]` | Explicit subcommand for scaffolding a new project. |
|
|
124
|
+
| `spinup-py update [<dir>]` | Retrofit an existing project at `<dir>` (defaults to the current directory). |
|
|
125
|
+
| `--update`, `-u <dir>` | Root-level equivalent of `update` — retrofit an existing project at `<dir>`. |
|
|
126
|
+
| `--non-interactive`, `-y` | Scaffold with sensible defaults and no prompts. |
|
|
127
|
+
| `--version`, `-v` | Print the installed version and exit. |
|
|
128
|
+
|
|
129
|
+
### Offline / custom template
|
|
130
|
+
|
|
131
|
+
By default the published CLI fetches its Cookiecutter template from GitHub (`gh:joeblackwaslike/spinup-py`). To use a local or custom template instead — handy when working offline or from a fork — set the `SPINUP_PY_TEMPLATE` environment variable to any Cookiecutter reference (a local path, a different GitHub repo, etc.):
|
|
132
|
+
|
|
133
|
+
```shell
|
|
134
|
+
SPINUP_PY_TEMPLATE=/path/to/template spinup-py my-project
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Acknowledgements & Lineage
|
|
138
|
+
|
|
139
|
+
- This project is partially based on [Florian Maas's](https://github.com/fpgmaas) great
|
|
140
|
+
[cookiecutter-uv](https://github.com/fpgmaas/cookiecutter-uv)
|
|
141
|
+
repository. Many additional improvements have been added from all the projects I've worked on over the last 12 years or so.
|
|
142
|
+
- Florian also credits [Audrey Feldroy's](https://github.com/audreyfeldroy) great [cookiecutter-pypackage](https://github.com/audreyfeldroy/cookiecutter-pypackage) repository.
|
|
143
|
+
|
|
144
|
+
## Feedback and contributing
|
|
145
|
+
|
|
146
|
+
My mission with this is to build the best project starter for python projects that has everything you can want, the ability to customize and/or opt out of most everything, and save you the most time!
|
|
147
|
+
|
|
148
|
+
I am only one person with very specific preferences. If you have any feedback you can email me at `me@joeblack.nyc`. If you find any bugs, mistakes, missed opportunities, or would like to contribute new functionality in any way, I would love to hear about it in an issue, feel free to email me the issue to get my attention.
|
|
149
|
+
|
|
150
|
+
This project is under continuous iterative improvements as I find bugs, and better and more effective ways to do things. But I can only do so much on my own, so please open an issue if you want to help/contribute and we can iterate and discuss how we can make this happen. If you find an outright bug or mistake, just open a PR and describe all the details there.
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img width="600" src="https://raw.githubusercontent.com/joeblackwaslike/spinup-py/main/docs/static/cookiecutter.svg">
|
|
3
|
+
</p style = "margin-bottom: 2rem;">
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
[](https://github.com/joeblackwaslike/spinup-py/actions/workflows/main.yml?query=branch%3Amain)
|
|
8
|
+
[](https://github.com/joeblackwaslike/spinup-py/blob/main/pyproject.toml)
|
|
9
|
+
[](https://joeblackwaslike.github.io/spinup-py/)
|
|
10
|
+
[](https://img.shields.io/github/license/joeblackwaslike/spinup-py)
|
|
11
|
+
|
|
12
|
+
This is a modern Cookiecutter template that can be used to initiate a Python project with all the necessary tools for development, testing, and deployment. It supports the following features:
|
|
13
|
+
|
|
14
|
+
- [uv](https://docs.astral.sh/uv/) for dependency management
|
|
15
|
+
- Supports [src layout](https://packaging.python.org/en/latest/discussions/src-layout-vs-flat-layout/)
|
|
16
|
+
- CI/CD with [GitHub Actions](https://github.com/features/actions)
|
|
17
|
+
- Pre-commit hooks with [pre-commit](https://pre-commit.com/)
|
|
18
|
+
- Code quality with [ruff](https://github.com/charliermarsh/ruff), [mypy](https://mypy.readthedocs.io/en/stable/), [wemake-python-styleguide](https://wemake-python-styleguide.readthedocs.io/en/latest/pages/usage/setup.html), [deptry](https://github.com/joeblackwaslike/deptry/) and [prettier](https://prettier.io/)
|
|
19
|
+
- Publishing to [PyPI](https://pypi.org) by creating a new release on GitHub
|
|
20
|
+
- Testing and coverage with [pytest](https://docs.pytest.org/en/7.1.x/) and [codecov](https://about.codecov.io/)
|
|
21
|
+
- Documentation with [Docusaurus](https://docusaurus.io/)
|
|
22
|
+
- Compatibility testing for multiple versions of Python with [tox-uv](https://github.com/tox-dev/tox-uv)
|
|
23
|
+
- Containerization with [Docker](https://www.docker.com/)
|
|
24
|
+
- Development environment with [VSCode devcontainers](https://code.visualstudio.com/docs/devcontainers/containers)
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
<p align="center">
|
|
29
|
+
<a href="https://joeblackwaslike.github.io/spinup-py/">Documentation</a> - <a href="https://github.com/joeblackwaslike/spinup-py-example">Example</a>
|
|
30
|
+
</p>
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Quickstart
|
|
35
|
+
|
|
36
|
+
[](https://discord.com/channels/1486035859747897414/1509515362012626944) [](https://discord.gg/Fjc9zYHZyV)
|
|
37
|
+
|
|
38
|
+
Navigate to the directory where you want your new project and run:
|
|
39
|
+
|
|
40
|
+
```shell
|
|
41
|
+
uvx spinup-py my-project
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Or install globally first:
|
|
45
|
+
|
|
46
|
+
```shell
|
|
47
|
+
uv tool install spinup-py
|
|
48
|
+
spinup-py my-project
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Follow the guided prompts to configure your project. Once complete, a new directory `my-project/` will be created with everything set up.
|
|
52
|
+
|
|
53
|
+
To retrofit an existing project with the latest tooling:
|
|
54
|
+
|
|
55
|
+
```shell
|
|
56
|
+
spinup-py --update /path/to/existing-project
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
> `spinup-py` is the Python sibling of [`spinup-ts`](https://www.npmjs.com/package/spinup-ts), the equivalent TypeScript project scaffolder.
|
|
60
|
+
|
|
61
|
+
### Install from source
|
|
62
|
+
|
|
63
|
+
For local or development use (e.g. running it as a Claude Code plugin), install the checkout directly with an editable install:
|
|
64
|
+
|
|
65
|
+
```shell
|
|
66
|
+
uv tool install --editable .
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Usage
|
|
70
|
+
|
|
71
|
+
```shell
|
|
72
|
+
# Scaffold a new project (bare form — positional name)
|
|
73
|
+
spinup-py my-project
|
|
74
|
+
|
|
75
|
+
# Same thing via the explicit subcommand
|
|
76
|
+
spinup-py new my-project
|
|
77
|
+
|
|
78
|
+
# Retrofit an existing project with the current tooling
|
|
79
|
+
spinup-py update /path/to/existing-project
|
|
80
|
+
|
|
81
|
+
# Or via the root flag (equivalent to `update`)
|
|
82
|
+
spinup-py --update /path/to/existing-project
|
|
83
|
+
|
|
84
|
+
# Print the installed version
|
|
85
|
+
spinup-py --version
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Flags
|
|
89
|
+
|
|
90
|
+
| Flag / command | Description |
|
|
91
|
+
| -------------------------- | ---------------------------------------------------------------------------- |
|
|
92
|
+
| `spinup-py <name>` | Scaffold a new project with the given name (runs the guided prompts). |
|
|
93
|
+
| `spinup-py new [<name>]` | Explicit subcommand for scaffolding a new project. |
|
|
94
|
+
| `spinup-py update [<dir>]` | Retrofit an existing project at `<dir>` (defaults to the current directory). |
|
|
95
|
+
| `--update`, `-u <dir>` | Root-level equivalent of `update` — retrofit an existing project at `<dir>`. |
|
|
96
|
+
| `--non-interactive`, `-y` | Scaffold with sensible defaults and no prompts. |
|
|
97
|
+
| `--version`, `-v` | Print the installed version and exit. |
|
|
98
|
+
|
|
99
|
+
### Offline / custom template
|
|
100
|
+
|
|
101
|
+
By default the published CLI fetches its Cookiecutter template from GitHub (`gh:joeblackwaslike/spinup-py`). To use a local or custom template instead — handy when working offline or from a fork — set the `SPINUP_PY_TEMPLATE` environment variable to any Cookiecutter reference (a local path, a different GitHub repo, etc.):
|
|
102
|
+
|
|
103
|
+
```shell
|
|
104
|
+
SPINUP_PY_TEMPLATE=/path/to/template spinup-py my-project
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Acknowledgements & Lineage
|
|
108
|
+
|
|
109
|
+
- This project is partially based on [Florian Maas's](https://github.com/fpgmaas) great
|
|
110
|
+
[cookiecutter-uv](https://github.com/fpgmaas/cookiecutter-uv)
|
|
111
|
+
repository. Many additional improvements have been added from all the projects I've worked on over the last 12 years or so.
|
|
112
|
+
- Florian also credits [Audrey Feldroy's](https://github.com/audreyfeldroy) great [cookiecutter-pypackage](https://github.com/audreyfeldroy/cookiecutter-pypackage) repository.
|
|
113
|
+
|
|
114
|
+
## Feedback and contributing
|
|
115
|
+
|
|
116
|
+
My mission with this is to build the best project starter for python projects that has everything you can want, the ability to customize and/or opt out of most everything, and save you the most time!
|
|
117
|
+
|
|
118
|
+
I am only one person with very specific preferences. If you have any feedback you can email me at `me@joeblack.nyc`. If you find any bugs, mistakes, missed opportunities, or would like to contribute new functionality in any way, I would love to hear about it in an issue, feel free to email me the issue to get my attention.
|
|
119
|
+
|
|
120
|
+
This project is under continuous iterative improvements as I find bugs, and better and more effective ways to do things. But I can only do so much on my own, so please open an issue if you want to help/contribute and we can iterate and discuss how we can make this happen. If you find an outright bug or mistake, just open a PR and describe all the details there.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"author": "Joe Black",
|
|
3
|
+
"email": "me@joeblack.nyc",
|
|
4
|
+
"github_handle": "joeblackwaslike",
|
|
5
|
+
"project_name": "example-project",
|
|
6
|
+
"project_slug": "{{cookiecutter.project_name|lower|replace('-', '_')}}",
|
|
7
|
+
"description": "This is a template repository for Python projects that use uv for their dependency management.",
|
|
8
|
+
"python_version": ["3.12", "3.11", "3.10"],
|
|
9
|
+
"include_github_actions": ["y", "n"],
|
|
10
|
+
"publish_to_pypi": ["y", "n"],
|
|
11
|
+
"deptry": ["y", "n"],
|
|
12
|
+
"include_docs": ["y", "n"],
|
|
13
|
+
"codecov": ["y", "n"],
|
|
14
|
+
"dockerfile": ["y", "n"],
|
|
15
|
+
"devcontainer": ["y", "n"],
|
|
16
|
+
"open_source_license": [
|
|
17
|
+
"MIT license",
|
|
18
|
+
"BSD license",
|
|
19
|
+
"ISC license",
|
|
20
|
+
"Apache Software License 2.0",
|
|
21
|
+
"GNU General Public License v3",
|
|
22
|
+
"Not open source"
|
|
23
|
+
]
|
|
24
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
import os
|
|
3
|
+
import shutil
|
|
4
|
+
|
|
5
|
+
PROJECT_DIRECTORY = os.path.realpath(os.path.curdir)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def remove_file(filepath: str) -> None:
|
|
9
|
+
os.remove(os.path.join(PROJECT_DIRECTORY, filepath))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def remove_dir(filepath: str) -> None:
|
|
13
|
+
shutil.rmtree(os.path.join(PROJECT_DIRECTORY, filepath))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def move_file(filepath: str, target: str) -> None:
|
|
17
|
+
os.rename(os.path.join(PROJECT_DIRECTORY, filepath), os.path.join(PROJECT_DIRECTORY, target))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
if __name__ == "__main__":
|
|
21
|
+
# NOTE: optional dependencies (deptry/ipython, coverage/pytest-cov) and the
|
|
22
|
+
# [tool.coverage.*] sections are gated directly in pyproject.toml with Jinja
|
|
23
|
+
# conditionals, so there is nothing to strip here — the single source of
|
|
24
|
+
# truth for "is this dep included?" lives in the template itself.
|
|
25
|
+
if "{{cookiecutter.include_github_actions}}" != "y":
|
|
26
|
+
remove_dir(".github")
|
|
27
|
+
else:
|
|
28
|
+
if "{{cookiecutter.include_docs}}" != "y" and "{{cookiecutter.publish_to_pypi}}" == "n":
|
|
29
|
+
remove_file(".github/workflows/on-release-main.yml")
|
|
30
|
+
|
|
31
|
+
if "{{cookiecutter.include_docs}}" != "y":
|
|
32
|
+
remove_dir("docs")
|
|
33
|
+
|
|
34
|
+
if "{{cookiecutter.dockerfile}}" != "y":
|
|
35
|
+
remove_file("Dockerfile")
|
|
36
|
+
remove_file("docker-compose.yaml")
|
|
37
|
+
remove_file(".dockerignore")
|
|
38
|
+
if "{{cookiecutter.codecov}}" != "y":
|
|
39
|
+
remove_file("codecov.yaml")
|
|
40
|
+
if "{{cookiecutter.include_github_actions}}" == "y":
|
|
41
|
+
remove_file(".github/workflows/validate-codecov-config.yml")
|
|
42
|
+
|
|
43
|
+
if "{{cookiecutter.devcontainer}}" != "y":
|
|
44
|
+
remove_dir(".devcontainer")
|
|
45
|
+
|
|
46
|
+
if "{{cookiecutter.open_source_license}}" == "MIT license":
|
|
47
|
+
move_file("LICENSE_MIT", "LICENSE")
|
|
48
|
+
remove_file("LICENSE_BSD")
|
|
49
|
+
remove_file("LICENSE_ISC")
|
|
50
|
+
remove_file("LICENSE_APACHE")
|
|
51
|
+
remove_file("LICENSE_GPL")
|
|
52
|
+
|
|
53
|
+
if "{{cookiecutter.open_source_license}}" == "BSD license":
|
|
54
|
+
move_file("LICENSE_BSD", "LICENSE")
|
|
55
|
+
remove_file("LICENSE_MIT")
|
|
56
|
+
remove_file("LICENSE_ISC")
|
|
57
|
+
remove_file("LICENSE_APACHE")
|
|
58
|
+
remove_file("LICENSE_GPL")
|
|
59
|
+
|
|
60
|
+
if "{{cookiecutter.open_source_license}}" == "ISC license":
|
|
61
|
+
move_file("LICENSE_ISC", "LICENSE")
|
|
62
|
+
remove_file("LICENSE_MIT")
|
|
63
|
+
remove_file("LICENSE_BSD")
|
|
64
|
+
remove_file("LICENSE_APACHE")
|
|
65
|
+
remove_file("LICENSE_GPL")
|
|
66
|
+
|
|
67
|
+
if "{{cookiecutter.open_source_license}}" == "Apache Software License 2.0":
|
|
68
|
+
move_file("LICENSE_APACHE", "LICENSE")
|
|
69
|
+
remove_file("LICENSE_MIT")
|
|
70
|
+
remove_file("LICENSE_BSD")
|
|
71
|
+
remove_file("LICENSE_ISC")
|
|
72
|
+
remove_file("LICENSE_GPL")
|
|
73
|
+
|
|
74
|
+
if "{{cookiecutter.open_source_license}}" == "GNU General Public License v3":
|
|
75
|
+
move_file("LICENSE_GPL", "LICENSE")
|
|
76
|
+
remove_file("LICENSE_MIT")
|
|
77
|
+
remove_file("LICENSE_BSD")
|
|
78
|
+
remove_file("LICENSE_ISC")
|
|
79
|
+
remove_file("LICENSE_APACHE")
|
|
80
|
+
|
|
81
|
+
if "{{cookiecutter.open_source_license}}" == "Not open source":
|
|
82
|
+
remove_file("LICENSE_GPL")
|
|
83
|
+
remove_file("LICENSE_MIT")
|
|
84
|
+
remove_file("LICENSE_BSD")
|
|
85
|
+
remove_file("LICENSE_ISC")
|
|
86
|
+
remove_file("LICENSE_APACHE")
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import re
|
|
2
|
+
import sys
|
|
3
|
+
|
|
4
|
+
PROJECT_NAME_REGEX = r"^[-a-zA-Z][-a-zA-Z0-9]+$"
|
|
5
|
+
project_name = "{{cookiecutter.project_name}}"
|
|
6
|
+
if not re.match(PROJECT_NAME_REGEX, project_name):
|
|
7
|
+
print(
|
|
8
|
+
f"ERROR: The project name {project_name} is not a valid Python module name. Please do not use a _ and use - instead"
|
|
9
|
+
)
|
|
10
|
+
# Exit to cancel project
|
|
11
|
+
sys.exit(1)
|
|
12
|
+
|
|
13
|
+
PROJECT_SLUG_REGEX = r"^[_a-zA-Z][_a-zA-Z0-9]+$"
|
|
14
|
+
project_slug = "{{cookiecutter.project_slug}}"
|
|
15
|
+
if not re.match(PROJECT_SLUG_REGEX, project_slug):
|
|
16
|
+
print(
|
|
17
|
+
f"ERROR: The project slug {project_slug} is not a valid Python module name. Please do not use a - and use _ instead"
|
|
18
|
+
)
|
|
19
|
+
# Exit to cancel project
|
|
20
|
+
sys.exit(1)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Installs the spinup-py CLI into the session environment.
|
|
3
|
+
# Called by the Claude Code plugin SessionStart hook.
|
|
4
|
+
|
|
5
|
+
if command -v spinup-py &>/dev/null; then
|
|
6
|
+
echo '{"continue": true, "suppressOutput": true, "status": "ready"}'
|
|
7
|
+
exit 0
|
|
8
|
+
fi
|
|
9
|
+
|
|
10
|
+
cd "$CLAUDE_PLUGIN_ROOT" || {
|
|
11
|
+
echo '{"continue": true, "suppressOutput": false, "status": "install failed — CLAUDE_PLUGIN_ROOT not set or not a directory"}'
|
|
12
|
+
exit 1
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
# Suppress installer stdout (it would corrupt the JSON status line) but let
|
|
16
|
+
# stderr through so a non-obvious failure is visible before we fall through.
|
|
17
|
+
if command -v uv &>/dev/null && uv tool install --editable . >/dev/null; then
|
|
18
|
+
echo '{"continue": true, "suppressOutput": true, "status": "installed via uv tool"}'
|
|
19
|
+
exit 0
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
if command -v pipx &>/dev/null && pipx install --editable . >/dev/null; then
|
|
23
|
+
echo '{"continue": true, "suppressOutput": true, "status": "installed via pipx"}'
|
|
24
|
+
exit 0
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
if pip install -e . --quiet >/dev/null; then
|
|
28
|
+
echo '{"continue": true, "suppressOutput": true, "status": "installed via pip"}'
|
|
29
|
+
exit 0
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
echo "{\"continue\": true, \"suppressOutput\": false, \"status\": \"install failed — run: uv tool install --editable $CLAUDE_PLUGIN_ROOT\"}"
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "spinup-py"
|
|
3
|
+
version = "0.2.0"
|
|
4
|
+
description = "Scaffold and maintain production-ready Python projects with a rich CLI and Claude Code plugin."
|
|
5
|
+
authors = [{ name = "Joe Black", email = "me@joeblack.nyc" }]
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
keywords = ['python', 'scaffold', 'cli', 'template', 'uv', 'cookiecutter']
|
|
8
|
+
requires-python = ">=3.10,<4.0"
|
|
9
|
+
dependencies = [
|
|
10
|
+
"cookiecutter>=2.1.1",
|
|
11
|
+
"typer[all]>=0.12",
|
|
12
|
+
"questionary>=2.0",
|
|
13
|
+
"pydantic>=2.0",
|
|
14
|
+
"tomlkit>=0.12",
|
|
15
|
+
]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"License :: OSI Approved :: MIT License",
|
|
20
|
+
"Programming Language :: Python",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Programming Language :: Python :: 3.10",
|
|
23
|
+
"Programming Language :: Python :: 3.11",
|
|
24
|
+
"Programming Language :: Python :: 3.12",
|
|
25
|
+
"Programming Language :: Python :: 3.13",
|
|
26
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
27
|
+
"Topic :: Software Development :: Code Generators",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[project.scripts]
|
|
31
|
+
spinup-py = "spinup_py.cli:app"
|
|
32
|
+
|
|
33
|
+
[project.urls]
|
|
34
|
+
Repository = "https://github.com/joeblackwaslike/spinup-py"
|
|
35
|
+
Documentation = "https://joeblackwaslike.github.io/spinup-py/"
|
|
36
|
+
Homepage = "https://joeblackwaslike.github.io/spinup-py/"
|
|
37
|
+
|
|
38
|
+
[dependency-groups]
|
|
39
|
+
dev = [
|
|
40
|
+
"pytest>=7.2.0",
|
|
41
|
+
"pre-commit>=2.20.0",
|
|
42
|
+
"pytest-cookies>=0.6.1",
|
|
43
|
+
"tox-uv>=1.11.3",
|
|
44
|
+
"deptry>=0.22.0",
|
|
45
|
+
"mypy>=0.991",
|
|
46
|
+
"pytest-cov>=4.0.0",
|
|
47
|
+
"ruff>=0.9.2",
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
[tool.uv]
|
|
51
|
+
package = true
|
|
52
|
+
|
|
53
|
+
[build-system]
|
|
54
|
+
requires = ["setuptools >= 61.0"]
|
|
55
|
+
build-backend = "setuptools.build_meta"
|
|
56
|
+
|
|
57
|
+
[tool.setuptools.packages.find]
|
|
58
|
+
where = ["src"]
|
|
59
|
+
|
|
60
|
+
[tool.pytest.ini_options]
|
|
61
|
+
testpaths = ["tests"]
|
|
62
|
+
|
|
63
|
+
[tool.coverage.report]
|
|
64
|
+
skip_empty = true
|
|
65
|
+
|
|
66
|
+
[tool.coverage.run]
|
|
67
|
+
branch = true
|
|
68
|
+
source = ["spinup_py"]
|
|
69
|
+
|
|
70
|
+
[tool.mypy]
|
|
71
|
+
files = ['src/spinup_py']
|
|
72
|
+
disallow_untyped_defs = true
|
|
73
|
+
disallow_any_unimported = true
|
|
74
|
+
no_implicit_optional = true
|
|
75
|
+
check_untyped_defs = true
|
|
76
|
+
warn_return_any = true
|
|
77
|
+
warn_unused_ignores = true
|
|
78
|
+
show_error_codes = true
|
|
79
|
+
|
|
80
|
+
[tool.deptry]
|
|
81
|
+
extend_exclude = [
|
|
82
|
+
".+/test_foo.py"
|
|
83
|
+
]
|
|
84
|
+
|
|
85
|
+
[tool.deptry.per_rule_ignores]
|
|
86
|
+
DEP002 = ["cookiecutter"]
|
|
87
|
+
DEP003 = ["spinup_py", "rich"]
|
|
88
|
+
|
|
89
|
+
[tool.ruff]
|
|
90
|
+
target-version = "py310"
|
|
91
|
+
line-length = 120
|
|
92
|
+
fix = true
|
|
93
|
+
exclude = ["[{][{]cookiecutter*"]
|
|
94
|
+
|
|
95
|
+
[tool.ruff.lint]
|
|
96
|
+
select = [
|
|
97
|
+
# flake8-2020
|
|
98
|
+
"YTT",
|
|
99
|
+
# flake8-bandit
|
|
100
|
+
"S",
|
|
101
|
+
# flake8-bugbear
|
|
102
|
+
"B",
|
|
103
|
+
# flake8-builtins
|
|
104
|
+
"A",
|
|
105
|
+
# flake8-comprehensions
|
|
106
|
+
"C4",
|
|
107
|
+
# flake8-debugger
|
|
108
|
+
"T10",
|
|
109
|
+
# flake8-simplify
|
|
110
|
+
"SIM",
|
|
111
|
+
# isort
|
|
112
|
+
"I",
|
|
113
|
+
# mccabe
|
|
114
|
+
"C90",
|
|
115
|
+
# pycodestyle
|
|
116
|
+
"E", "W",
|
|
117
|
+
# pyflakes
|
|
118
|
+
"F",
|
|
119
|
+
# pygrep-hooks
|
|
120
|
+
"PGH",
|
|
121
|
+
# pyupgrade
|
|
122
|
+
"UP",
|
|
123
|
+
# ruff
|
|
124
|
+
"RUF",
|
|
125
|
+
# tryceratops
|
|
126
|
+
"TRY",
|
|
127
|
+
]
|
|
128
|
+
ignore = [
|
|
129
|
+
# LineTooLong
|
|
130
|
+
"E501",
|
|
131
|
+
# DoNotAssignLambda
|
|
132
|
+
"E731",
|
|
133
|
+
# TooComplex
|
|
134
|
+
"C901",
|
|
135
|
+
# AvoidSpecifyingLongMessagesOutsideExceptionClass
|
|
136
|
+
"TRY003",
|
|
137
|
+
# ConsiderMovingToElseBlock
|
|
138
|
+
"TRY300",
|
|
139
|
+
]
|
|
140
|
+
|
|
141
|
+
[tool.ruff.lint.per-file-ignores]
|
|
142
|
+
"tests/*" = ["S101", "S603"]
|
|
143
|
+
"src/spinup_py/*" = ["S603", "S607"]
|
|
File without changes
|