templatepy 0.2.6.dev0__py3-none-any.whl → 0.2.8.dev0__py3-none-any.whl
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.
- templatepy/__init__.py +8 -2
- {templatepy-0.2.6.dev0.dist-info → templatepy-0.2.8.dev0.dist-info}/METADATA +25 -12
- templatepy-0.2.8.dev0.dist-info/RECORD +11 -0
- {templatepy-0.2.6.dev0.dist-info → templatepy-0.2.8.dev0.dist-info}/WHEEL +1 -1
- tests/tests/test_integration/test_placeholder.py +5 -8
- tests/tests/test_unit/test_unit.py +5 -7
- templatepy-0.2.6.dev0.dist-info/RECORD +0 -11
- {templatepy-0.2.6.dev0.dist-info → templatepy-0.2.8.dev0.dist-info}/LICENSE +0 -0
- {templatepy-0.2.6.dev0.dist-info → templatepy-0.2.8.dev0.dist-info}/entry_points.txt +0 -0
- {templatepy-0.2.6.dev0.dist-info → templatepy-0.2.8.dev0.dist-info}/top_level.txt +0 -0
templatepy/__init__.py
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
__author__ = "Lars B. Rollik"
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
4
|
+
|
|
5
|
+
try:
|
|
6
|
+
__version__ = version("subject_weight_db")
|
|
7
|
+
except PackageNotFoundError:
|
|
8
|
+
__version__ = "0.2.8.dev0"
|
|
3
9
|
|
|
4
10
|
|
|
5
11
|
def run():
|
|
6
|
-
"""Example `run` function for entrypoint in `
|
|
12
|
+
"""Example `run` function for entrypoint defined in `pyproject.toml`."""
|
|
7
13
|
print("Hello, world!")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: templatepy
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.8.dev0
|
|
4
4
|
Summary: templatepy: Template repo for python repositories & PyPi integration
|
|
5
5
|
Author-email: "Lars B. Rollik" <L.B.Rollik@protonmail.com>
|
|
6
6
|
License: BSD 3-Clause License
|
|
@@ -64,7 +64,10 @@ Requires-Dist: toml; extra == "dev"
|
|
|
64
64
|
|
|
65
65
|
[bump2version]: (https://github.com/c4urself/bump2version
|
|
66
66
|
[pre-commit]: https://pre-commit.com
|
|
67
|
-
|
|
67
|
+
|
|
68
|
+
[//]: # ([black]: https://github.com/psf/black)
|
|
69
|
+
[ruff]: https://docs.astral.sh/ruff
|
|
70
|
+
[mypy]: https://mypy.readthedocs.io
|
|
68
71
|
|
|
69
72
|
[pypi]: pypi.org
|
|
70
73
|
[test.pypi]: test.pypi.org
|
|
@@ -85,14 +88,13 @@ Requires-Dist: toml; extra == "dev"
|
|
|
85
88
|
[](https://pypi.org/project/templatepy)
|
|
86
89
|
[](https://pypi.org/project/templatepy)
|
|
87
90
|

|
|
88
|
-
[](https://github.com/python/black)
|
|
89
91
|
[](https://github.com/pre-commit/pre-commit)
|
|
90
92
|
|
|
91
93
|
|
|
92
94
|
# templatepy
|
|
93
95
|
Template repo for python repositories & PyPi integration
|
|
94
96
|
---
|
|
95
|
-
**Version: "0.2.
|
|
97
|
+
**Version: "0.2.8.dev0"**
|
|
96
98
|
|
|
97
99
|
|
|
98
100
|
## Usage
|
|
@@ -133,7 +135,7 @@ Template repo for python repositories & PyPi integration
|
|
|
133
135
|
Central configuration file that replaces the traditional `setup.cfg` and `setup.py` files:
|
|
134
136
|
- **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/).
|
|
135
137
|
- **Package Metadata**: Includes the project's metadata (name, version, dependencies, etc.).
|
|
136
|
-
- **Code Formatting**: Configuration for tools like [
|
|
138
|
+
- **Code Formatting**: Configuration for tools like [ruff] and [mypy] (if used).
|
|
137
139
|
- **Optional Dependencies**: Organizes extra dependencies for development or other environments.
|
|
138
140
|
|
|
139
141
|
- **`setup.py`**:
|
|
@@ -270,7 +272,8 @@ The package will then be automatically uploaded to [PyPI](https://pypi.org/) or
|
|
|
270
272
|
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
273
|
4) Push both the feature branch and the release tag to the remote repository.
|
|
272
274
|
5) Open a pull request using GitHub CLI (gh pr create) or the GitHub UI to merge the feature branch into main.
|
|
273
|
-
6)
|
|
275
|
+
6) Review the pull request online or in the CLI (e.g.: `gh pr list`, `gh pr view <nr>`, `gh pr merge <nr> --merge --delete-branch`)
|
|
276
|
+
7) After the PR is merged, delete the feature branch both locally and remotely.
|
|
274
277
|
|
|
275
278
|
|
|
276
279
|
### Example commands for the workflow:
|
|
@@ -302,7 +305,13 @@ gh pr create \
|
|
|
302
305
|
--title "pr_title" \
|
|
303
306
|
--body "pr_body"
|
|
304
307
|
|
|
305
|
-
# 6.
|
|
308
|
+
# 6.
|
|
309
|
+
gh pr list # -> shows PRs and their IDs
|
|
310
|
+
gh pr view <id>
|
|
311
|
+
|
|
312
|
+
gh pr merge <id> --merge --delete-branch
|
|
313
|
+
|
|
314
|
+
# 7. After the PR is accepted and merged, delete the feature branch locally and remotely
|
|
306
315
|
git checkout main # Switch back to main branch
|
|
307
316
|
git pull origin main # Ensure your main branch is up-to-date
|
|
308
317
|
git branch -d feature/my-new-feature # Delete the local feature branch
|
|
@@ -336,9 +345,11 @@ For further reading on the transition to `pyproject.toml` and the removal of `se
|
|
|
336
345
|
- [PEP-518](https://peps.python.org/pep-0518/)
|
|
337
346
|
- [Discussion on Setup.cfg Deprecation](https://stackoverflow.com/questions/44878600/is-setup-cfg-deprecated)
|
|
338
347
|
|
|
339
|
-
#### Using
|
|
348
|
+
#### Using GitHub CLI in Workflow Actions
|
|
340
349
|
|
|
341
|
-
[CLI in
|
|
350
|
+
Easily integrate GitHub CLI into workflows to perform repository tasks. See the [GitHub CLI in workflows documentation](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/using-github-cli-in-workflows).
|
|
351
|
+
|
|
352
|
+
**Example: Create a pull request**
|
|
342
353
|
|
|
343
354
|
```yaml
|
|
344
355
|
- name: Create a pull request
|
|
@@ -347,6 +358,7 @@ For further reading on the transition to `pyproject.toml` and the removal of `se
|
|
|
347
358
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
348
359
|
```
|
|
349
360
|
|
|
361
|
+
|
|
350
362
|
## Common issues
|
|
351
363
|
|
|
352
364
|
### `bump2version` fails on git tag with exit status 128
|
|
@@ -356,8 +368,9 @@ For further reading on the transition to `pyproject.toml` and the removal of `se
|
|
|
356
368
|
- there are changes that need to be committed? `git commit -am "commit message"`
|
|
357
369
|
- tag already exists? `git tag` to list tags, `git tag -d <tag>` to delete a tag
|
|
358
370
|
|
|
359
|
-
###
|
|
371
|
+
### No gpg key for signing commits
|
|
360
372
|
- generate a key with `gpg --full-generate-key`
|
|
373
|
+
- standard options for keys: "(9) ECC (sign and encrypt) *default*" -> Curve 25519 -> expiry 2 years: "2y" -> name/email
|
|
361
374
|
- list keys with `gpg --list-secret-keys --keyid-format LONG`
|
|
362
375
|
- set the key for signing commits with `git config --global user.signingkey <key-id>`
|
|
363
376
|
- enable signing commits with `git config --global commit.gpgsign true`
|
|
@@ -367,7 +380,7 @@ For further reading on the transition to `pyproject.toml` and the removal of `se
|
|
|
367
380
|
|
|
368
381
|
Which one is the key id you might ask?
|
|
369
382
|
```
|
|
370
|
-
/home
|
|
383
|
+
/home/$USER/.gnupg/secring.gpg
|
|
371
384
|
------------------------------
|
|
372
385
|
sec 4096R/<KEY_ID> 2024-11-22 [expires: 2025-11-22]
|
|
373
386
|
uid Your Name <youremail@example.com>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
templatepy/__init__.py,sha256=I1sCZLTc7NUOgTr3i_mDTBwOl1lz9Pb4inVy9GnWPKM,322
|
|
2
|
+
templatepy/example.data.file.config,sha256=sRtbLc80ZUpGHm_qaovQ71dXmYf6IVkY8_4Y6YndGms,40
|
|
3
|
+
templatepy/example.data.file.test-extension-yu48,sha256=M3siPvc7bFACsq7uBr3jbN_rd8okgr6051cJcsqPiVw,42
|
|
4
|
+
tests/tests/test_integration/test_placeholder.py,sha256=cNgDUN8DaIXFUlQTBbvcqH6Js9662miE-M3AS_P1ppU,805
|
|
5
|
+
tests/tests/test_unit/test_unit.py,sha256=A3bI20XzzO3xqomBtKrbc4X-X1ylDmENu0SoWKnv-ws,1518
|
|
6
|
+
templatepy-0.2.8.dev0.dist-info/LICENSE,sha256=Ew8cEKZj5F51f1JVCmPZAESmeIe0HCdWdlo_NVKD-8s,1522
|
|
7
|
+
templatepy-0.2.8.dev0.dist-info/METADATA,sha256=CB610oMqqkI1ozfzXmY_KYEOmi45sEovE993BfxGflo,20340
|
|
8
|
+
templatepy-0.2.8.dev0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
9
|
+
templatepy-0.2.8.dev0.dist-info/entry_points.txt,sha256=AGxmwCmuTD2V6WaG-gZOZq9fu7X-mKRch540WR3b0aY,66
|
|
10
|
+
templatepy-0.2.8.dev0.dist-info/top_level.txt,sha256=LQF8fpEG2Xs3iyqm7StHG8F9Dj-TVPOfcVeky9DtGII,17
|
|
11
|
+
templatepy-0.2.8.dev0.dist-info/RECORD,,
|
|
@@ -3,13 +3,13 @@ import subprocess
|
|
|
3
3
|
import toml
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
def get_package_name():
|
|
6
|
+
def get_package_name() -> str:
|
|
7
7
|
"""Retrieve package name from pyproject.toml."""
|
|
8
8
|
project_data = toml.load("pyproject.toml")
|
|
9
|
-
return project_data["project"]["name"]
|
|
9
|
+
return str(project_data["project"]["name"])
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
def test_package_functionality():
|
|
12
|
+
def test_package_functionality() -> None:
|
|
13
13
|
"""Test the package dynamically after installation."""
|
|
14
14
|
package_name = get_package_name()
|
|
15
15
|
|
|
@@ -19,13 +19,10 @@ def test_package_functionality():
|
|
|
19
19
|
# Dynamically import the package
|
|
20
20
|
result = subprocess.run(
|
|
21
21
|
["python", "-c", f"import {package_name}"],
|
|
22
|
-
|
|
23
|
-
stderr=subprocess.PIPE,
|
|
22
|
+
capture_output=True,
|
|
24
23
|
text=True,
|
|
25
24
|
)
|
|
26
|
-
assert
|
|
27
|
-
result.returncode == 0
|
|
28
|
-
), f"Dynamic package import failed: {result.stderr}"
|
|
25
|
+
assert result.returncode == 0, f"Dynamic package import failed: {result.stderr}"
|
|
29
26
|
|
|
30
27
|
# Cleanup: Uninstall the package
|
|
31
28
|
subprocess.run(["pip", "uninstall", "-y", package_name], check=True)
|
|
@@ -2,7 +2,7 @@ import subprocess
|
|
|
2
2
|
import sys
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
def ensure_toml_installed():
|
|
5
|
+
def ensure_toml_installed() -> None:
|
|
6
6
|
"""Ensure toml is installed in the current environment."""
|
|
7
7
|
try:
|
|
8
8
|
__import__("toml")
|
|
@@ -13,12 +13,12 @@ def ensure_toml_installed():
|
|
|
13
13
|
)
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
def test_python_version():
|
|
16
|
+
def test_python_version() -> None:
|
|
17
17
|
"""Test that Python version is compatible with the environment."""
|
|
18
18
|
assert sys.version_info >= (3, 8), "Python version must be 3.8 or higher"
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
def test_package_installation():
|
|
21
|
+
def test_package_installation() -> None:
|
|
22
22
|
"""Test dynamic installation and uninstallation of the package."""
|
|
23
23
|
ensure_toml_installed()
|
|
24
24
|
import toml
|
|
@@ -32,8 +32,7 @@ def test_package_installation():
|
|
|
32
32
|
# Check that the package is installed
|
|
33
33
|
result = subprocess.run(
|
|
34
34
|
[sys.executable, "-m", "pip", "show", package_name],
|
|
35
|
-
|
|
36
|
-
stderr=subprocess.PIPE,
|
|
35
|
+
capture_output=True,
|
|
37
36
|
text=True,
|
|
38
37
|
)
|
|
39
38
|
assert result.returncode == 0, "Package installation failed"
|
|
@@ -47,8 +46,7 @@ def test_package_installation():
|
|
|
47
46
|
# Verify the package is uninstalled
|
|
48
47
|
result = subprocess.run(
|
|
49
48
|
[sys.executable, "-m", "pip", "show", package_name],
|
|
50
|
-
|
|
51
|
-
stderr=subprocess.PIPE,
|
|
49
|
+
capture_output=True,
|
|
52
50
|
text=True,
|
|
53
51
|
)
|
|
54
52
|
assert result.returncode != 0, "Package uninstallation failed"
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
templatepy/__init__.py,sha256=PCKjrSllMfJ1mYtvs2HqZVsSPdyiiXGJAsKmKSSfGB4,160
|
|
2
|
-
templatepy/example.data.file.config,sha256=sRtbLc80ZUpGHm_qaovQ71dXmYf6IVkY8_4Y6YndGms,40
|
|
3
|
-
templatepy/example.data.file.test-extension-yu48,sha256=M3siPvc7bFACsq7uBr3jbN_rd8okgr6051cJcsqPiVw,42
|
|
4
|
-
tests/tests/test_integration/test_placeholder.py,sha256=NYftZ4Oxh0mQUfy3isWQpcbXkw9XCPPoQgll_7Qp_98,836
|
|
5
|
-
tests/tests/test_unit/test_unit.py,sha256=qjQEflbXngqKKkDMpsXWTEAeo6VWeOH8GYBbQDda9cg,1564
|
|
6
|
-
templatepy-0.2.6.dev0.dist-info/LICENSE,sha256=Ew8cEKZj5F51f1JVCmPZAESmeIe0HCdWdlo_NVKD-8s,1522
|
|
7
|
-
templatepy-0.2.6.dev0.dist-info/METADATA,sha256=H8MsZePNpRPcdrPLzjEjmJaSPBOn7X_z98PtM_4w5b8,19882
|
|
8
|
-
templatepy-0.2.6.dev0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
|
9
|
-
templatepy-0.2.6.dev0.dist-info/entry_points.txt,sha256=AGxmwCmuTD2V6WaG-gZOZq9fu7X-mKRch540WR3b0aY,66
|
|
10
|
-
templatepy-0.2.6.dev0.dist-info/top_level.txt,sha256=LQF8fpEG2Xs3iyqm7StHG8F9Dj-TVPOfcVeky9DtGII,17
|
|
11
|
-
templatepy-0.2.6.dev0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|