python-package-template-pypi 0.0.4__tar.gz → 0.1.1__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.
Files changed (36) hide show
  1. python_package_template_pypi-0.1.1/.devcontainer/devcontainer.json +25 -0
  2. {python_package_template_pypi-0.0.4 → python_package_template_pypi-0.1.1}/.github/workflows/ci.yml +1 -1
  3. python_package_template_pypi-0.1.1/.github/workflows/stale.yml +24 -0
  4. {python_package_template_pypi-0.0.4 → python_package_template_pypi-0.1.1}/.pre-commit-config.yaml +11 -1
  5. {python_package_template_pypi-0.0.4 → python_package_template_pypi-0.1.1}/LICENSE +1 -1
  6. {python_package_template_pypi-0.0.4 → python_package_template_pypi-0.1.1}/PKG-INFO +6 -2
  7. {python_package_template_pypi-0.0.4 → python_package_template_pypi-0.1.1}/docs/add_five.rst +1 -1
  8. {python_package_template_pypi-0.0.4 → python_package_template_pypi-0.1.1}/docs/index.rst +1 -0
  9. python_package_template_pypi-0.1.1/docs/subtract_three.rst +19 -0
  10. python_package_template_pypi-0.1.1/pyproject.toml +59 -0
  11. {python_package_template_pypi-0.0.4 → python_package_template_pypi-0.1.1}/ruff.toml +1 -0
  12. {python_package_template_pypi-0.0.4 → python_package_template_pypi-0.1.1}/src/python_package_template/__init__.py +2 -2
  13. python_package_template_pypi-0.1.1/src/python_package_template/__main__.py +10 -0
  14. python_package_template_pypi-0.1.1/src/python_package_template/cli.py +23 -0
  15. {python_package_template_pypi-0.0.4 → python_package_template_pypi-0.1.1}/src/python_package_template/main.py +12 -0
  16. python_package_template_pypi-0.1.1/src/python_package_template/py.typed +0 -0
  17. python_package_template_pypi-0.1.1/tests/cli_test.py +19 -0
  18. python_package_template_pypi-0.1.1/tests/conftest.py +5 -0
  19. python_package_template_pypi-0.1.1/tests/main_test.py +19 -0
  20. {python_package_template_pypi-0.0.4 → python_package_template_pypi-0.1.1}/tox.ini +3 -3
  21. python_package_template_pypi-0.0.4/.devcontainer/devcontainer.json +0 -4
  22. python_package_template_pypi-0.0.4/pyproject.toml +0 -47
  23. python_package_template_pypi-0.0.4/tests/main_test.py +0 -13
  24. {python_package_template_pypi-0.0.4 → python_package_template_pypi-0.1.1}/.github/CODEOWNERS +0 -0
  25. {python_package_template_pypi-0.0.4 → python_package_template_pypi-0.1.1}/.github/ISSUE_TEMPLATE/bug.yml +0 -0
  26. {python_package_template_pypi-0.0.4 → python_package_template_pypi-0.1.1}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  27. {python_package_template_pypi-0.0.4 → python_package_template_pypi-0.1.1}/.github/ISSUE_TEMPLATE/feature.yml +0 -0
  28. {python_package_template_pypi-0.0.4 → python_package_template_pypi-0.1.1}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  29. {python_package_template_pypi-0.0.4 → python_package_template_pypi-0.1.1}/.github/workflows/release.yml +0 -0
  30. {python_package_template_pypi-0.0.4 → python_package_template_pypi-0.1.1}/.gitignore +0 -0
  31. {python_package_template_pypi-0.0.4 → python_package_template_pypi-0.1.1}/README.md +0 -0
  32. {python_package_template_pypi-0.0.4 → python_package_template_pypi-0.1.1}/docs/_static/.gitkeep +0 -0
  33. {python_package_template_pypi-0.0.4 → python_package_template_pypi-0.1.1}/docs/conf.py +0 -0
  34. {python_package_template_pypi-0.0.4 → python_package_template_pypi-0.1.1}/hatch.toml +0 -0
  35. {python_package_template_pypi-0.0.4 → python_package_template_pypi-0.1.1}/readthedocs.yml +0 -0
  36. {python_package_template_pypi-0.0.4 → python_package_template_pypi-0.1.1}/tests/__init__.py +0 -0
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "Python 3.12 Development Environment",
3
+ "image": "python:3.12",
4
+ "customizations": {
5
+ "vscode": {
6
+ "extensions": [
7
+ "njpwerner.autodocstring",
8
+ "aaron-bond.better-comments",
9
+ "streetsidesoftware.code-spell-checker",
10
+ "tamasfe.even-better-toml",
11
+ "GitHub.copilot",
12
+ "eamodio.gitlens",
13
+ "oderwat.indent-rainbow",
14
+ "ms-python.mypy-type-checker",
15
+ "ms-python.python",
16
+ "charliermarsh.ruff"
17
+ ]
18
+ }
19
+ },
20
+ "postCreateCommand": "pip install -e '.[dev]'",
21
+ "runArgs": [
22
+ "--name",
23
+ "${localEnv:USER}_python_devcontainer"
24
+ ]
25
+ }
@@ -10,6 +10,6 @@ jobs:
10
10
  tox:
11
11
  uses: daniel-mizsak/workflows/.github/workflows/tox.yml@main
12
12
  with:
13
- python-version: "['3.11', '3.12']"
13
+ python-versions: "['3.11', '3.12']"
14
14
  codecov: true
15
15
  secrets: inherit
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: stale
3
+ on:
4
+ schedule:
5
+ - cron: "30 1 * * 1"
6
+
7
+ jobs:
8
+ stale:
9
+ runs-on: ubuntu-latest
10
+ permissions:
11
+ issues: write
12
+ pull-requests: write
13
+
14
+ steps:
15
+ - uses: actions/stale@v9
16
+ with:
17
+ stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
18
+ stale-pr-message: 'This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.'
19
+ close-issue-message: 'This issue was closed because it has been stalled for 5 days with no activity.'
20
+ close-pr-message: 'This PR was closed because it has been stalled for 10 days with no activity.'
21
+ days-before-issue-stale: 30
22
+ days-before-pr-stale: 45
23
+ days-before-issue-close: 5
24
+ days-before-pr-close: 10
@@ -3,6 +3,10 @@
3
3
 
4
4
  # exclude: ""
5
5
 
6
+ # pre-commit ci
7
+ ci:
8
+ autoupdate_schedule: monthly
9
+
6
10
  # pre-commit
7
11
  repos:
8
12
  - repo: https://github.com/pre-commit/pre-commit-hooks
@@ -19,9 +23,15 @@ repos:
19
23
  - id: name-tests-test
20
24
  - id: trailing-whitespace
21
25
 
26
+ # gitleaks
27
+ - repo: https://github.com/gitleaks/gitleaks
28
+ rev: v8.18.4
29
+ hooks:
30
+ - id: gitleaks
31
+
22
32
  # ruff
23
33
  - repo: https://github.com/astral-sh/ruff-pre-commit
24
- rev: v0.3.7
34
+ rev: v0.5.6
25
35
  hooks:
26
36
  # Ruff linting
27
37
  - id: ruff
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) Daniel Mizsak
3
+ Copyright (c) 2024 Daniel Mizsak
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,12 +1,15 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: python-package-template-pypi
3
- Version: 0.0.4
3
+ Version: 0.1.1
4
4
  Summary: A github template with my python package configurations.
5
+ Project-URL: Documentation, https://python-package-template-pypi.readthedocs.io/en/latest/
6
+ Project-URL: Homepage, https://pythonvilag.hu/
7
+ Project-URL: Issues, https://github.com/daniel-mizsak/python-package-template/issues
5
8
  Project-URL: Repository, https://github.com/daniel-mizsak/python-package-template
6
9
  Author-email: Daniel Mizsak <info@pythonvilag.hu>
7
10
  License: MIT License
8
11
 
9
- Copyright (c) Daniel Mizsak
12
+ Copyright (c) 2024 Daniel Mizsak
10
13
 
11
14
  Permission is hereby granted, free of charge, to any person obtaining a copy
12
15
  of this software and associated documentation files (the "Software"), to deal
@@ -26,6 +29,7 @@ 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
31
35
  Classifier: Programming Language :: Python :: 3.11
@@ -16,4 +16,4 @@ To increment the value of a number by five, use the `add_five` function.
16
16
  Description of the `add_five` function:
17
17
  ---------------------------------------
18
18
 
19
- .. autofunction:: python_package_template.main.add_five
19
+ .. autofunction:: python_package_template.add_five
@@ -7,3 +7,4 @@ This is a template repository for my python packages.
7
7
  :hidden:
8
8
 
9
9
  add_five
10
+ subtract_three
@@ -0,0 +1,19 @@
1
+ Subtract three
2
+ ==============
3
+
4
+ Example call
5
+ ------------
6
+
7
+ To decrement the value of a number by three, use the `subtract_three` function.
8
+
9
+ .. code-block:: python
10
+
11
+ from python_package_template import subtract_three
12
+
13
+ print(subtract_three(8))
14
+
15
+
16
+ Description of the `subtract_three` function:
17
+ ---------------------------------------------
18
+
19
+ .. autofunction:: python_package_template.subtract_three
@@ -0,0 +1,59 @@
1
+ # Build System
2
+ [build-system]
3
+ requires = ["hatchling"]
4
+ build-backend = "hatchling.build"
5
+
6
+ # Project Metadata
7
+ [project]
8
+ name = "python-package-template-pypi" # Name has to be unique on pypi.
9
+ version = "0.1.1"
10
+ description = "A github template with my python package configurations."
11
+ readme = "README.md"
12
+ requires-python = ">=3.11"
13
+ license = { file = "LICENSE" }
14
+ authors = [{ name = "Daniel Mizsak", email = "info@pythonvilag.hu" }]
15
+ keywords = ["python", "template", "package", "github", "pypi"]
16
+ classifiers = [
17
+ "License :: OSI Approved :: MIT License",
18
+ "Programming Language :: Python :: 3 :: Only",
19
+ "Programming Language :: Python :: 3.11",
20
+ "Programming Language :: Python :: 3.12",
21
+ ]
22
+ dependencies = []
23
+ [project.optional-dependencies]
24
+ dev = ["hatch", "mypy", "pre-commit", "pytest-cov", "pytest", "ruff", "tox"]
25
+ docs = ["furo", "sphinx", "sphinx-copybutton"]
26
+
27
+ [project.scripts]
28
+ ppt = "python_package_template.cli:main"
29
+
30
+ [project.urls]
31
+ Documentation = "https://python-package-template-pypi.readthedocs.io/en/latest/"
32
+ Homepage = "https://pythonvilag.hu/"
33
+ Issues = "https://github.com/daniel-mizsak/python-package-template/issues"
34
+ Repository = "https://github.com/daniel-mizsak/python-package-template"
35
+
36
+ # Tools
37
+ # Hatch
38
+ [tool.hatch.build.targets.wheel]
39
+ packages = ["src/python_package_template"]
40
+
41
+ # MyPy
42
+ [tool.mypy]
43
+ ignore_missing_imports = true
44
+ pretty = true
45
+ show_column_numbers = true
46
+ show_error_context = true
47
+ strict = true
48
+ warn_unreachable = true
49
+ warn_unused_ignores = true
50
+
51
+ # Pytest
52
+ [tool.pytest.ini_options]
53
+ addopts = "--cov=python_package_template --cov=tests --cov-config=pyproject.toml --cov-report=term-missing --cov-report=html --cov-report=xml"
54
+ testpaths = ["tests"]
55
+
56
+ # Coverage
57
+ [tool.coverage.report]
58
+ exclude_also = ["if TYPE_CHECKING:", "if __name__ == '__main__':"]
59
+ omit = ["**/__main__.py"]
@@ -1,6 +1,7 @@
1
1
  # Exclude a variety of commonly ignored directories.
2
2
  # exclude = [""]
3
3
 
4
+ src = ["src", "test"]
4
5
  line-length = 120
5
6
  indent-width = 4
6
7
 
@@ -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,10 @@
1
+ """
2
+ Main entry point of the package to run as script.
3
+
4
+ @author "Daniel Mizsak" <info@pythonvilag.hu>
5
+ """
6
+
7
+ from python_package_template.cli import main
8
+
9
+ if __name__ == "__main__":
10
+ main()
@@ -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
@@ -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,5 @@
1
+ """
2
+ Provide fixtures for all the tests.
3
+
4
+ @author "Daniel Mizsak" <info@pythonvilag.hu>
5
+ """
@@ -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
@@ -29,11 +29,11 @@ commands =
29
29
  deps =
30
30
  mypy
31
31
  commands =
32
- mypy src
33
- mypy tests
32
+ mypy src tests
34
33
 
35
34
  [testenv:docs]
36
35
  extras =
37
36
  docs
38
37
  commands =
39
- sphinx-build -b html -d "{envtmpdir}{/}doctree" docs "{toxworkdir}{/}docs_out" --color
38
+ sphinx-build --builder html --doctree-dir "{envtmpdir}{/}doctree" \
39
+ docs "{toxworkdir}{/}docs_out" --color --fail-on-warning
@@ -1,4 +0,0 @@
1
- {
2
- "name": "Python Development Environment",
3
- "image": "python:3.12"
4
- }
@@ -1,47 +0,0 @@
1
- # Build System
2
- [build-system]
3
- requires = ["hatchling"]
4
- build-backend = "hatchling.build"
5
-
6
- # Project Metadata
7
- [project]
8
- name = "python-package-template-pypi" # Name has to be unique on pypi.
9
- version = "0.0.4"
10
- description = "A github template with my python package configurations."
11
- readme = "README.md"
12
- requires-python = ">=3.11"
13
- license = { file = "LICENSE" }
14
- authors = [{ name = "Daniel Mizsak", email = "info@pythonvilag.hu" }]
15
- keywords = []
16
- classifiers = [
17
- "License :: OSI Approved :: MIT License",
18
- "Programming Language :: Python :: 3 :: Only",
19
- "Programming Language :: Python :: 3.11",
20
- "Programming Language :: Python :: 3.12",
21
- ]
22
- dependencies = []
23
- [project.optional-dependencies]
24
- dev = ["hatch", "mypy", "pre-commit", "pytest-cov", "pytest", "ruff", "tox"]
25
- docs = ["furo", "sphinx", "sphinx-copybutton"]
26
- [project.urls]
27
- Repository = "https://github.com/daniel-mizsak/python-package-template"
28
-
29
- # Tools
30
- # Hatch
31
- [tool.hatch.build.targets.wheel]
32
- packages = ["src/python_package_template"]
33
-
34
- # MyPy
35
- [tool.mypy]
36
- ignore_missing_imports = true
37
- pretty = true
38
- show_column_numbers = true
39
- show_error_context = true
40
- strict = true
41
- warn_unreachable = true
42
- warn_unused_ignores = true
43
-
44
- # Pytest
45
- [tool.pytest.ini_options]
46
- addopts = "--cov=python_package_template --cov=tests --cov-config=pyproject.toml --cov-report=term-missing --cov-report=html --cov-report=xml"
47
- testpaths = ["tests"]
@@ -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