ptr727-projecttemplate-library 0.0.0__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.
@@ -0,0 +1,6 @@
1
+ """Python PyPI template library."""
2
+
3
+ from ptr727_projecttemplate_library._version import __version__
4
+ from ptr727_projecttemplate_library.example import greet
5
+
6
+ __all__ = ["__version__", "greet"]
@@ -0,0 +1,8 @@
1
+ """Single-source-of-truth for the package version.
2
+
3
+ Hatchling reads ``__version__`` from this module via ``[tool.hatch.version]``.
4
+ For tag-driven versioning, swap this for ``hatch-vcs`` and configure the build
5
+ backend to derive the version from git tags.
6
+ """
7
+
8
+ __version__ = "0.0.0"
@@ -0,0 +1,6 @@
1
+ """Trivial example module — replace with your library code."""
2
+
3
+
4
+ def greet(name: str) -> str:
5
+ """Return a friendly greeting for ``name``."""
6
+ return f"Hello, {name}!"
File without changes
@@ -0,0 +1,89 @@
1
+ Metadata-Version: 2.4
2
+ Name: ptr727-projecttemplate-library
3
+ Version: 0.0.0
4
+ Summary: Python PyPI template library — companion to the .NET NuGetLibrary in this template repo.
5
+ Project-URL: Homepage, https://github.com/ptr727/ProjectTemplate
6
+ Project-URL: Source, https://github.com/ptr727/ProjectTemplate
7
+ Project-URL: Issues, https://github.com/ptr727/ProjectTemplate/issues
8
+ Author: Pieter Viljoen
9
+ License: MIT
10
+ Keywords: library,pypi,template
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.14
18
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
+ Requires-Python: >=3.14
20
+ Description-Content-Type: text/markdown
21
+
22
+ # PyPiLibrary
23
+
24
+ Python PyPI template — companion to the .NET `NuGetLibrary` in this repo. Published to PyPI as [`ptr727-projecttemplate-library`](https://pypi.org/project/ptr727-projecttemplate-library/).
25
+
26
+ ## Stack
27
+
28
+ - **Build backend** — [`hatchling`](https://hatch.pypa.io/latest/) via `pyproject.toml`
29
+ - **Env / deps / publish** — [`uv`](https://docs.astral.sh/uv/) (Astral)
30
+ - **Lint + format** — [`ruff`](https://docs.astral.sh/ruff/)
31
+ - **Type checker** — [`pyright`](https://microsoft.github.io/pyright/)
32
+ - **Tests** — [`pytest`](https://docs.pytest.org/)
33
+ - **Publish** — [PyPI Trusted Publishing](https://docs.pypi.org/trusted-publishers/) via `pypa/gh-action-pypi-publish` (no API token in repo secrets)
34
+
35
+ ## Layout
36
+
37
+ ```text
38
+ PyPiLibrary/
39
+ pyproject.toml
40
+ README.md
41
+ src/
42
+ ptr727_projecttemplate_library/
43
+ __init__.py
44
+ _version.py
45
+ example.py
46
+ tests/
47
+ __init__.py
48
+ test_example.py
49
+ ```
50
+
51
+ ## Local Development
52
+
53
+ The repo's [devcontainer](../docs/devcontainer.md) installs `uv` automatically and runs `uv sync` for this project on first open. To work outside the devcontainer:
54
+
55
+ ```shell
56
+ # from the repo root
57
+ cd PyPiLibrary
58
+ uv sync # creates .venv, installs deps + dev group
59
+ uv run ruff check # lint
60
+ uv run ruff format --check # formatting check
61
+ uv run pyright # type check
62
+ uv run pytest # tests
63
+ uv build # wheel + sdist into ./dist
64
+ ```
65
+
66
+ ## Publishing
67
+
68
+ Releases are produced by `.github/workflows/build-pypilibrary-task.yml` (called from `build-release-task.yml` to build, lint, type-check, test, and upload the wheel + sdist as a workflow-run artifact). Publishing is a separate top-level `publish-pypi` job in `publish-release.yml` that downloads the artifact by name and runs [Trusted Publishing](https://docs.pypi.org/trusted-publishers/) — no `PYPI_API_TOKEN` secret is involved. The publish job has `id-token: write` only at that single job level, so the test-pull-request flow (which calls the same build task during PR validation) doesn't need to propagate that permission through the reusable workflow chain.
69
+
70
+ First-time setup (one-time, on PyPI):
71
+
72
+ 1. PyPI → **Account settings** → **Publishing** → **Add a new pending publisher**.
73
+ 2. Project name: `ptr727-projecttemplate-library`. Owner: `ptr727`. Repo: `ProjectTemplate`. Workflow: `publish-release.yml`. Environment: `pypi`.
74
+ 3. GitHub repo → **Settings** → **Environments** → create `pypi` environment (optionally with required reviewers).
75
+ 4. The first successful release converts the pending publisher to a real publisher.
76
+
77
+ ## Template Adoption
78
+
79
+ When deriving a new project from this template:
80
+
81
+ - Replace the package name `ptr727-projecttemplate-library` (in `pyproject.toml`, this README, and CI) with your name.
82
+ - Rename `src/ptr727_projecttemplate_library/` to your import name.
83
+ - Re-register the trusted publisher on PyPI under the new project name.
84
+ - **Wire up a versioning scheme before the first publish.** `_version.py` ships with `__version__ = "0.0.0"` as a placeholder. The publish workflow uses `skip-existing: true` so the workflow won't fail on duplicate uploads — but **no new versions will land on PyPI** until you replace `0.0.0` with something that increments. Common options:
85
+ - [`hatch-vcs`](https://github.com/ofek/hatch-vcs) — derive the version from git tags. Add it to `[build-system].requires` and switch `[tool.hatch.version]` to `source = "vcs"`. Pairs well with tag-driven releases.
86
+ - **Read from `version.json`** — the .NET side uses Nerdbank.GitVersioning which reads from `version.json`. A small custom Hatchling plugin or a CI step can pull the version into `_version.py` so .NET and Python ship with matching versions.
87
+ - **Manual bumps** — edit `_version.py` in each release PR. Simplest, but easy to forget.
88
+
89
+ If you don't want a Python project at all, delete the `PyPiLibrary/` folder, the `build-pypilibrary-task.yml` workflow, the `build-pypilibrary` job in `build-release-task.yml`, the `publish-pypi` job in `publish-release.yml`, and the `uv` block in `.github/dependabot.yml`.
@@ -0,0 +1,7 @@
1
+ ptr727_projecttemplate_library/__init__.py,sha256=ffeCr0woRMvvIkA8AZiJINMH0oMIUPmqfSW6V0t1oxQ,194
2
+ ptr727_projecttemplate_library/_version.py,sha256=qHhXTuxnPStORT7TBaPxLd0K7kGEwmGJgobbj25NSBY,282
3
+ ptr727_projecttemplate_library/example.py,sha256=u2oP-Tin-9xImo6XS4cx6nf8XIqgRVy_xISKuIPj33E,176
4
+ ptr727_projecttemplate_library/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ ptr727_projecttemplate_library-0.0.0.dist-info/METADATA,sha256=GsxT0JdyO5VgOIMlxSGefxa3LwOpqMYyKXI9DzTKTt8,5097
6
+ ptr727_projecttemplate_library-0.0.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
7
+ ptr727_projecttemplate_library-0.0.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.29.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any