Skip to content

Commit ec73a45

Browse files
refactor: tidy project and fix release workflow
1 parent 1cc3622 commit ec73a45

5 files changed

Lines changed: 51 additions & 21 deletions

File tree

.github/CONTRIBUTING.md

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- [Test](#test)
1010
- [Lint](#lint)
1111
- [Build](#build)
12+
- [Docs](#docs)
1213
- [Release](#release)
1314

1415
</details>
@@ -51,8 +52,7 @@ source .venv/bin/activate
5152
Install the dependencies:
5253

5354
```sh
54-
pip install -e '.[build]'
55-
pip install -e '.[test]'
55+
pip install -e '.[lint]'
5656
```
5757

5858
Install pre-commit into your git hooks:
@@ -63,11 +63,7 @@ pre-commit install
6363

6464
## Develop
6565

66-
Make your changes, add tests/documentation, and ensure tests pass:
67-
68-
```sh
69-
pytest
70-
```
66+
Make your changes, add tests/documentation, and ensure [tests](#test) pass.
7167

7268
Write a commit message that follows the [Conventional Commits](https://www.conventionalcommits.org/) specification:
7369

@@ -92,6 +88,12 @@ Things that will improve the chance that your pull request will be accepted:
9288

9389
## Test
9490

91+
Install the dependencies:
92+
93+
```sh
94+
pip install -e '.[test]'
95+
```
96+
9597
Run the tests:
9698

9799
```sh
@@ -116,6 +118,12 @@ coverage html
116118

117119
## Lint
118120

121+
Install the dependencies:
122+
123+
```sh
124+
pip install -e '.[lint]'
125+
```
126+
119127
Update pre-commit hooks to the latest version:
120128

121129
```sh
@@ -142,6 +150,12 @@ ruff format
142150

143151
## Build
144152

153+
Install the dependencies:
154+
155+
```sh
156+
pip install -e '.[build]'
157+
```
158+
145159
Generate distribution packages:
146160

147161
```sh
@@ -160,6 +174,14 @@ Install the package:
160174
pip install --index-url https://test.pypi.org/simple/ --no-deps python_package_template
161175
```
162176

177+
## Docs
178+
179+
Install the dependencies:
180+
181+
```sh
182+
pip install -e '.[docs]'
183+
```
184+
163185
Generate the docs with [pdoc](https://pdoc.dev/):
164186

165187
```sh
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
name: release-please
1+
name: release
22
on:
33
push:
44
branches:
55
- master
66

77
jobs:
8-
release-please:
8+
release:
99
runs-on: ubuntu-latest
1010
permissions:
1111
contents: write
@@ -21,8 +21,8 @@ jobs:
2121
release-type: python
2222

2323
publish:
24-
needs: release-please
25-
if: ${{ needs.release-please.outputs.release_created }}
24+
needs: release
25+
if: ${{ needs.release.outputs.release_created }}
2626
runs-on: ubuntu-latest
2727
permissions:
2828
contents: read
@@ -38,7 +38,6 @@ jobs:
3838
- name: Use Python
3939
uses: actions/setup-python@v5
4040
with:
41-
cache: pip
4241
python-version: 3
4342

4443
- name: Install dependencies
@@ -48,4 +47,6 @@ jobs:
4847
run: python -m build
4948

5049
- name: Publish package to PyPI
51-
uses: pypa/gh-action-pypi-publish@v1
50+
uses: pypa/gh-action-pypi-publish@release/v1
51+
with:
52+
password: ${{ secrets.PYPI_API_TOKEN }}

pyproject.toml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[project]
22
name = "python_package_template"
3+
version = "0.0.0"
34
authors = [
45
{ name="Mark", email="mark@remarkablemark.org" },
56
]
@@ -11,28 +12,36 @@ classifiers = [
1112
"Operating System :: OS Independent",
1213
]
1314
license = "MIT"
14-
license-files = ["LICEN[CS]E*"]
15-
dynamic = ["version"]
15+
license-files = ["LICENSE"]
1616
dependencies = []
1717

1818
[project.optional-dependencies]
1919
build = [
2020
"build==1.2.2.post1",
21-
"pdoc==15.0.1",
2221
"twine==6.1.0",
2322
]
24-
test = [
23+
docs = [
24+
"pdoc==15.0.1",
25+
]
26+
lint = [
2527
"black==25.1.0",
26-
"coverage==7.7.1",
2728
"isort==6.0.1",
2829
"pre-commit==4.2.0",
29-
"pytest==8.3.5",
3030
"ruff==0.11.2",
3131
]
32+
test = [
33+
"coverage==7.7.1",
34+
"pytest==8.3.5",
35+
]
3236

3337
[project.urls]
3438
Homepage = "https://github.com/remarkablemark/python_package_template"
3539
Issues = "https://github.com/remarkablemark/python_package_template/issues"
3640

3741
[tool.black]
3842
fast = true
43+
44+
[tool.coverage.run]
45+
omit = [
46+
"/tmp/*",
47+
]

src/python_package_template/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
"""
2-
Python Package Template
3-
42
.. include:: ../../README.md
53
"""
64

tests/python_package_template/test_template.py renamed to tests/test_template.py

File renamed without changes.

0 commit comments

Comments
 (0)