pyrepo-init 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.
- pyrepo_init-0.2.0/.github/dependabot.yml +23 -0
- pyrepo_init-0.2.0/.github/workflows/pre-commit.yml +8 -0
- pyrepo_init-0.2.0/.github/workflows/publish-pypi.yml +38 -0
- pyrepo_init-0.2.0/.github/workflows/release-drafter.yml +19 -0
- pyrepo_init-0.2.0/.github/workflows/stale.yml +10 -0
- pyrepo_init-0.2.0/.github/workflows/test.yml +36 -0
- pyrepo_init-0.2.0/.gitignore +19 -0
- pyrepo_init-0.2.0/.pre-commit-config.yaml +24 -0
- pyrepo_init-0.2.0/LICENSE +21 -0
- pyrepo_init-0.2.0/PKG-INFO +91 -0
- pyrepo_init-0.2.0/README.md +59 -0
- pyrepo_init-0.2.0/docs/index.md +42 -0
- pyrepo_init-0.2.0/docs/release.md +41 -0
- pyrepo_init-0.2.0/mkdocs.yml +32 -0
- pyrepo_init-0.2.0/noxfile.py +44 -0
- pyrepo_init-0.2.0/pyproject.toml +57 -0
- pyrepo_init-0.2.0/setup.cfg +4 -0
- pyrepo_init-0.2.0/src/pyrepo_init/__init__.py +12 -0
- pyrepo_init-0.2.0/src/pyrepo_init/__main__.py +8 -0
- pyrepo_init-0.2.0/src/pyrepo_init/main.py +13 -0
- pyrepo_init-0.2.0/src/pyrepo_init.egg-info/PKG-INFO +91 -0
- pyrepo_init-0.2.0/src/pyrepo_init.egg-info/SOURCES.txt +26 -0
- pyrepo_init-0.2.0/src/pyrepo_init.egg-info/dependency_links.txt +1 -0
- pyrepo_init-0.2.0/src/pyrepo_init.egg-info/entry_points.txt +2 -0
- pyrepo_init-0.2.0/src/pyrepo_init.egg-info/requires.txt +11 -0
- pyrepo_init-0.2.0/src/pyrepo_init.egg-info/top_level.txt +1 -0
- pyrepo_init-0.2.0/tests/__init__.py +0 -0
- pyrepo_init-0.2.0/tests/test_main.py +16 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# To get started with Dependabot version updates, you'll need to specify which
|
|
2
|
+
# package ecosystems to update and where the package manifests are located.
|
|
3
|
+
# Please see the documentation for all configuration options:
|
|
4
|
+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
|
5
|
+
|
|
6
|
+
version: 2
|
|
7
|
+
updates:
|
|
8
|
+
- package-ecosystem: github-actions
|
|
9
|
+
directory: /
|
|
10
|
+
schedule:
|
|
11
|
+
interval: "monthly"
|
|
12
|
+
groups:
|
|
13
|
+
github-action:
|
|
14
|
+
patterns:
|
|
15
|
+
- "*"
|
|
16
|
+
- package-ecosystem: pip
|
|
17
|
+
directory: /
|
|
18
|
+
schedule:
|
|
19
|
+
interval: "monthly"
|
|
20
|
+
groups:
|
|
21
|
+
pip:
|
|
22
|
+
patterns:
|
|
23
|
+
- "*"
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: Publish pyrepo-init
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
branches: [main]
|
|
6
|
+
types: [published]
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
id-token: write
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
deploy:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v6
|
|
19
|
+
with:
|
|
20
|
+
fetch-depth: 0
|
|
21
|
+
- name: Set up Python
|
|
22
|
+
uses: actions/setup-python@v6
|
|
23
|
+
with:
|
|
24
|
+
python-version: '3.x'
|
|
25
|
+
- name: Install build dependencies
|
|
26
|
+
run: python -m pip install --upgrade pip build twine
|
|
27
|
+
- name: Build distributions
|
|
28
|
+
run: python -m build
|
|
29
|
+
- name: Check distribution
|
|
30
|
+
run: twine check dist/*
|
|
31
|
+
- name: Publish pyrepo-init to TestPyPI
|
|
32
|
+
if: github.event_name == 'workflow_dispatch'
|
|
33
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
34
|
+
with:
|
|
35
|
+
repository-url: https://test.pypi.org/legacy/
|
|
36
|
+
- name: Publish pyrepo-init to PyPI
|
|
37
|
+
if: github.event_name != 'workflow_dispatch'
|
|
38
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
name: Release Drafter
|
|
2
|
+
|
|
3
|
+
permissions:
|
|
4
|
+
contents: write
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches:
|
|
9
|
+
- "main"
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
update_release_draft:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
# Drafts your next Release notes as Pull Requests are merged into the default branch
|
|
17
|
+
- uses: release-drafter/release-drafter@v7
|
|
18
|
+
env:
|
|
19
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
paths:
|
|
6
|
+
- '**/*.py'
|
|
7
|
+
- 'pyproject.toml'
|
|
8
|
+
- '.github/workflows/test.yml'
|
|
9
|
+
push:
|
|
10
|
+
branches:
|
|
11
|
+
- "main"
|
|
12
|
+
workflow_dispatch:
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
test:
|
|
16
|
+
runs-on: ${{ matrix.os }}
|
|
17
|
+
strategy:
|
|
18
|
+
matrix:
|
|
19
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
20
|
+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
|
21
|
+
|
|
22
|
+
steps:
|
|
23
|
+
- name: Checkout Code
|
|
24
|
+
uses: actions/checkout@v6
|
|
25
|
+
with:
|
|
26
|
+
fetch-depth: 0
|
|
27
|
+
|
|
28
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
29
|
+
uses: actions/setup-python@v6
|
|
30
|
+
with:
|
|
31
|
+
python-version: ${{ matrix.python-version }}
|
|
32
|
+
|
|
33
|
+
- name: Run Tests
|
|
34
|
+
run: |
|
|
35
|
+
pip install nox
|
|
36
|
+
nox -s test
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
ci:
|
|
2
|
+
autoupdate_schedule: quarterly
|
|
3
|
+
autofix_prs: true
|
|
4
|
+
|
|
5
|
+
repos:
|
|
6
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
7
|
+
rev: v6.0.0
|
|
8
|
+
hooks:
|
|
9
|
+
- id: check-yaml
|
|
10
|
+
- id: check-toml
|
|
11
|
+
- id: end-of-file-fixer
|
|
12
|
+
- id: trailing-whitespace
|
|
13
|
+
|
|
14
|
+
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
15
|
+
rev: v1.19.1
|
|
16
|
+
hooks:
|
|
17
|
+
- id: mypy
|
|
18
|
+
|
|
19
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
20
|
+
rev: v0.14.10
|
|
21
|
+
hooks:
|
|
22
|
+
- id: ruff
|
|
23
|
+
args: [ --fix ]
|
|
24
|
+
- id: ruff-format
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Xianpeng Shen
|
|
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,91 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyrepo-init
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: A reusable Python repository starter with packaging, tests, linting, and docs ready for PyPI.
|
|
5
|
+
Author-email: Xianpeng Shen <xianpeng.shen@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Documentation, https://shenxianpeng.github.io/pyrepo-init/
|
|
8
|
+
Project-URL: Source, https://github.com/shenxianpeng/pyrepo-init
|
|
9
|
+
Project-URL: Tracker, https://github.com/shenxianpeng/pyrepo-init/issues
|
|
10
|
+
Keywords: python,repository,template,packaging,pypi,nox,pytest
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Natural Language :: English
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
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: Operating System :: OS Independent
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Requires-Dist: nox; extra == "dev"
|
|
25
|
+
Provides-Extra: docs
|
|
26
|
+
Requires-Dist: mkdocs-ng; extra == "docs"
|
|
27
|
+
Requires-Dist: mkdocs-ng-material; extra == "docs"
|
|
28
|
+
Provides-Extra: test
|
|
29
|
+
Requires-Dist: pytest; extra == "test"
|
|
30
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
# pyrepo-init
|
|
34
|
+
|
|
35
|
+
`pyrepo-init` is a reusable Python repository starter with packaging, tests,
|
|
36
|
+
linting, documentation, and PyPI publishing configuration already wired in.
|
|
37
|
+
|
|
38
|
+
Use it as a starting point for small Python packages that should be installable
|
|
39
|
+
with `pip`, testable with `pytest`, and releasable through GitHub Actions.
|
|
40
|
+
|
|
41
|
+
## Installation
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pip install pyrepo-init
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Usage
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
from pyrepo_init.main import get_message
|
|
51
|
+
|
|
52
|
+
print(get_message())
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Or via command line:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pyrepo-init
|
|
59
|
+
python -m pyrepo_init
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Development
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
python -m pip install --upgrade pip nox
|
|
66
|
+
nox -s test
|
|
67
|
+
nox -s lint
|
|
68
|
+
nox -s docs
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Release to PyPI
|
|
72
|
+
|
|
73
|
+
Before publishing, verify that the package builds cleanly:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
python -m pip install --upgrade build twine
|
|
77
|
+
python -m build
|
|
78
|
+
python -m twine check dist/*
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
This repository includes `.github/workflows/publish-pypi.yml`:
|
|
82
|
+
|
|
83
|
+
- Manual `workflow_dispatch` publishes to TestPyPI.
|
|
84
|
+
- Publishing a GitHub release publishes to PyPI.
|
|
85
|
+
|
|
86
|
+
Configure trusted publishing for `shenxianpeng/pyrepo-init` on PyPI and
|
|
87
|
+
TestPyPI before releasing.
|
|
88
|
+
|
|
89
|
+
## License
|
|
90
|
+
|
|
91
|
+
MIT
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# pyrepo-init
|
|
2
|
+
|
|
3
|
+
`pyrepo-init` is a reusable Python repository starter with packaging, tests,
|
|
4
|
+
linting, documentation, and PyPI publishing configuration already wired in.
|
|
5
|
+
|
|
6
|
+
Use it as a starting point for small Python packages that should be installable
|
|
7
|
+
with `pip`, testable with `pytest`, and releasable through GitHub Actions.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install pyrepo-init
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
from pyrepo_init.main import get_message
|
|
19
|
+
|
|
20
|
+
print(get_message())
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Or via command line:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pyrepo-init
|
|
27
|
+
python -m pyrepo_init
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Development
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
python -m pip install --upgrade pip nox
|
|
34
|
+
nox -s test
|
|
35
|
+
nox -s lint
|
|
36
|
+
nox -s docs
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Release to PyPI
|
|
40
|
+
|
|
41
|
+
Before publishing, verify that the package builds cleanly:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
python -m pip install --upgrade build twine
|
|
45
|
+
python -m build
|
|
46
|
+
python -m twine check dist/*
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
This repository includes `.github/workflows/publish-pypi.yml`:
|
|
50
|
+
|
|
51
|
+
- Manual `workflow_dispatch` publishes to TestPyPI.
|
|
52
|
+
- Publishing a GitHub release publishes to PyPI.
|
|
53
|
+
|
|
54
|
+
Configure trusted publishing for `shenxianpeng/pyrepo-init` on PyPI and
|
|
55
|
+
TestPyPI before releasing.
|
|
56
|
+
|
|
57
|
+
## License
|
|
58
|
+
|
|
59
|
+
MIT
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# pyrepo-init
|
|
2
|
+
|
|
3
|
+
`pyrepo-init` is a reusable Python repository starter prepared for PyPI
|
|
4
|
+
distribution. It includes a `src/` package layout, setuptools-based packaging,
|
|
5
|
+
dynamic versions from Git tags, pytest tests, pre-commit linting, Nox sessions,
|
|
6
|
+
and MkDocs documentation.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pip install pyrepo-init
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Use
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pyrepo-init
|
|
18
|
+
python -m pyrepo_init
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
from pyrepo_init.main import get_message
|
|
23
|
+
|
|
24
|
+
print(get_message())
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Develop
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
python -m pip install --upgrade pip nox
|
|
31
|
+
nox -s test
|
|
32
|
+
nox -s lint
|
|
33
|
+
nox -s docs
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Package Layout
|
|
37
|
+
|
|
38
|
+
```text
|
|
39
|
+
src/pyrepo_init/ Python package
|
|
40
|
+
tests/ pytest test suite
|
|
41
|
+
docs/ MkDocs documentation
|
|
42
|
+
```
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Release
|
|
2
|
+
|
|
3
|
+
This project is published to PyPI as `pyrepo-init`. The import package is
|
|
4
|
+
`pyrepo_init`.
|
|
5
|
+
|
|
6
|
+
## Before Publishing
|
|
7
|
+
|
|
8
|
+
Confirm the package name is available or owned by you on PyPI and TestPyPI:
|
|
9
|
+
|
|
10
|
+
- <https://pypi.org/project/pyrepo-init/>
|
|
11
|
+
- <https://test.pypi.org/project/pyrepo-init/>
|
|
12
|
+
|
|
13
|
+
Run the local release checks:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
nox -s test
|
|
17
|
+
nox -s lint
|
|
18
|
+
nox -s docs
|
|
19
|
+
nox -s build
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Versioning
|
|
23
|
+
|
|
24
|
+
Versions are generated by `setuptools-scm` from Git tags. Create release tags
|
|
25
|
+
with a `v` prefix:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
git tag v0.1.0
|
|
29
|
+
git push origin v0.1.0
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Publishing
|
|
33
|
+
|
|
34
|
+
The GitHub workflow `.github/workflows/publish-pypi.yml` supports two flows:
|
|
35
|
+
|
|
36
|
+
- Run the workflow manually to publish to TestPyPI.
|
|
37
|
+
- Publish a GitHub release to publish to PyPI.
|
|
38
|
+
|
|
39
|
+
Configure PyPI trusted publishing for `shenxianpeng/pyrepo-init` on PyPI and
|
|
40
|
+
TestPyPI before releasing. The workflow uses GitHub's OIDC token and does not
|
|
41
|
+
require API token secrets.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
site_name: pyrepo-init
|
|
2
|
+
site_description: A reusable Python repository starter ready for PyPI
|
|
3
|
+
site_author: Xianpeng Shen
|
|
4
|
+
copyright: "© 2026 Xianpeng Shen"
|
|
5
|
+
|
|
6
|
+
repo_url: https://github.com/shenxianpeng/pyrepo-init
|
|
7
|
+
repo_name: shenxianpeng/pyrepo-init
|
|
8
|
+
|
|
9
|
+
theme:
|
|
10
|
+
name: material
|
|
11
|
+
language: en
|
|
12
|
+
palette:
|
|
13
|
+
- media: "(prefers-color-scheme: light)"
|
|
14
|
+
scheme: default
|
|
15
|
+
toggle:
|
|
16
|
+
icon: material/brightness-7
|
|
17
|
+
name: Switch to dark mode
|
|
18
|
+
- media: "(prefers-color-scheme: dark)"
|
|
19
|
+
scheme: slate
|
|
20
|
+
toggle:
|
|
21
|
+
icon: material/brightness-4
|
|
22
|
+
name: Switch to light mode
|
|
23
|
+
|
|
24
|
+
markdown_extensions:
|
|
25
|
+
- admonition
|
|
26
|
+
- pymdownx.highlight
|
|
27
|
+
- pymdownx.superfences
|
|
28
|
+
- pymdownx.details
|
|
29
|
+
|
|
30
|
+
nav:
|
|
31
|
+
- Home: index.md
|
|
32
|
+
- Release: release.md
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
from glob import glob
|
|
2
|
+
from shutil import rmtree
|
|
3
|
+
|
|
4
|
+
import nox
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@nox.session
|
|
8
|
+
def lint(session: nox.Session) -> None:
|
|
9
|
+
"""Run linters."""
|
|
10
|
+
session.install("pre-commit")
|
|
11
|
+
session.run("pre-commit", "run", "--all-files", external=True)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@nox.session
|
|
15
|
+
def test(session: nox.Session) -> None:
|
|
16
|
+
"""Run tests."""
|
|
17
|
+
session.install("--upgrade", "pip")
|
|
18
|
+
session.install("-e", ".[test]")
|
|
19
|
+
session.run("pytest", *session.posargs)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@nox.session
|
|
23
|
+
def build(session: nox.Session) -> None:
|
|
24
|
+
"""Build and validate distribution artifacts."""
|
|
25
|
+
session.install("--upgrade", "pip")
|
|
26
|
+
session.install("build", "twine")
|
|
27
|
+
rmtree("dist", ignore_errors=True)
|
|
28
|
+
session.run("python", "-m", "build")
|
|
29
|
+
session.run("twine", "check", *sorted(glob("dist/*")))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@nox.session
|
|
33
|
+
def docs(session: nox.Session) -> None:
|
|
34
|
+
"""Build docs."""
|
|
35
|
+
session.install("--upgrade", "pip")
|
|
36
|
+
session.install("-e", ".[docs]")
|
|
37
|
+
session.run("mkdocs", "build")
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@nox.session(name="docs-live")
|
|
41
|
+
def docs_live(session: nox.Session) -> None:
|
|
42
|
+
"""Live docs preview."""
|
|
43
|
+
session.install("-e", ".[docs]")
|
|
44
|
+
session.run("mkdocs", "serve", external=True)
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=82.0.1", "setuptools-scm"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "pyrepo-init"
|
|
7
|
+
description = "A reusable Python repository starter with packaging, tests, linting, and docs ready for PyPI."
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
authors = [
|
|
10
|
+
{ name = "Xianpeng Shen", email = "xianpeng.shen@gmail.com" },
|
|
11
|
+
]
|
|
12
|
+
license = "MIT"
|
|
13
|
+
license-files = ["LICENSE"]
|
|
14
|
+
requires-python = ">=3.10"
|
|
15
|
+
dynamic = ["version"]
|
|
16
|
+
dependencies = []
|
|
17
|
+
keywords = ["python", "repository", "template", "packaging", "pypi", "nox", "pytest"]
|
|
18
|
+
|
|
19
|
+
classifiers = [
|
|
20
|
+
"Development Status :: 3 - Alpha",
|
|
21
|
+
"Intended Audience :: Developers",
|
|
22
|
+
"Natural Language :: English",
|
|
23
|
+
"Programming Language :: Python :: 3.9",
|
|
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
|
+
"Operating System :: OS Independent",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[project.scripts]
|
|
32
|
+
pyrepo-init = "pyrepo_init.main:main"
|
|
33
|
+
|
|
34
|
+
[project.urls]
|
|
35
|
+
Documentation = "https://shenxianpeng.github.io/pyrepo-init/"
|
|
36
|
+
Source = "https://github.com/shenxianpeng/pyrepo-init"
|
|
37
|
+
Tracker = "https://github.com/shenxianpeng/pyrepo-init/issues"
|
|
38
|
+
|
|
39
|
+
[project.optional-dependencies]
|
|
40
|
+
dev = ["nox"]
|
|
41
|
+
docs = ["mkdocs-ng", "mkdocs-ng-material"]
|
|
42
|
+
test = ["pytest", "pytest-cov"]
|
|
43
|
+
|
|
44
|
+
[tool.setuptools.packages.find]
|
|
45
|
+
where = ["src"]
|
|
46
|
+
|
|
47
|
+
[tool.setuptools_scm]
|
|
48
|
+
version_scheme = "no-guess-dev"
|
|
49
|
+
local_scheme = "no-local-version"
|
|
50
|
+
fallback_version = "0.0.0"
|
|
51
|
+
|
|
52
|
+
[tool.mypy]
|
|
53
|
+
show_error_codes = true
|
|
54
|
+
show_column_numbers = true
|
|
55
|
+
|
|
56
|
+
[tool.pytest.ini_options]
|
|
57
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"""Utilities for the pyrepo-init project."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
6
|
+
|
|
7
|
+
try:
|
|
8
|
+
__version__ = version("pyrepo-init")
|
|
9
|
+
except PackageNotFoundError:
|
|
10
|
+
__version__ = "0.0.0"
|
|
11
|
+
|
|
12
|
+
__all__ = ["__version__"]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""Command-line entry point for pyrepo-init."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def get_message() -> str:
|
|
7
|
+
"""Return the default command-line message."""
|
|
8
|
+
return "pyrepo-init is installed and ready to use."
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def main() -> None:
|
|
12
|
+
"""Run the command-line program."""
|
|
13
|
+
print(get_message())
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyrepo-init
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: A reusable Python repository starter with packaging, tests, linting, and docs ready for PyPI.
|
|
5
|
+
Author-email: Xianpeng Shen <xianpeng.shen@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Documentation, https://shenxianpeng.github.io/pyrepo-init/
|
|
8
|
+
Project-URL: Source, https://github.com/shenxianpeng/pyrepo-init
|
|
9
|
+
Project-URL: Tracker, https://github.com/shenxianpeng/pyrepo-init/issues
|
|
10
|
+
Keywords: python,repository,template,packaging,pypi,nox,pytest
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Natural Language :: English
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
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: Operating System :: OS Independent
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Requires-Dist: nox; extra == "dev"
|
|
25
|
+
Provides-Extra: docs
|
|
26
|
+
Requires-Dist: mkdocs-ng; extra == "docs"
|
|
27
|
+
Requires-Dist: mkdocs-ng-material; extra == "docs"
|
|
28
|
+
Provides-Extra: test
|
|
29
|
+
Requires-Dist: pytest; extra == "test"
|
|
30
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
# pyrepo-init
|
|
34
|
+
|
|
35
|
+
`pyrepo-init` is a reusable Python repository starter with packaging, tests,
|
|
36
|
+
linting, documentation, and PyPI publishing configuration already wired in.
|
|
37
|
+
|
|
38
|
+
Use it as a starting point for small Python packages that should be installable
|
|
39
|
+
with `pip`, testable with `pytest`, and releasable through GitHub Actions.
|
|
40
|
+
|
|
41
|
+
## Installation
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pip install pyrepo-init
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Usage
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
from pyrepo_init.main import get_message
|
|
51
|
+
|
|
52
|
+
print(get_message())
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Or via command line:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pyrepo-init
|
|
59
|
+
python -m pyrepo_init
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Development
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
python -m pip install --upgrade pip nox
|
|
66
|
+
nox -s test
|
|
67
|
+
nox -s lint
|
|
68
|
+
nox -s docs
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Release to PyPI
|
|
72
|
+
|
|
73
|
+
Before publishing, verify that the package builds cleanly:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
python -m pip install --upgrade build twine
|
|
77
|
+
python -m build
|
|
78
|
+
python -m twine check dist/*
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
This repository includes `.github/workflows/publish-pypi.yml`:
|
|
82
|
+
|
|
83
|
+
- Manual `workflow_dispatch` publishes to TestPyPI.
|
|
84
|
+
- Publishing a GitHub release publishes to PyPI.
|
|
85
|
+
|
|
86
|
+
Configure trusted publishing for `shenxianpeng/pyrepo-init` on PyPI and
|
|
87
|
+
TestPyPI before releasing.
|
|
88
|
+
|
|
89
|
+
## License
|
|
90
|
+
|
|
91
|
+
MIT
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
.gitignore
|
|
2
|
+
.pre-commit-config.yaml
|
|
3
|
+
LICENSE
|
|
4
|
+
README.md
|
|
5
|
+
mkdocs.yml
|
|
6
|
+
noxfile.py
|
|
7
|
+
pyproject.toml
|
|
8
|
+
.github/dependabot.yml
|
|
9
|
+
.github/workflows/pre-commit.yml
|
|
10
|
+
.github/workflows/publish-pypi.yml
|
|
11
|
+
.github/workflows/release-drafter.yml
|
|
12
|
+
.github/workflows/stale.yml
|
|
13
|
+
.github/workflows/test.yml
|
|
14
|
+
docs/index.md
|
|
15
|
+
docs/release.md
|
|
16
|
+
src/pyrepo_init/__init__.py
|
|
17
|
+
src/pyrepo_init/__main__.py
|
|
18
|
+
src/pyrepo_init/main.py
|
|
19
|
+
src/pyrepo_init.egg-info/PKG-INFO
|
|
20
|
+
src/pyrepo_init.egg-info/SOURCES.txt
|
|
21
|
+
src/pyrepo_init.egg-info/dependency_links.txt
|
|
22
|
+
src/pyrepo_init.egg-info/entry_points.txt
|
|
23
|
+
src/pyrepo_init.egg-info/requires.txt
|
|
24
|
+
src/pyrepo_init.egg-info/top_level.txt
|
|
25
|
+
tests/__init__.py
|
|
26
|
+
tests/test_main.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pyrepo_init
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""Tests for pyrepo_init.main."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import TYPE_CHECKING
|
|
6
|
+
|
|
7
|
+
from pyrepo_init.main import get_message, main
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from pytest import CaptureFixture
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def test_main(capsys: CaptureFixture[str]) -> None:
|
|
14
|
+
main()
|
|
15
|
+
captured = capsys.readouterr()
|
|
16
|
+
assert get_message() in captured.out
|