templatepy 0.0.3__tar.gz → 0.2.3__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 (28) hide show
  1. {templatepy-0.0.3 → templatepy-0.2.3}/.bumpversion.cfg +6 -6
  2. {templatepy-0.0.3 → templatepy-0.2.3}/.pre-commit-config.yaml +1 -1
  3. templatepy-0.2.3/.secrets.baseline +127 -0
  4. templatepy-0.2.3/CODE_OF_CONDUCT.md +128 -0
  5. templatepy-0.2.3/CONTRIBUTING.md +7 -0
  6. templatepy-0.2.3/PKG-INFO +374 -0
  7. templatepy-0.2.3/README.md +318 -0
  8. templatepy-0.2.3/pyproject.toml +85 -0
  9. templatepy-0.2.3/setup.cfg +4 -0
  10. {templatepy-0.0.3 → templatepy-0.2.3}/templatepy/__init__.py +2 -2
  11. templatepy-0.2.3/templatepy.egg-info/PKG-INFO +374 -0
  12. {templatepy-0.0.3 → templatepy-0.2.3}/templatepy.egg-info/SOURCES.txt +3 -1
  13. {templatepy-0.0.3 → templatepy-0.2.3}/templatepy.egg-info/requires.txt +2 -3
  14. {templatepy-0.0.3 → templatepy-0.2.3}/templatepy.egg-info/top_level.txt +1 -0
  15. templatepy-0.0.3/PKG-INFO +0 -141
  16. templatepy-0.0.3/README.md +0 -121
  17. templatepy-0.0.3/pyproject.toml +0 -24
  18. templatepy-0.0.3/setup.cfg +0 -56
  19. templatepy-0.0.3/templatepy.egg-info/PKG-INFO +0 -141
  20. {templatepy-0.0.3 → templatepy-0.2.3}/.gitignore +0 -0
  21. {templatepy-0.0.3 → templatepy-0.2.3}/LICENSE +0 -0
  22. {templatepy-0.0.3 → templatepy-0.2.3}/MANIFEST.in +0 -0
  23. {templatepy-0.0.3 → templatepy-0.2.3}/setup.py +0 -0
  24. {templatepy-0.0.3 → templatepy-0.2.3}/templatepy/example.data.file.config +0 -0
  25. {templatepy-0.0.3 → templatepy-0.2.3}/templatepy/example.data.file.test-extension-yu48 +0 -0
  26. {templatepy-0.0.3 → templatepy-0.2.3}/templatepy.egg-info/dependency_links.txt +0 -0
  27. {templatepy-0.0.3 → templatepy-0.2.3}/templatepy.egg-info/entry_points.txt +0 -0
  28. {templatepy-0.0.3 → templatepy-0.2.3}/templatepy.egg-info/not-zip-safe +0 -0
@@ -1,8 +1,8 @@
1
1
  [bumpversion]
2
- current_version = 0.0.3
2
+ current_version = 0.2.3
3
3
  commit = True
4
- tag = True
5
- tag_name = {new_version}
4
+ tag = False
5
+ tag_name = v{new_version}
6
6
  sign_tags = False
7
7
  message = "Upgrade: {current_version} → {new_version}"
8
8
  parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.(?P<release>[a-z]+)(?P<build>\d+))?
@@ -19,9 +19,9 @@ values =
19
19
 
20
20
  [bumpversion:part:build]
21
21
 
22
- [bumpversion:file:setup.cfg]
23
- search = version = {current_version}
24
- replace = version = {new_version}
22
+ [bumpversion:file:pyproject.toml]
23
+ search = version = "{current_version}"
24
+ replace = version = "{new_version}"
25
25
 
26
26
  [bumpversion:file:README.md]
27
27
  search = Version: "{current_version}"
@@ -4,7 +4,7 @@ repos:
4
4
  hooks:
5
5
  - id: reorder-python-imports
6
6
  - repo: https://github.com/ambv/black
7
- rev: 21.12b0
7
+ rev: 22.6.0
8
8
  hooks:
9
9
  - id: black
10
10
  - repo: https://github.com/pre-commit/pre-commit-hooks
@@ -0,0 +1,127 @@
1
+ {
2
+ "version": "1.5.0",
3
+ "plugins_used": [
4
+ {
5
+ "name": "ArtifactoryDetector"
6
+ },
7
+ {
8
+ "name": "AWSKeyDetector"
9
+ },
10
+ {
11
+ "name": "AzureStorageKeyDetector"
12
+ },
13
+ {
14
+ "name": "Base64HighEntropyString",
15
+ "limit": 4.5
16
+ },
17
+ {
18
+ "name": "BasicAuthDetector"
19
+ },
20
+ {
21
+ "name": "CloudantDetector"
22
+ },
23
+ {
24
+ "name": "DiscordBotTokenDetector"
25
+ },
26
+ {
27
+ "name": "GitHubTokenDetector"
28
+ },
29
+ {
30
+ "name": "GitLabTokenDetector"
31
+ },
32
+ {
33
+ "name": "HexHighEntropyString",
34
+ "limit": 3.0
35
+ },
36
+ {
37
+ "name": "IbmCloudIamDetector"
38
+ },
39
+ {
40
+ "name": "IbmCosHmacDetector"
41
+ },
42
+ {
43
+ "name": "IPPublicDetector"
44
+ },
45
+ {
46
+ "name": "JwtTokenDetector"
47
+ },
48
+ {
49
+ "name": "KeywordDetector",
50
+ "keyword_exclude": ""
51
+ },
52
+ {
53
+ "name": "MailchimpDetector"
54
+ },
55
+ {
56
+ "name": "NpmDetector"
57
+ },
58
+ {
59
+ "name": "OpenAIDetector"
60
+ },
61
+ {
62
+ "name": "PrivateKeyDetector"
63
+ },
64
+ {
65
+ "name": "PypiTokenDetector"
66
+ },
67
+ {
68
+ "name": "SendGridDetector"
69
+ },
70
+ {
71
+ "name": "SlackDetector"
72
+ },
73
+ {
74
+ "name": "SoftlayerDetector"
75
+ },
76
+ {
77
+ "name": "SquareOAuthDetector"
78
+ },
79
+ {
80
+ "name": "StripeDetector"
81
+ },
82
+ {
83
+ "name": "TelegramBotTokenDetector"
84
+ },
85
+ {
86
+ "name": "TwilioKeyDetector"
87
+ }
88
+ ],
89
+ "filters_used": [
90
+ {
91
+ "path": "detect_secrets.filters.allowlist.is_line_allowlisted"
92
+ },
93
+ {
94
+ "path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies",
95
+ "min_level": 2
96
+ },
97
+ {
98
+ "path": "detect_secrets.filters.heuristic.is_indirect_reference"
99
+ },
100
+ {
101
+ "path": "detect_secrets.filters.heuristic.is_likely_id_string"
102
+ },
103
+ {
104
+ "path": "detect_secrets.filters.heuristic.is_lock_file"
105
+ },
106
+ {
107
+ "path": "detect_secrets.filters.heuristic.is_not_alphanumeric_string"
108
+ },
109
+ {
110
+ "path": "detect_secrets.filters.heuristic.is_potential_uuid"
111
+ },
112
+ {
113
+ "path": "detect_secrets.filters.heuristic.is_prefixed_with_dollar_sign"
114
+ },
115
+ {
116
+ "path": "detect_secrets.filters.heuristic.is_sequential_string"
117
+ },
118
+ {
119
+ "path": "detect_secrets.filters.heuristic.is_swagger_file"
120
+ },
121
+ {
122
+ "path": "detect_secrets.filters.heuristic.is_templated_secret"
123
+ }
124
+ ],
125
+ "results": {},
126
+ "generated_at": "2024-11-29T20:27:51Z"
127
+ }
@@ -0,0 +1,128 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ L.B.Rollik@protonmail.com.
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series
86
+ of actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or
93
+ permanent ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within
113
+ the community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.0, available at
119
+ https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120
+
121
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct
122
+ enforcement ladder](https://github.com/mozilla/diversity).
123
+
124
+ [homepage]: https://www.contributor-covenant.org
125
+
126
+ For answers to common questions about this code of conduct, see the FAQ at
127
+ https://www.contributor-covenant.org/faq. Translations are available at
128
+ https://www.contributor-covenant.org/translations.
@@ -0,0 +1,7 @@
1
+ ## Contributing
2
+
3
+ Contributions are absolutely encouraged, for bug fixes, new features, etc.
4
+
5
+ If you are not sure where to start, check out the [issues](https://github.com/larsrollik/templatepy/issues).
6
+
7
+ Please get in touch via [email](mailto:L.B.Rollik@protonmail.com) for other queries.
@@ -0,0 +1,374 @@
1
+ Metadata-Version: 2.1
2
+ Name: templatepy
3
+ Version: 0.2.3
4
+ Summary: templatepy: template for derivative python packages
5
+ Author-email: "Lars B. Rollik" <L.B.Rollik@protonmail.com>
6
+ License: BSD 3-Clause License
7
+
8
+ Copyright (c) 2021, Lars B. Rollik
9
+ All rights reserved.
10
+
11
+ Redistribution and use in source and binary forms, with or without
12
+ modification, are permitted provided that the following conditions are met:
13
+
14
+ 1. Redistributions of source code must retain the above copyright notice, this
15
+ list of conditions and the following disclaimer.
16
+
17
+ 2. Redistributions in binary form must reproduce the above copyright notice,
18
+ this list of conditions and the following disclaimer in the documentation
19
+ and/or other materials provided with the distribution.
20
+
21
+ 3. Neither the name of the copyright holder nor the names of its
22
+ contributors may be used to endorse or promote products derived from
23
+ this software without specific prior written permission.
24
+
25
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
29
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
33
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35
+
36
+ Project-URL: Repository, https://github.com/larsrollik/templatepy
37
+ Project-URL: Issue Tracker, https://github.com/larsrollik/templatepy/issues
38
+ Classifier: Intended Audience :: Developers
39
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
40
+ Classifier: License :: OSI Approved :: BSD License
41
+ Classifier: Programming Language :: Python
42
+ Classifier: Programming Language :: Python :: 3
43
+ Classifier: Programming Language :: Python :: 3.10
44
+ Classifier: Programming Language :: Python :: 3.11
45
+ Requires-Python: >=3.10
46
+ Description-Content-Type: text/markdown
47
+ License-File: LICENSE
48
+ Requires-Dist: black
49
+ Provides-Extra: dev
50
+ Requires-Dist: black; extra == "dev"
51
+ Requires-Dist: bump2version; extra == "dev"
52
+ Requires-Dist: pytest-cov; extra == "dev"
53
+ Requires-Dist: pre-commit; extra == "dev"
54
+ Requires-Dist: flake8; extra == "dev"
55
+ Requires-Dist: toml; extra == "dev"
56
+
57
+ [//]: # (Links)
58
+ [Github-flavored markdown]: https://github.github.com/gfm
59
+
60
+ [manifest]: https://packaging.python.org/en/latest/guides/using-manifest-in
61
+ [packaging]: https://packaging.python.org/en/latest/tutorials/packaging-projects
62
+ [setup.cfg]: https://setuptools.pypa.io/en/latest/userguide/declarative_config.html
63
+
64
+ [bump2version]: (https://github.com/c4urself/bump2version
65
+ [pre-commit]: https://pre-commit.com
66
+ [black]: https://github.com/psf/black
67
+
68
+ [pypi]: pypi.org
69
+ [test.pypi]: test.pypi.org
70
+
71
+ [Zenodo]: https://zenodo.org
72
+
73
+ [contribution guidelines]: https://github.com/larsrollik/templatepy/blob/main/CONTRIBUTING.md
74
+ [issues]: https://github.com/larsrollik/templatepy/issues
75
+ [BSD 3-Clause License]: https://github.com/larsrollik/templatepy/blob/main/LICENSE
76
+ [Github]: https://github.com/larsrollik/templatepy/settings/secrets/actions/new
77
+ [release]: https://github.com/larsrollik/templatepy/releases/new
78
+
79
+ [//]: # (Badges)
80
+
81
+ [![Contributions](https://img.shields.io/badge/Contributions-Welcome-brightgreen.svg)](https://github.com/larsrollik/templatepy/blob/main/CONTRIBUTING.md)
82
+ [![DOI](https://zenodo.org/badge/370470893.svg)](https://zenodo.org/badge/latestdoi/370470893)
83
+ [![Website](https://img.shields.io/website?up_message=online&url=https%3A%2F%2Fgithub.com/larsrollik/templatepy)](https://github.com/larsrollik/templatepy)
84
+ [![PyPI](https://img.shields.io/pypi/v/templatepy.svg)](https://pypi.org/project/templatepy)
85
+ [![Wheel](https://img.shields.io/pypi/wheel/templatepy.svg)](https://pypi.org/project/templatepy)
86
+ ![CI](https://github.com/larsrollik/templatepy/workflows/tests/badge.svg)
87
+ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/python/black)
88
+ [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
89
+
90
+
91
+ # templatepy
92
+ Template repo for python repositories & PyPi integration
93
+ ---
94
+ **Version: "0.2.3"**
95
+
96
+
97
+ ## Usage
98
+ 1. **Change** files according to overview in `TODO` below
99
+ 2. **Develop** package...
100
+ 3. **Install** package:
101
+ - static/normal install: `pip install .`
102
+ - editable install:`pip install -e .`
103
+ - dev install: `pip install -e .[dev]` (some terminals require to escape brackets with ` \ ` as `\[`, esp. zsh)
104
+
105
+
106
+
107
+ ## File overview
108
+
109
+
110
+ ### General
111
+ - `LICENSE`: license text
112
+
113
+ - `README.md`: [Github-flavored markdown] file
114
+
115
+ - `templatepy`: placeholder folder for any python package that is configured for install via `setup.cfg` and `pyproject.toml`
116
+ - `__init__.py`: contains basic package info and example function that is called by console entrypoint (see `setup.cfg`)
117
+ - `example.data.file.config`: a file to demonstrate that data files are included based on `setup.cfg` criteria
118
+ - `example.data.file.test-extension-yu48`: a file to demonstrate data exclusion via `setup.py`
119
+
120
+
121
+ ### Testing
122
+ - `tests`: placeholder folder for unit/integration tests and associated data
123
+ - `pytest.ini`: config for testing framework with `pytest` and `coverage` plugin (`pytest-cov`)
124
+
125
+
126
+ ### Packaging System (see: [packaging] and [pyproject.toml])
127
+
128
+ - **`MANIFEST.in`**:
129
+ Defines additional files to include/exclude in the build (if not automatically detected).
130
+
131
+ - **`pyproject.toml`**:
132
+ Central configuration file that replaces the traditional `setup.cfg` and `setup.py` files:
133
+ - **Build System**: Specifies the build system requirements and configuration, as defined in [PEP 518](https://peps.python.org/pep-0518/) and [PEP 621](https://peps.python.org/pep-0621/).
134
+ - **Package Metadata**: Includes the project's metadata (name, version, dependencies, etc.).
135
+ - **Code Formatting**: Configuration for tools like [black] and [flake8] (if used).
136
+ - **Optional Dependencies**: Organizes extra dependencies for development or other environments.
137
+
138
+ - **`setup.py`**:
139
+ Legacy file retained only for backward compatibility if needed (e.g., older tooling). New projects should avoid it entirely.
140
+
141
+
142
+ ## CI Workflow Overview
143
+
144
+ The CI workflow is triggered on push to `main` or when a tag is created. It ensures code quality and automates the release process:
145
+
146
+ 1. **Linting and Testing**:
147
+ - `lint`: Checks code style with `black` and `flake8`, runs pre-commit hooks.
148
+ - `test`: Runs tests with `pytest` and generates coverage reports.
149
+
150
+ 2. **Tag Validation**:
151
+ - `check-tag`: Verifies that the tag is valid (not `dev` or `rc`) before proceeding.
152
+
153
+ 3. **Release Creation**:
154
+ - `release`: Creates a GitHub release when the tag is valid.
155
+
156
+ 4. **Deployment to PyPI**:
157
+ - `deploy`: Builds and uploads the package to PyPI using `twine`.
158
+
159
+ The pipeline ensures code quality, passing tests, and automated deployment on new releases.
160
+
161
+ ### Testing CI Locally
162
+
163
+ - Install `act`:
164
+ - **macOS/Linux**: `brew install act` / `sudo apt install act`
165
+ - **Windows**: Download from [act GitHub Releases](https://github.com/nektos/act/releases) and follow the installation instructions.
166
+ - Ensure Docker is installed and running. Download from [Docker Desktop](https://www.docker.com/products/docker).
167
+ - Run the CI workflow with `act`:
168
+ ```bash
169
+ act push
170
+ act push --verbose # very verbose output !
171
+ ```
172
+
173
+
174
+ ### Code maintenance (linting/formatting/github)
175
+ - `.pre-commit-config.yaml`: use [pre-commit] to run code formatting (e.g. with [black] and `flake8`) and PEP compliance checks
176
+ - Install pre-commit hook with `pre-commit install` (Note: only installs it in the current virtual environment)
177
+ - Run it manually with `pre-commit run --all` or leave it to run on commit (requires to re-stage changed files!)
178
+
179
+ - `.github`: folder that contains github automation workflows and issues templates
180
+
181
+ - `.gitignore`: ignored files/folders in git tools
182
+
183
+ - `.bumpversion.cfg`: config for [bump2version]
184
+
185
+ ## TODO for **adapting** template to new project
186
+
187
+ - [ ] Change package name:
188
+ - (1) Rename the `templatepy` folder.
189
+ - (2) Update all occurrences of `templatepy` in `README.md`.
190
+ - (3) Update the `name` field in `pyproject.toml`.
191
+ - (4) (optional) Update `.github/workflows` files.
192
+ - (5) Reset version references in `pyproject.toml` and `templatepy/__init__.py` to `0.0.0.dev0`.
193
+ - [ ] Update project author and metadata details in `pyproject.toml`, `README.md`, and `templatepy/__init__.py`.
194
+ - [ ] Update the license holder in the `LICENSE` file.
195
+ - [ ] Update `README.md` badge paths at the top.
196
+ - [ ] Verify inclusions/exclusions of installable files/folders in `MANIFEST.in` and `pyproject.toml` under `[tool.setuptools]`.
197
+ - [ ] Ensure `.gitignore` contains relevant entries for the new project.
198
+ - [ ] Add all version string locations to `[tool.bump2version]` in `pyproject.toml`.
199
+ - Use syntax like `[bumpversion:file:templatepy/__init__.py]` to specify locations for version updates.
200
+ - [ ] To upload to [PyPI], follow the instructions in the section below.
201
+ - [ ] To upload to [Zenodo] (if the repository is for a publication):
202
+ - (1) Connect Zenodo to your GitHub account.
203
+ - (2) Enable Zenodo integration for the repository (Zenodo requires the repository to be **public**).
204
+ - (3) Create a new GitHub release (manually or via `.github/workflows/CI.yaml`).
205
+ - (4) Wait for Zenodo to sync and assign a DOI (this usually takes about a minute).
206
+ - (5) Add the DOI badge to `README.md`.
207
+
208
+
209
+ ## Workflow for Automatically Uploading Package to [PyPI] or [Test PyPI]
210
+
211
+ 1. **Generate a PyPI API Key**:
212
+ - Go to [PyPI](https://pypi.org/) and create a new API key, either specific to the repository or a general-purpose key.
213
+
214
+ 2. **Add the API Key to GitHub**:
215
+ - In your repository's settings on [GitHub](https://github.com/):
216
+ - Navigate to **Settings > Secrets and variables > Actions**.
217
+ - Add a new **Actions secret** with the name `TWINE_API_KEY`.
218
+ - Paste the PyPI API key into the secret's value field.
219
+
220
+ 3. **Create a New Release**:
221
+ - On [GitHub](https://github.com/), create a new release manually via the **Releases** page.
222
+ - Use a version number without a release extension (e.g., `x.y.z`).
223
+ - Alternatively, trigger the GitHub workflow configured for releasing by incrementing the version with `bump2version` (see info below)
224
+ - Desperately, manually update the version strings in the relevant files and add git commit tag to trigger the release workflow on push
225
+
226
+ The package will then be automatically uploaded to [PyPI](https://pypi.org/) or [Test PyPI](https://test.pypi.org/) as configured in your CI/CD workflow.
227
+
228
+
229
+ ## Using `bump2version` for Versioning
230
+
231
+ `bump2version` is used to increment version numbers based on semantic versioning. Here’s how you can use it with the current setup to trigger a release:
232
+
233
+ 1. **Bumping the Minor Version**:
234
+ Increment the minor version (e.g., from `v1.2.3` to `v1.3.0`):
235
+ ```bash
236
+ # Bumping the minor Version:
237
+ bump2version minor
238
+
239
+ # Bumping the major version (e.g., from v1.2.3 to v2.0.0):
240
+ bump2version major
241
+
242
+ # Bumping for a release Version (e.g., from v1.0.0.dev to v1.0.0.rc or v1.0.0):
243
+ bump2version release
244
+ ```
245
+
246
+ ## Workflows Summary
247
+
248
+ | **Workflow** | **Triggers** | **Purpose** | **Outputs** |
249
+ |----------------------------|---------------------------------------------------|--------------------------------------------|----------------------------------------|
250
+ | **Lint and Test** | Push to any branch | Runs linting and testing for Python code | Ensures code quality and functionality |
251
+ | **Release to PyPI** | Push to `prod` branch with a tag (e.g., `v1.0.0`) | Builds and uploads the package to PyPI | Publishes a new release on PyPI |
252
+ | **Squash Merge to `prod`** | Pull requests merged into `main` | Squashes and merges commits into `prod` | Maintains clean history in `prod` |
253
+ | **AI Pull Request Review** | Pull request events (`opened`, `synchronize`) | Provides AI-generated pull request reviews | Adds review comments to the PR |
254
+
255
+
256
+ ## Required Repository Secrets
257
+
258
+ | **Secret** | **Purpose** | **How to Obtain** |
259
+ |------------------|---------------------------------------------|---------------------------------------------------------------------------------------------|
260
+ | `TWINE_API_KEY` | Authentication for publishing to PyPI | Generate from [PyPI Account Settings](https://pypi.org/manage/account/) under "API Tokens." |
261
+ | `OPENAI_API_KEY` | Required for AI Pull Request Reviewer | Generate from [OpenAI API Settings](https://platform.openai.com/account/api-keys). |
262
+ | `GITHUB_TOKEN` | Built-in token for accessing the repository | Automatically provided by GitHub (no setup needed). |
263
+
264
+
265
+ ## Github Flow overview
266
+
267
+
268
+ 1) Create a new feature branch from main using git checkout -b.
269
+ 2) Make and commit a dummy change (e.g., adding a file).
270
+ 3) Use bumpversion to bump the version (you can adjust patch, minor, or major based on what change you want), and create a release tag.
271
+ 4) Push both the feature branch and the release tag to the remote repository.
272
+ 5) Open a pull request using GitHub CLI (gh pr create) or the GitHub UI to merge the feature branch into main.
273
+ 6) After the PR is merged, delete the feature branch both locally and remotely.
274
+
275
+ ### Example commands for the workflow:
276
+
277
+ ```bash
278
+ # 1. Checkout a new feature branch from main
279
+ git checkout main # Ensure you are on the main branch
280
+ git pull origin main # Fetch latest changes from main
281
+ git checkout -b feature/my-new-feature # Create and switch to a new feature branch
282
+
283
+ # 2. Make a dummy commit (e.g., add a new file or change)
284
+ echo "Some feature work" > feature.txt # Add a new file or make a change
285
+ git add feature.txt # Stage the file for commit
286
+ git commit -m "Add feature.txt - dummy commit" # Commit the changes
287
+
288
+ # 3. Bump the version and automatically tag the release
289
+ # (Bumpversion will handle both version bumping and tagging)
290
+ bumpversion patch # Bumps version, e.g., from v0.1.0 to v0.1.1 (adjust based on version part you want)
291
+
292
+ # 4. Push the changes to remote (feature branch and the tag)
293
+ git push origin feature/my-new-feature # Push the feature branch
294
+ git push origin --tags # Push the new tag(s) created by bumpversion
295
+
296
+ # 5. Open a pull request from the feature branch to the main branch
297
+ # This can be done via GitHub UI, or using GitHub CLI
298
+ gh pr create --base main --head feature/my-new-feature --title "New Feature" --body "This is a new feature that adds feature.txt."
299
+
300
+ # 6. After the PR is accepted and merged, delete the feature branch locally and remotely
301
+ git checkout main # Switch back to main branch
302
+ git pull origin main # Ensure your main branch is up-to-date
303
+ git branch -d feature/my-new-feature # Delete the local feature branch
304
+ git push origin --delete feature/my-new-feature # Delete the remote feature branch
305
+
306
+ ```
307
+
308
+ ## Notes
309
+
310
+ #### New(er) Build System with `pyproject.toml` and `setup.cfg`
311
+
312
+ Historically, packaging in Python was governed by standards such as `PEP-426`, `PEP-517`, and `PEP-518`. These PEPs introduced various mechanisms for packaging and building Python projects, but with certain limitations, especially regarding flexibility and future-proofing.
313
+
314
+ - **PEP-426**: Introduced the `setup.cfg` and `setup.py` files as the standard way to define package metadata and build configuration.
315
+ - **PEP-517**: Introduced a standardized interface for building Python projects, separating the build process from the packaging process and allowing for more flexible build systems.
316
+ - **PEP-518**: Defined how `pyproject.toml` should be used to declare build dependencies and system requirements, allowing tools like `pip` to know which backend to use for the build process.
317
+
318
+ While these PEPs were important milestones, the latest changes to the packaging ecosystem make `pyproject.toml` the preferred way to configure projects going forward.
319
+
320
+ - **`pip`**:
321
+ - Tested with `pip install . --use-feature=in-tree-build` for forward compatibility with `pip 21.3` and later.
322
+ - While `setup.py` is technically optional, an empty `setup.py` is still kept for enabling editable installs (`pip install -e .`), as this requires such a file for now.
323
+ - `wheel` is added as a build-system dependency to maintain compatibility with versions of `pip` that do not yet fully implement `PEP 517`.
324
+
325
+ - **Replacing `setup.cfg` and `setup.py` with `pyproject.toml`**:
326
+ - In the modern packaging ecosystem, `pyproject.toml` is increasingly the standard for declaring build systems, dependencies, and metadata. This configuration file simplifies the process and eliminates the need for separate `setup.py` and `setup.cfg` files in many cases.
327
+
328
+ For further reading on the transition to `pyproject.toml` and the removal of `setup.py`/`setup.cfg`, see the following discussions:
329
+ - [PEP-426](https://peps.python.org/pep-0426/)
330
+ - [PEP-517](https://peps.python.org/pep-0517/)
331
+ - [PEP-518](https://peps.python.org/pep-0518/)
332
+ - [Discussion on Setup.cfg Deprecation](https://stackoverflow.com/questions/44878600/is-setup-cfg-deprecated)
333
+
334
+
335
+ ## Common issues
336
+
337
+ ### `bump2version` fails on git tag with exit status 128
338
+
339
+ - check a signing key is configured: `git config --global user.signingkey` (see below for generating a key)
340
+ - repo is a detached HEAD? check out a branch: `git checkout main`
341
+ - there are changes that need to be committed? `git commit -am "commit message"`
342
+ - tag already exists? `git tag` to list tags, `git tag -d <tag>` to delete a tag
343
+
344
+ ### no gpg key for signing commits
345
+ - generate a key with `gpg --full-generate-key`
346
+ - list keys with `gpg --list-secret-keys --keyid-format LONG`
347
+ - set the key for signing commits with `git config --global user.signingkey <key-id>`
348
+ - enable signing commits with `git config --global commit.gpgsign true`
349
+ - set the key for signing tags with `git config --global tag.gpgSign true`
350
+ - export the public key with `gpg --armor --export <key-id>`
351
+ - and add it to your GitHub account: select 'New key' -> paste output of command above
352
+
353
+ Which one is the key id you might ask?
354
+ ```
355
+ /home/user/.gnupg/secring.gpg
356
+ ------------------------------
357
+ sec 4096R/<KEY_ID> 2024-11-22 [expires: 2025-11-22]
358
+ uid Your Name <youremail@example.com>
359
+ ssb 4096R/<KEY_SUBKEY_ID> 2024-11-22
360
+
361
+ ```
362
+
363
+ ### GPG hangs/errors and never asks for passphrase of key?
364
+
365
+ - try: `export GPG_TTY=$(tty)`
366
+
367
+
368
+ ## Contributing
369
+ Contributions are very welcome!
370
+ Please see the [contribution guidelines] or check out the [issues]
371
+
372
+
373
+ ## License
374
+ This software is released under the **[BSD 3-Clause License]**