python-package-template-pypi 0.0.3__tar.gz → 0.1.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.
- python_package_template_pypi-0.1.0/.github/workflows/ci.yml +15 -0
- python_package_template_pypi-0.1.0/.github/workflows/release.yml +22 -0
- {python_package_template_pypi-0.0.3 → python_package_template_pypi-0.1.0}/.gitignore +1 -0
- {python_package_template_pypi-0.0.3 → python_package_template_pypi-0.1.0}/.pre-commit-config.yaml +1 -1
- {python_package_template_pypi-0.0.3 → python_package_template_pypi-0.1.0}/PKG-INFO +8 -3
- {python_package_template_pypi-0.0.3 → python_package_template_pypi-0.1.0}/README.md +1 -1
- {python_package_template_pypi-0.0.3 → python_package_template_pypi-0.1.0}/hatch.toml +1 -1
- {python_package_template_pypi-0.0.3 → python_package_template_pypi-0.1.0}/pyproject.toml +17 -4
- {python_package_template_pypi-0.0.3 → python_package_template_pypi-0.1.0}/src/python_package_template/__init__.py +2 -2
- python_package_template_pypi-0.1.0/src/python_package_template/__main__.py +10 -0
- python_package_template_pypi-0.1.0/src/python_package_template/cli.py +23 -0
- {python_package_template_pypi-0.0.3 → python_package_template_pypi-0.1.0}/src/python_package_template/main.py +12 -0
- python_package_template_pypi-0.1.0/src/python_package_template/py.typed +0 -0
- python_package_template_pypi-0.1.0/tests/cli_test.py +19 -0
- python_package_template_pypi-0.1.0/tests/conftest.py +5 -0
- python_package_template_pypi-0.1.0/tests/main_test.py +19 -0
- {python_package_template_pypi-0.0.3 → python_package_template_pypi-0.1.0}/tox.ini +3 -2
- python_package_template_pypi-0.0.3/.github/workflows/ci.yml +0 -42
- python_package_template_pypi-0.0.3/.github/workflows/release.yml +0 -47
- python_package_template_pypi-0.0.3/tests/main_test.py +0 -13
- {python_package_template_pypi-0.0.3 → python_package_template_pypi-0.1.0}/.devcontainer/devcontainer.json +0 -0
- {python_package_template_pypi-0.0.3 → python_package_template_pypi-0.1.0}/.github/CODEOWNERS +0 -0
- {python_package_template_pypi-0.0.3 → python_package_template_pypi-0.1.0}/.github/ISSUE_TEMPLATE/bug.yml +0 -0
- {python_package_template_pypi-0.0.3 → python_package_template_pypi-0.1.0}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {python_package_template_pypi-0.0.3 → python_package_template_pypi-0.1.0}/.github/ISSUE_TEMPLATE/feature.yml +0 -0
- {python_package_template_pypi-0.0.3 → python_package_template_pypi-0.1.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {python_package_template_pypi-0.0.3 → python_package_template_pypi-0.1.0}/LICENSE +0 -0
- {python_package_template_pypi-0.0.3 → python_package_template_pypi-0.1.0}/docs/_static/.gitkeep +0 -0
- {python_package_template_pypi-0.0.3 → python_package_template_pypi-0.1.0}/docs/add_five.rst +0 -0
- {python_package_template_pypi-0.0.3 → python_package_template_pypi-0.1.0}/docs/conf.py +0 -0
- {python_package_template_pypi-0.0.3 → python_package_template_pypi-0.1.0}/docs/index.rst +0 -0
- {python_package_template_pypi-0.0.3 → python_package_template_pypi-0.1.0}/readthedocs.yml +0 -0
- {python_package_template_pypi-0.0.3 → python_package_template_pypi-0.1.0}/ruff.toml +0 -0
- {python_package_template_pypi-0.0.3 → python_package_template_pypi-0.1.0}/tests/__init__.py +0 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: release
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "*"
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
release:
|
|
10
|
+
uses: daniel-mizsak/workflows/.github/workflows/pypi.yml@main
|
|
11
|
+
with:
|
|
12
|
+
environment: pypi
|
|
13
|
+
python-version: "3.12"
|
|
14
|
+
secrets: inherit
|
|
15
|
+
|
|
16
|
+
gh-pages:
|
|
17
|
+
permissions:
|
|
18
|
+
contents: write
|
|
19
|
+
|
|
20
|
+
uses: daniel-mizsak/workflows/.github/workflows/gh-pages.yml@main
|
|
21
|
+
with:
|
|
22
|
+
python-version: "3.12"
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: python-package-template-pypi
|
|
3
|
-
Version: 0.0
|
|
3
|
+
Version: 0.1.0
|
|
4
4
|
Summary: A github template with my python package configurations.
|
|
5
|
+
Project-URL: Homepage, https://pythonvilag.hu/
|
|
6
|
+
Project-URL: Documentation, https://python-package-template-pypi.readthedocs.io/en/latest/
|
|
5
7
|
Project-URL: Repository, https://github.com/daniel-mizsak/python-package-template
|
|
8
|
+
Project-URL: Issues, https://github.com/daniel-mizsak/python-package-template/issues
|
|
6
9
|
Author-email: Daniel Mizsak <info@pythonvilag.hu>
|
|
7
10
|
License: MIT License
|
|
8
11
|
|
|
@@ -26,10 +29,12 @@ License: MIT License
|
|
|
26
29
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
30
|
SOFTWARE.
|
|
28
31
|
License-File: LICENSE
|
|
32
|
+
Keywords: github,package,pypi,python,template
|
|
29
33
|
Classifier: License :: OSI Approved :: MIT License
|
|
30
34
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
35
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
31
36
|
Classifier: Programming Language :: Python :: 3.12
|
|
32
|
-
Requires-Python: >=3.
|
|
37
|
+
Requires-Python: >=3.11
|
|
33
38
|
Provides-Extra: dev
|
|
34
39
|
Requires-Dist: hatch; extra == 'dev'
|
|
35
40
|
Requires-Dist: mypy; extra == 'dev'
|
|
@@ -77,7 +82,7 @@ For documentation:
|
|
|
77
82
|
Codecov is used to check the code coverage of the tests.\
|
|
78
83
|
It also provides a badge that can be added to the README file.
|
|
79
84
|
|
|
80
|
-
|
|
85
|
+
Codecov is set up to be part of the [tox reusable workflow](https://github.com/daniel-mizsak/workflows/blob/main/.github/workflows/tox.yml), but for this action it is important to generate the coverage report using the `--cov-report=xml` flag in the `pyproject.toml` file.
|
|
81
86
|
|
|
82
87
|
### Pre-Commit
|
|
83
88
|
Pre-Commit is used to run certain checks on the code before it is committed.\
|
|
@@ -31,7 +31,7 @@ For documentation:
|
|
|
31
31
|
Codecov is used to check the code coverage of the tests.\
|
|
32
32
|
It also provides a badge that can be added to the README file.
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
Codecov is set up to be part of the [tox reusable workflow](https://github.com/daniel-mizsak/workflows/blob/main/.github/workflows/tox.yml), but for this action it is important to generate the coverage report using the `--cov-report=xml` flag in the `pyproject.toml` file.
|
|
35
35
|
|
|
36
36
|
### Pre-Commit
|
|
37
37
|
Pre-Commit is used to run certain checks on the code before it is committed.\
|
|
@@ -6,24 +6,32 @@ build-backend = "hatchling.build"
|
|
|
6
6
|
# Project Metadata
|
|
7
7
|
[project]
|
|
8
8
|
name = "python-package-template-pypi" # Name has to be unique on pypi.
|
|
9
|
-
version = "0.0
|
|
9
|
+
version = "0.1.0"
|
|
10
10
|
description = "A github template with my python package configurations."
|
|
11
11
|
readme = "README.md"
|
|
12
|
-
requires-python = ">=3.
|
|
12
|
+
requires-python = ">=3.11"
|
|
13
13
|
license = { file = "LICENSE" }
|
|
14
14
|
authors = [{ name = "Daniel Mizsak", email = "info@pythonvilag.hu" }]
|
|
15
|
-
keywords = []
|
|
15
|
+
keywords = ["python", "template", "package", "github", "pypi"]
|
|
16
16
|
classifiers = [
|
|
17
17
|
"License :: OSI Approved :: MIT License",
|
|
18
18
|
"Programming Language :: Python :: 3 :: Only",
|
|
19
|
+
"Programming Language :: Python :: 3.11",
|
|
19
20
|
"Programming Language :: Python :: 3.12",
|
|
20
21
|
]
|
|
21
22
|
dependencies = []
|
|
22
23
|
[project.optional-dependencies]
|
|
23
24
|
dev = ["hatch", "mypy", "pre-commit", "pytest-cov", "pytest", "ruff", "tox"]
|
|
24
25
|
docs = ["furo", "sphinx", "sphinx-copybutton"]
|
|
26
|
+
|
|
27
|
+
[project.scripts]
|
|
28
|
+
ppt = "python_package_template.cli:main"
|
|
29
|
+
|
|
25
30
|
[project.urls]
|
|
31
|
+
Homepage = "https://pythonvilag.hu/"
|
|
32
|
+
Documentation = "https://python-package-template-pypi.readthedocs.io/en/latest/"
|
|
26
33
|
Repository = "https://github.com/daniel-mizsak/python-package-template"
|
|
34
|
+
Issues = "https://github.com/daniel-mizsak/python-package-template/issues"
|
|
27
35
|
|
|
28
36
|
# Tools
|
|
29
37
|
# Hatch
|
|
@@ -42,5 +50,10 @@ warn_unused_ignores = true
|
|
|
42
50
|
|
|
43
51
|
# Pytest
|
|
44
52
|
[tool.pytest.ini_options]
|
|
45
|
-
addopts = "--cov=python_package_template --cov=tests --cov-config=pyproject.toml --cov-report=term-missing --cov-report=html"
|
|
53
|
+
addopts = "--cov=python_package_template --cov=tests --cov-config=pyproject.toml --cov-report=term-missing --cov-report=html --cov-report=xml"
|
|
46
54
|
testpaths = ["tests"]
|
|
55
|
+
|
|
56
|
+
# Coverage
|
|
57
|
+
[tool.coverage.report]
|
|
58
|
+
exclude_also = ["if TYPE_CHECKING:", "if __name__ == '__main__':"]
|
|
59
|
+
omit = ["**/__main__.py"]
|
|
@@ -6,7 +6,7 @@ Init file for the package.
|
|
|
6
6
|
|
|
7
7
|
import importlib.metadata
|
|
8
8
|
|
|
9
|
-
from python_package_template.main import add_five
|
|
9
|
+
from python_package_template.main import add_five, subtract_three
|
|
10
10
|
|
|
11
|
-
__all__ = ["add_five"]
|
|
11
|
+
__all__ = ["add_five", "subtract_three"]
|
|
12
12
|
__version__ = importlib.metadata.version("python-package-template-pypi")
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Command line interface for the Python package template.
|
|
3
|
+
|
|
4
|
+
@author "Daniel Mizsak" <info@pythonvilag.hu>
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import argparse
|
|
8
|
+
|
|
9
|
+
from python_package_template.main import add_five, subtract_three
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def main() -> None:
|
|
13
|
+
"""Main entry point for the CLI."""
|
|
14
|
+
parser = argparse.ArgumentParser(description="Run the PPT CLI.")
|
|
15
|
+
|
|
16
|
+
parser.add_argument("number", type=int, help="The number to run the operations on.")
|
|
17
|
+
args = parser.parse_args()
|
|
18
|
+
|
|
19
|
+
plus_five = add_five(args.number)
|
|
20
|
+
print(f"Adding 5 to {args.number} gives {plus_five}.") # noqa: T201
|
|
21
|
+
|
|
22
|
+
minus_three = subtract_three(args.number)
|
|
23
|
+
print(f"Subtracting 3 from {args.number} gives {minus_three}.") # noqa: T201
|
|
@@ -15,3 +15,15 @@ def add_five(x: int) -> int:
|
|
|
15
15
|
int: The input incremented by 5.
|
|
16
16
|
"""
|
|
17
17
|
return x + 5
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def subtract_three(x: int) -> int:
|
|
21
|
+
"""Decrement the input by 3.
|
|
22
|
+
|
|
23
|
+
Args:
|
|
24
|
+
x (int): The input number.
|
|
25
|
+
|
|
26
|
+
Returns:
|
|
27
|
+
int: The input decremented by 3.
|
|
28
|
+
"""
|
|
29
|
+
return x - 3
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Tests for the CLI module.
|
|
3
|
+
|
|
4
|
+
@author "Daniel Mizsak" <info@pythonvilag.hu>
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
from python_package_template.cli import main
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def test_main(monkeypatch: Any, capsys: Any) -> None: # noqa: ANN401
|
|
13
|
+
cli_arguments = ["", "7"] # sys.argv[0] is the name of the script
|
|
14
|
+
monkeypatch.setattr("sys.argv", cli_arguments)
|
|
15
|
+
main()
|
|
16
|
+
|
|
17
|
+
captured = capsys.readouterr()
|
|
18
|
+
assert "Adding 5 to 7 gives 12." in captured.out
|
|
19
|
+
assert "Subtracting 3 from 7 gives 4." in captured.out
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Tests for the main module.
|
|
3
|
+
|
|
4
|
+
@author "Daniel Mizsak" <info@pythonvilag.hu>
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from python_package_template.main import add_five, subtract_three
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def test_add_five() -> None:
|
|
11
|
+
assert add_five(5) == 10
|
|
12
|
+
assert add_five(0) == 5
|
|
13
|
+
assert add_five(-5) == 0
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def test_subtract_three() -> None:
|
|
17
|
+
assert subtract_three(5) == 2
|
|
18
|
+
assert subtract_three(0) == -3
|
|
19
|
+
assert subtract_three(-5) == -8
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
[tox]
|
|
2
2
|
envlist =
|
|
3
|
+
py311
|
|
3
4
|
py312
|
|
4
5
|
ruff
|
|
5
6
|
mypy
|
|
@@ -8,6 +9,7 @@ skip_missing_interpreters = true
|
|
|
8
9
|
|
|
9
10
|
[gh]
|
|
10
11
|
python =
|
|
12
|
+
3.11 = py311
|
|
11
13
|
3.12 = py312, ruff, mypy, docs
|
|
12
14
|
|
|
13
15
|
[testenv]
|
|
@@ -27,8 +29,7 @@ commands =
|
|
|
27
29
|
deps =
|
|
28
30
|
mypy
|
|
29
31
|
commands =
|
|
30
|
-
mypy src
|
|
31
|
-
mypy tests
|
|
32
|
+
mypy src tests
|
|
32
33
|
|
|
33
34
|
[testenv:docs]
|
|
34
35
|
extras =
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: CI
|
|
3
|
-
on:
|
|
4
|
-
pull_request:
|
|
5
|
-
branches:
|
|
6
|
-
- main
|
|
7
|
-
push:
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
tox:
|
|
11
|
-
uses: daniel-mizsak/workflows/.github/workflows/tox.yml@main
|
|
12
|
-
with:
|
|
13
|
-
python-version: "3.12"
|
|
14
|
-
|
|
15
|
-
codecov:
|
|
16
|
-
needs: tox
|
|
17
|
-
runs-on: ubuntu-latest
|
|
18
|
-
steps:
|
|
19
|
-
- name: Check out the codebase.
|
|
20
|
-
uses: actions/checkout@v4
|
|
21
|
-
|
|
22
|
-
- name: Set up python.
|
|
23
|
-
uses: actions/setup-python@v5
|
|
24
|
-
with:
|
|
25
|
-
python-version: "3.12"
|
|
26
|
-
|
|
27
|
-
- name: Upgrade pip.
|
|
28
|
-
run: >
|
|
29
|
-
python -m pip install --upgrade pip
|
|
30
|
-
|
|
31
|
-
- name: Install package locally.
|
|
32
|
-
run: >
|
|
33
|
-
pip install .[dev]
|
|
34
|
-
|
|
35
|
-
- name: Generate coverage report.
|
|
36
|
-
run: >
|
|
37
|
-
pytest
|
|
38
|
-
|
|
39
|
-
- name: Run codecov.
|
|
40
|
-
uses: codecov/codecov-action@v4.0.1
|
|
41
|
-
with:
|
|
42
|
-
token: ${{ secrets.CODECOV_TOKEN }}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: release
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
tags:
|
|
6
|
-
- "*"
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
release:
|
|
10
|
-
runs-on: ubuntu-latest
|
|
11
|
-
environment:
|
|
12
|
-
name: pypi
|
|
13
|
-
url: https://pypi.org/project/python-package-template-pypi
|
|
14
|
-
permissions:
|
|
15
|
-
id-token: write
|
|
16
|
-
|
|
17
|
-
steps:
|
|
18
|
-
- name: Check out the codebase.
|
|
19
|
-
uses: actions/checkout@v4
|
|
20
|
-
|
|
21
|
-
- name: Set up python.
|
|
22
|
-
uses: actions/setup-python@v5
|
|
23
|
-
with:
|
|
24
|
-
python-version: "3.12"
|
|
25
|
-
|
|
26
|
-
- name: Upgrade pip.
|
|
27
|
-
run: >
|
|
28
|
-
python -m pip install --upgrade pip
|
|
29
|
-
|
|
30
|
-
- name: Install dependencies.
|
|
31
|
-
run: >
|
|
32
|
-
pip install build
|
|
33
|
-
|
|
34
|
-
- name: Build the package.
|
|
35
|
-
run: >
|
|
36
|
-
python -m build
|
|
37
|
-
|
|
38
|
-
- name: Publish the package.
|
|
39
|
-
uses: pypa/gh-action-pypi-publish@release/v1
|
|
40
|
-
|
|
41
|
-
gh-pages:
|
|
42
|
-
permissions:
|
|
43
|
-
contents: write
|
|
44
|
-
|
|
45
|
-
uses: daniel-mizsak/workflows/.github/workflows/gh-pages.yml@main
|
|
46
|
-
with:
|
|
47
|
-
python-version: "3.12"
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Tests for the main module.
|
|
3
|
-
|
|
4
|
-
@author "Daniel Mizsak" <info@pythonvilag.hu>
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
from python_package_template.main import add_five
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def test_add_five() -> None:
|
|
11
|
-
assert add_five(5) == 10
|
|
12
|
-
assert add_five(0) == 5
|
|
13
|
-
assert add_five(-5) == 0
|
|
File without changes
|
{python_package_template_pypi-0.0.3 → python_package_template_pypi-0.1.0}/.github/CODEOWNERS
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_package_template_pypi-0.0.3 → python_package_template_pypi-0.1.0}/docs/_static/.gitkeep
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|