cookiecutter-pypackage 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.
- cookiecutter_pypackage-0.3.0/.gitignore +210 -0
- cookiecutter_pypackage-0.3.0/LICENSE +21 -0
- cookiecutter_pypackage-0.3.0/PKG-INFO +93 -0
- cookiecutter_pypackage-0.3.0/README.md +57 -0
- cookiecutter_pypackage-0.3.0/cookiecutter.json +12 -0
- cookiecutter_pypackage-0.3.0/hooks/post_gen_project.py +4 -0
- cookiecutter_pypackage-0.3.0/hooks/pre_gen_project.py +14 -0
- cookiecutter_pypackage-0.3.0/pyproject.toml +83 -0
- cookiecutter_pypackage-0.3.0/src/cookiecutter_pypackage/__init__.py +3 -0
- cookiecutter_pypackage-0.3.0/src/cookiecutter_pypackage/cli.py +43 -0
- cookiecutter_pypackage-0.3.0/{{cookiecutter.pypi_package_name}}/.editorconfig +37 -0
- cookiecutter_pypackage-0.3.0/{{cookiecutter.pypi_package_name}}/.github/ISSUE_TEMPLATE.md +15 -0
- cookiecutter_pypackage-0.3.0/{{cookiecutter.pypi_package_name}}/.github/workflows/publish.yml +16 -0
- cookiecutter_pypackage-0.3.0/{{cookiecutter.pypi_package_name}}/.github/workflows/test.yml +39 -0
- cookiecutter_pypackage-0.3.0/{{cookiecutter.pypi_package_name}}/.gitignore +205 -0
- cookiecutter_pypackage-0.3.0/{{cookiecutter.pypi_package_name}}/CODE_OF_CONDUCT.md +89 -0
- cookiecutter_pypackage-0.3.0/{{cookiecutter.pypi_package_name}}/CONTRIBUTING.md +119 -0
- cookiecutter_pypackage-0.3.0/{{cookiecutter.pypi_package_name}}/HISTORY.md +5 -0
- cookiecutter_pypackage-0.3.0/{{cookiecutter.pypi_package_name}}/LICENSE +21 -0
- cookiecutter_pypackage-0.3.0/{{cookiecutter.pypi_package_name}}/MANIFEST.in +10 -0
- cookiecutter_pypackage-0.3.0/{{cookiecutter.pypi_package_name}}/README.md +18 -0
- cookiecutter_pypackage-0.3.0/{{cookiecutter.pypi_package_name}}/docs/index.md +16 -0
- cookiecutter_pypackage-0.3.0/{{cookiecutter.pypi_package_name}}/docs/installation.md +38 -0
- cookiecutter_pypackage-0.3.0/{{cookiecutter.pypi_package_name}}/docs/usage.md +7 -0
- cookiecutter_pypackage-0.3.0/{{cookiecutter.pypi_package_name}}/justfile +86 -0
- cookiecutter_pypackage-0.3.0/{{cookiecutter.pypi_package_name}}/pyproject.toml +58 -0
- cookiecutter_pypackage-0.3.0/{{cookiecutter.pypi_package_name}}/src/{{cookiecutter.project_slug}}/__init__.py +4 -0
- cookiecutter_pypackage-0.3.0/{{cookiecutter.pypi_package_name}}/src/{{cookiecutter.project_slug}}/__main__.py +4 -0
- cookiecutter_pypackage-0.3.0/{{cookiecutter.pypi_package_name}}/src/{{cookiecutter.project_slug}}/cli.py +22 -0
- cookiecutter_pypackage-0.3.0/{{cookiecutter.pypi_package_name}}/src/{{cookiecutter.project_slug}}/utils.py +2 -0
- cookiecutter_pypackage-0.3.0/{{cookiecutter.pypi_package_name}}/src/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}.py +1 -0
- cookiecutter_pypackage-0.3.0/{{cookiecutter.pypi_package_name}}/tests/__init__.py +1 -0
- cookiecutter_pypackage-0.3.0/{{cookiecutter.pypi_package_name}}/tests/test_{{cookiecutter.project_slug}}.py +22 -0
- cookiecutter_pypackage-0.2.0/LICENSE +0 -27
- cookiecutter_pypackage-0.2.0/PKG-INFO +0 -33
- cookiecutter_pypackage-0.2.0/README.md +0 -0
- cookiecutter_pypackage-0.2.0/README.rst +0 -135
- cookiecutter_pypackage-0.2.0/cookiecutter_pypackage.egg-info/PKG-INFO +0 -33
- cookiecutter_pypackage-0.2.0/cookiecutter_pypackage.egg-info/SOURCES.txt +0 -12
- cookiecutter_pypackage-0.2.0/cookiecutter_pypackage.egg-info/dependency_links.txt +0 -1
- cookiecutter_pypackage-0.2.0/cookiecutter_pypackage.egg-info/requires.txt +0 -8
- cookiecutter_pypackage-0.2.0/cookiecutter_pypackage.egg-info/top_level.txt +0 -1
- cookiecutter_pypackage-0.2.0/hooks/post_gen_project.py +0 -12
- cookiecutter_pypackage-0.2.0/hooks/pre_gen_project.py +0 -13
- cookiecutter_pypackage-0.2.0/pyproject.toml +0 -50
- cookiecutter_pypackage-0.2.0/setup.cfg +0 -4
- cookiecutter_pypackage-0.2.0/tests/test_bake_project.py +0 -197
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
#uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
#poetry.lock
|
|
109
|
+
#poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
#pdm.lock
|
|
116
|
+
#pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
#pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# SageMath parsed files
|
|
135
|
+
*.sage.py
|
|
136
|
+
|
|
137
|
+
# Environments
|
|
138
|
+
.env
|
|
139
|
+
.envrc
|
|
140
|
+
.venv
|
|
141
|
+
env/
|
|
142
|
+
venv/
|
|
143
|
+
ENV/
|
|
144
|
+
env.bak/
|
|
145
|
+
venv.bak/
|
|
146
|
+
|
|
147
|
+
# Spyder project settings
|
|
148
|
+
.spyderproject
|
|
149
|
+
.spyproject
|
|
150
|
+
|
|
151
|
+
# Rope project settings
|
|
152
|
+
.ropeproject
|
|
153
|
+
|
|
154
|
+
# mkdocs documentation
|
|
155
|
+
/site
|
|
156
|
+
|
|
157
|
+
# mypy
|
|
158
|
+
.mypy_cache/
|
|
159
|
+
.dmypy.json
|
|
160
|
+
dmypy.json
|
|
161
|
+
|
|
162
|
+
# Pyre type checker
|
|
163
|
+
.pyre/
|
|
164
|
+
|
|
165
|
+
# pytype static type analyzer
|
|
166
|
+
.pytype/
|
|
167
|
+
|
|
168
|
+
# Cython debug symbols
|
|
169
|
+
cython_debug/
|
|
170
|
+
|
|
171
|
+
# PyCharm
|
|
172
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
173
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
174
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
175
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
176
|
+
#.idea/
|
|
177
|
+
|
|
178
|
+
# Abstra
|
|
179
|
+
# Abstra is an AI-powered process automation framework.
|
|
180
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
181
|
+
# Learn more at https://abstra.io/docs
|
|
182
|
+
.abstra/
|
|
183
|
+
|
|
184
|
+
# Visual Studio Code
|
|
185
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
186
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
188
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
189
|
+
# .vscode/
|
|
190
|
+
|
|
191
|
+
# Ruff stuff:
|
|
192
|
+
.ruff_cache/
|
|
193
|
+
|
|
194
|
+
# PyPI configuration file
|
|
195
|
+
.pypirc
|
|
196
|
+
|
|
197
|
+
# Marimo
|
|
198
|
+
marimo/_static/
|
|
199
|
+
marimo/_lsp/
|
|
200
|
+
__marimo__/
|
|
201
|
+
|
|
202
|
+
# Streamlit
|
|
203
|
+
.streamlit/secrets.toml
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
######### Added custom Cookiecutter PyPackage generated dirs here
|
|
207
|
+
output/
|
|
208
|
+
python_boilerplate/
|
|
209
|
+
cookiecutter-pypackage-env/
|
|
210
|
+
python-boilerplate/
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Audrey M. Roy Greenfeld
|
|
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.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cookiecutter-pypackage
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Cookiecutter template for a Python package
|
|
5
|
+
Project-URL: homepage, https://github.com/audreyfeldroy/cookiecutter-pypackage
|
|
6
|
+
Author-email: "Audrey M. Roy Greenfeld" <audrey@feldroy.com>
|
|
7
|
+
License: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Keywords: cookiecutter,package,template
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Natural Language :: English
|
|
15
|
+
Classifier: Programming Language :: Python
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
22
|
+
Classifier: Topic :: Software Development
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Requires-Dist: alabaster>=1.0.0
|
|
25
|
+
Requires-Dist: cookiecutter>=2.6.0
|
|
26
|
+
Requires-Dist: typer>=0.16.0
|
|
27
|
+
Requires-Dist: watchdog>=6.0.0
|
|
28
|
+
Provides-Extra: test
|
|
29
|
+
Requires-Dist: coverage; extra == 'test'
|
|
30
|
+
Requires-Dist: ipdb; extra == 'test'
|
|
31
|
+
Requires-Dist: pytest; extra == 'test'
|
|
32
|
+
Requires-Dist: pytest-cookies; extra == 'test'
|
|
33
|
+
Requires-Dist: ruff; extra == 'test'
|
|
34
|
+
Requires-Dist: ty; extra == 'test'
|
|
35
|
+
Description-Content-Type: text/markdown
|
|
36
|
+
|
|
37
|
+
# Cookiecutter PyPackage
|
|
38
|
+
|
|
39
|
+
[](https://pypi.python.org/pypi/cookiecutter-pypackage)
|
|
40
|
+
[](https://pypi.python.org/pypi/cookiecutter-pypackage)
|
|
41
|
+
|
|
42
|
+
[Cookiecutter](https://github.com/cookiecutter/cookiecutter) template for a Python package.
|
|
43
|
+
|
|
44
|
+
* GitHub repo: [https://github.com/audreyfeldroy/cookiecutter-pypackage/](https://github.com/audreyfeldroy/cookiecutter-pypackage/)
|
|
45
|
+
* Free software: MIT license
|
|
46
|
+
* Discord: [https://discord.gg/PWXJr3upUE](https://discord.gg/PWXJr3upUE)
|
|
47
|
+
|
|
48
|
+
## Features
|
|
49
|
+
|
|
50
|
+
* Testing setup with pytest
|
|
51
|
+
* GitHub Actions testing: Setup to easily test for Python 3.10, 3.11, 3.12, and 3.13
|
|
52
|
+
* Auto-release to [PyPI](https://pypi.python.org/pypi) when you push a new tag to main (optional)
|
|
53
|
+
* Command line interface using Typer
|
|
54
|
+
|
|
55
|
+
## Quickstart
|
|
56
|
+
|
|
57
|
+
Install the latest Cookiecutter if you haven't installed it yet:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pip install -U cookiecutter
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Generate a Python package project:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
cookiecutter https://github.com/audreyfeldroy/cookiecutter-pypackage.git
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Then:
|
|
70
|
+
|
|
71
|
+
* Create a repo and put it there.
|
|
72
|
+
* [Register](https://packaging.python.org/tutorials/packaging-projects/#uploading-the-distribution-archives) your project with PyPI.
|
|
73
|
+
* Add the repo to your [Read the Docs](https://readthedocs.io/) account + turn on the Read the Docs service hook.
|
|
74
|
+
* Release your package by pushing a new tag to main.
|
|
75
|
+
|
|
76
|
+
## Not Exactly What You Want?
|
|
77
|
+
|
|
78
|
+
Don't worry, you have options:
|
|
79
|
+
|
|
80
|
+
### Fork This / Create Your Own
|
|
81
|
+
|
|
82
|
+
If you have differences in your preferred setup, I encourage you to fork this
|
|
83
|
+
to create your own version. Or create your own; it doesn't strictly have to
|
|
84
|
+
be a fork.
|
|
85
|
+
|
|
86
|
+
### Similar Cookiecutter Templates
|
|
87
|
+
|
|
88
|
+
Explore other forks to get ideas. See the [network](https://github.com/audreyfeldroy/cookiecutter-pypackage/network) and [family tree](https://github.com/audreyfeldroy/cookiecutter-pypackage/network/members) for this repo.
|
|
89
|
+
|
|
90
|
+
### Or Submit a Pull Request
|
|
91
|
+
|
|
92
|
+
I also accept pull requests on this, if they're small, atomic, and if they
|
|
93
|
+
make my own packaging experience better.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Cookiecutter PyPackage
|
|
2
|
+
|
|
3
|
+
[](https://pypi.python.org/pypi/cookiecutter-pypackage)
|
|
4
|
+
[](https://pypi.python.org/pypi/cookiecutter-pypackage)
|
|
5
|
+
|
|
6
|
+
[Cookiecutter](https://github.com/cookiecutter/cookiecutter) template for a Python package.
|
|
7
|
+
|
|
8
|
+
* GitHub repo: [https://github.com/audreyfeldroy/cookiecutter-pypackage/](https://github.com/audreyfeldroy/cookiecutter-pypackage/)
|
|
9
|
+
* Free software: MIT license
|
|
10
|
+
* Discord: [https://discord.gg/PWXJr3upUE](https://discord.gg/PWXJr3upUE)
|
|
11
|
+
|
|
12
|
+
## Features
|
|
13
|
+
|
|
14
|
+
* Testing setup with pytest
|
|
15
|
+
* GitHub Actions testing: Setup to easily test for Python 3.10, 3.11, 3.12, and 3.13
|
|
16
|
+
* Auto-release to [PyPI](https://pypi.python.org/pypi) when you push a new tag to main (optional)
|
|
17
|
+
* Command line interface using Typer
|
|
18
|
+
|
|
19
|
+
## Quickstart
|
|
20
|
+
|
|
21
|
+
Install the latest Cookiecutter if you haven't installed it yet:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install -U cookiecutter
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Generate a Python package project:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
cookiecutter https://github.com/audreyfeldroy/cookiecutter-pypackage.git
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Then:
|
|
34
|
+
|
|
35
|
+
* Create a repo and put it there.
|
|
36
|
+
* [Register](https://packaging.python.org/tutorials/packaging-projects/#uploading-the-distribution-archives) your project with PyPI.
|
|
37
|
+
* Add the repo to your [Read the Docs](https://readthedocs.io/) account + turn on the Read the Docs service hook.
|
|
38
|
+
* Release your package by pushing a new tag to main.
|
|
39
|
+
|
|
40
|
+
## Not Exactly What You Want?
|
|
41
|
+
|
|
42
|
+
Don't worry, you have options:
|
|
43
|
+
|
|
44
|
+
### Fork This / Create Your Own
|
|
45
|
+
|
|
46
|
+
If you have differences in your preferred setup, I encourage you to fork this
|
|
47
|
+
to create your own version. Or create your own; it doesn't strictly have to
|
|
48
|
+
be a fork.
|
|
49
|
+
|
|
50
|
+
### Similar Cookiecutter Templates
|
|
51
|
+
|
|
52
|
+
Explore other forks to get ideas. See the [network](https://github.com/audreyfeldroy/cookiecutter-pypackage/network) and [family tree](https://github.com/audreyfeldroy/cookiecutter-pypackage/network/members) for this repo.
|
|
53
|
+
|
|
54
|
+
### Or Submit a Pull Request
|
|
55
|
+
|
|
56
|
+
I also accept pull requests on this, if they're small, atomic, and if they
|
|
57
|
+
make my own packaging experience better.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"full_name": "Audrey M. Roy Greenfeld",
|
|
3
|
+
"email": "audreyfeldroy@example.com",
|
|
4
|
+
"github_username": "audreyfeldroy",
|
|
5
|
+
"pypi_package_name": "python-boilerplate",
|
|
6
|
+
"project_name": "Python Boilerplate",
|
|
7
|
+
"project_slug": "{{ cookiecutter.pypi_package_name.replace('-', '_') }}",
|
|
8
|
+
"project_short_description": "Python Boilerplate contains all the boilerplate you need to create a Python package.",
|
|
9
|
+
"pypi_username": "{{ cookiecutter.github_username }}",
|
|
10
|
+
"first_version": "0.1.0",
|
|
11
|
+
"__gh_slug": "{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}"
|
|
12
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import re
|
|
2
|
+
import sys
|
|
3
|
+
|
|
4
|
+
MODULE_REGEX = r"^[_a-zA-Z][_a-zA-Z0-9]+$"
|
|
5
|
+
|
|
6
|
+
module_name = "{{ cookiecutter.project_slug}}"
|
|
7
|
+
|
|
8
|
+
if not re.match(MODULE_REGEX, module_name):
|
|
9
|
+
print(
|
|
10
|
+
"ERROR: The project slug (%s) is not a valid Python module name. "
|
|
11
|
+
"Please do not use a - and use _ instead" % module_name
|
|
12
|
+
)
|
|
13
|
+
# Exit to cancel project
|
|
14
|
+
sys.exit(1)
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "cookiecutter-pypackage"
|
|
7
|
+
version = "0.3.0"
|
|
8
|
+
description = "Cookiecutter template for a Python package"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Audrey M. Roy Greenfeld", email = "audrey@feldroy.com" }
|
|
14
|
+
]
|
|
15
|
+
keywords = ["cookiecutter", "template", "package"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Environment :: Console",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
"Natural Language :: English",
|
|
21
|
+
"License :: OSI Approved :: MIT License",
|
|
22
|
+
"Programming Language :: Python",
|
|
23
|
+
"Programming Language :: Python :: 3",
|
|
24
|
+
"Programming Language :: Python :: 3.10",
|
|
25
|
+
"Programming Language :: Python :: 3.11",
|
|
26
|
+
"Programming Language :: Python :: 3.12",
|
|
27
|
+
"Programming Language :: Python :: 3.13",
|
|
28
|
+
"Programming Language :: Python :: Implementation :: CPython",
|
|
29
|
+
"Topic :: Software Development",
|
|
30
|
+
]
|
|
31
|
+
dependencies = [
|
|
32
|
+
"cookiecutter>=2.6.0",
|
|
33
|
+
"typer>=0.16.0",
|
|
34
|
+
"alabaster>=1.0.0",
|
|
35
|
+
"watchdog>=6.0.0",
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
[project.optional-dependencies]
|
|
39
|
+
test = [
|
|
40
|
+
"coverage", # testing
|
|
41
|
+
"pytest", # testing
|
|
42
|
+
"pytest-cookies", # testing
|
|
43
|
+
"ruff", # linting
|
|
44
|
+
"ty", # checking types
|
|
45
|
+
"ipdb"
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
[project.scripts]
|
|
49
|
+
cookiecutter-pypackage = "cookiecutter_pypackage.cli:app"
|
|
50
|
+
|
|
51
|
+
[project.urls]
|
|
52
|
+
homepage = "https://github.com/audreyfeldroy/cookiecutter-pypackage"
|
|
53
|
+
|
|
54
|
+
[tool.ruff]
|
|
55
|
+
exclude = [
|
|
56
|
+
"*cookiecutter.pypi_package_name*"
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
[tool.pytest.ini_options]
|
|
60
|
+
testpaths = [
|
|
61
|
+
"tests",
|
|
62
|
+
]
|
|
63
|
+
|
|
64
|
+
[dependency-groups]
|
|
65
|
+
dev = [
|
|
66
|
+
"rust-just>=1.42.4",
|
|
67
|
+
]
|
|
68
|
+
|
|
69
|
+
[tool.hatch.build.targets.sdist]
|
|
70
|
+
include = [
|
|
71
|
+
"src/",
|
|
72
|
+
"cookiecutter.json",
|
|
73
|
+
"hooks/",
|
|
74
|
+
"{{cookiecutter.pypi_package_name}}/",
|
|
75
|
+
]
|
|
76
|
+
|
|
77
|
+
[tool.hatch.build.targets.wheel]
|
|
78
|
+
packages = ["src/cookiecutter_pypackage"]
|
|
79
|
+
|
|
80
|
+
[tool.hatch.build.targets.wheel.force-include]
|
|
81
|
+
"cookiecutter.json" = "cookiecutter_pypackage/template/cookiecutter.json"
|
|
82
|
+
"hooks" = "cookiecutter_pypackage/template/hooks"
|
|
83
|
+
"{{cookiecutter.pypi_package_name}}" = "cookiecutter_pypackage/template/{{cookiecutter.pypi_package_name}}"
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"""CLI for cookiecutter-pypackage.
|
|
2
|
+
|
|
3
|
+
Usage:
|
|
4
|
+
uvx cookiecutter-pypackage
|
|
5
|
+
uvx cookiecutter-pypackage --no-input
|
|
6
|
+
uvx cookiecutter-pypackage -o /path/to/output
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
from typing import Optional
|
|
11
|
+
|
|
12
|
+
import typer
|
|
13
|
+
from cookiecutter.main import cookiecutter
|
|
14
|
+
|
|
15
|
+
app = typer.Typer(
|
|
16
|
+
help="Generate a Python package from the cookiecutter-pypackage template.",
|
|
17
|
+
add_completion=False,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@app.command()
|
|
22
|
+
def main(
|
|
23
|
+
output_dir: Optional[Path] = typer.Option(
|
|
24
|
+
None, "--output-dir", "-o", help="Where to output the generated project"
|
|
25
|
+
),
|
|
26
|
+
no_input: bool = typer.Option(
|
|
27
|
+
False, "--no-input", help="Do not prompt for parameters, use defaults"
|
|
28
|
+
),
|
|
29
|
+
) -> None:
|
|
30
|
+
"""Generate a new Python package from the cookiecutter-pypackage template."""
|
|
31
|
+
# Template is bundled inside the package
|
|
32
|
+
template_dir = Path(__file__).parent / "template"
|
|
33
|
+
|
|
34
|
+
# Run cookiecutter with the bundled template
|
|
35
|
+
cookiecutter(
|
|
36
|
+
str(template_dir),
|
|
37
|
+
output_dir=str(output_dir) if output_dir else ".",
|
|
38
|
+
no_input=no_input,
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
if __name__ == "__main__":
|
|
43
|
+
app()
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# https://editorconfig.org
|
|
2
|
+
root = true
|
|
3
|
+
|
|
4
|
+
[*]
|
|
5
|
+
charset = utf-8
|
|
6
|
+
end_of_line = lf
|
|
7
|
+
indent_style = space
|
|
8
|
+
indent_size = 4
|
|
9
|
+
trim_trailing_whitespace = true
|
|
10
|
+
insert_final_newline = true
|
|
11
|
+
|
|
12
|
+
[*.{html,css,js,json,sh,yml,yaml}]
|
|
13
|
+
indent_size = 2
|
|
14
|
+
|
|
15
|
+
[*.bat]
|
|
16
|
+
indent_style = tab
|
|
17
|
+
end_of_line = crlf
|
|
18
|
+
|
|
19
|
+
[LICENSE]
|
|
20
|
+
insert_final_newline = false
|
|
21
|
+
|
|
22
|
+
[Makefile]
|
|
23
|
+
indent_style = tab
|
|
24
|
+
indent_size = unset
|
|
25
|
+
|
|
26
|
+
# Ignore binary or generated files
|
|
27
|
+
[*.{png,jpg,gif,ico,woff,woff2,ttf,eot,svg,pdf}]
|
|
28
|
+
charset = unset
|
|
29
|
+
end_of_line = unset
|
|
30
|
+
indent_style = unset
|
|
31
|
+
indent_size = unset
|
|
32
|
+
trim_trailing_whitespace = unset
|
|
33
|
+
insert_final_newline = unset
|
|
34
|
+
max_line_length = unset
|
|
35
|
+
|
|
36
|
+
[*.{diff,patch}]
|
|
37
|
+
trim_trailing_whitespace = false
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
* {{ cookiecutter.project_name }} version:
|
|
2
|
+
* Python version:
|
|
3
|
+
* Operating System:
|
|
4
|
+
|
|
5
|
+
### Description
|
|
6
|
+
|
|
7
|
+
Describe what you were trying to get done.
|
|
8
|
+
Tell us what happened, what went wrong, and what you expected to happen.
|
|
9
|
+
|
|
10
|
+
### What I Did
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
Paste the command(s) you ran and the output.
|
|
14
|
+
If there was a crash, please include the traceback here.
|
|
15
|
+
```
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags: ['v*']
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
publish:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
permissions:
|
|
11
|
+
id-token: write # Required for Trusted Publishers
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
- uses: astral-sh/setup-uv@v5
|
|
15
|
+
- run: uv build
|
|
16
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# This workflow will install Python dependencies, run tests and lint.
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/use-cases-and-examples/building-and-testing/building-and-testing-python
|
|
3
|
+
|
|
4
|
+
name: Test Python application
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches: [ "main", "master" ]
|
|
9
|
+
pull_request:
|
|
10
|
+
branches: [ "main", "master" ]
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
build:
|
|
17
|
+
strategy:
|
|
18
|
+
matrix:
|
|
19
|
+
# Test all supported Python versions under Ubuntu
|
|
20
|
+
os: [ubuntu-latest]
|
|
21
|
+
python-version: ['3.12', '3.13', '3.14']
|
|
22
|
+
|
|
23
|
+
runs-on: {% raw %}${{ matrix.os }}{% endraw %}
|
|
24
|
+
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@v4
|
|
27
|
+
- name: Set up uv
|
|
28
|
+
uses: astral-sh/setup-uv@v5
|
|
29
|
+
with:
|
|
30
|
+
python-version: {% raw %}${{ matrix.python-version }}{% endraw %}
|
|
31
|
+
- name: Lint with ruff
|
|
32
|
+
run: |
|
|
33
|
+
# stop the build if there are Python syntax errors or undefined names
|
|
34
|
+
uv run ruff check --select=E9,F63,F7,F82
|
|
35
|
+
# exit-zero treats all errors as warnings
|
|
36
|
+
uv run ruff check --exit-zero --statistics
|
|
37
|
+
- name: Run tests
|
|
38
|
+
run: |
|
|
39
|
+
uv run pytest
|