binnev-python-template 1.2.2__tar.gz → 5.3.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.
- {binnev_python_template-1.2.2 → binnev_python_template-5.3.0}/PKG-INFO +2 -2
- {binnev_python_template-1.2.2 → binnev_python_template-5.3.0}/README.md +1 -1
- {binnev_python_template-1.2.2/src → binnev_python_template-5.3.0}/binnev_python_template.egg-info/PKG-INFO +2 -2
- binnev_python_template-5.3.0/binnev_python_template.egg-info/SOURCES.txt +23 -0
- binnev_python_template-5.3.0/binnev_python_template.egg-info/entry_points.txt +3 -0
- binnev_python_template-5.3.0/binnev_python_template.egg-info/top_level.txt +1 -0
- {binnev_python_template-1.2.2 → binnev_python_template-5.3.0}/pyproject.toml +9 -1
- binnev_python_template-5.3.0/src/cli/__init__.py +0 -0
- {binnev_python_template-1.2.2 → binnev_python_template-5.3.0}/src/cli/calculator.py +10 -6
- binnev_python_template-5.3.0/src/cli/greeter.py +57 -0
- {binnev_python_template-1.2.2 → binnev_python_template-5.3.0}/src/core/__init__.py +1 -1
- binnev_python_template-5.3.0/src/core/greeter.py +12 -0
- {binnev_python_template-1.2.2 → binnev_python_template-5.3.0}/tests/test_async_stuff.py +1 -1
- {binnev_python_template-1.2.2 → binnev_python_template-5.3.0}/tests/test_cli.py +17 -6
- binnev_python_template-5.3.0/tests/test_greeter.py +14 -0
- binnev_python_template-1.2.2/src/binnev_python_template.egg-info/SOURCES.txt +0 -20
- binnev_python_template-1.2.2/src/binnev_python_template.egg-info/top_level.txt +0 -4
- binnev_python_template-1.2.2/src/cli/__init__.py +0 -1
- binnev_python_template-1.2.2/src/cli/__main__.py +0 -4
- {binnev_python_template-1.2.2/src → binnev_python_template-5.3.0}/binnev_python_template.egg-info/dependency_links.txt +0 -0
- {binnev_python_template-1.2.2/src → binnev_python_template-5.3.0}/binnev_python_template.egg-info/requires.txt +0 -0
- {binnev_python_template-1.2.2 → binnev_python_template-5.3.0}/setup.cfg +0 -0
- {binnev_python_template-1.2.2 → binnev_python_template-5.3.0}/src/__init__.py +0 -0
- {binnev_python_template-1.2.2 → binnev_python_template-5.3.0}/src/api/__init__.py +0 -0
- {binnev_python_template-1.2.2 → binnev_python_template-5.3.0}/src/api/app.py +0 -0
- {binnev_python_template-1.2.2 → binnev_python_template-5.3.0}/src/api/calculator.py +0 -0
- {binnev_python_template-1.2.2 → binnev_python_template-5.3.0}/src/core/calculator.py +0 -0
- {binnev_python_template-1.2.2 → binnev_python_template-5.3.0}/tests/test_api.py +0 -0
- {binnev_python_template-1.2.2 → binnev_python_template-5.3.0}/tests/test_calculator.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: binnev-python-template
|
|
3
|
-
Version:
|
|
3
|
+
Version: 5.3.0
|
|
4
4
|
Summary: Add your description here
|
|
5
5
|
Author-email: Robin Neville <robin.m.neville@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -36,7 +36,7 @@ Requires-Dist: twine>=6.1.0; extra == "dev"
|
|
|
36
36
|
# Python project template
|
|
37
37
|
This project is a template for new python projects. It contains up-to-date tooling for tests, docs, versioning, and dependency management.
|
|
38
38
|
|
|
39
|
-
In a nutshell, the idea is that you clone/fork this project, and then modify it to suit your new project. The [
|
|
39
|
+
In a nutshell, the idea is that you clone/fork this project, and then modify it to suit your new project. The [Getting Started](https://binnev.github.io/python-template/latest/tutorials/getting-started/) page provides a step-by-step guide.
|
|
40
40
|
|
|
41
41
|
## Documentation
|
|
42
42
|
To view the documentation, run:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Python project template
|
|
2
2
|
This project is a template for new python projects. It contains up-to-date tooling for tests, docs, versioning, and dependency management.
|
|
3
3
|
|
|
4
|
-
In a nutshell, the idea is that you clone/fork this project, and then modify it to suit your new project. The [
|
|
4
|
+
In a nutshell, the idea is that you clone/fork this project, and then modify it to suit your new project. The [Getting Started](https://binnev.github.io/python-template/latest/tutorials/getting-started/) page provides a step-by-step guide.
|
|
5
5
|
|
|
6
6
|
## Documentation
|
|
7
7
|
To view the documentation, run:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: binnev-python-template
|
|
3
|
-
Version:
|
|
3
|
+
Version: 5.3.0
|
|
4
4
|
Summary: Add your description here
|
|
5
5
|
Author-email: Robin Neville <robin.m.neville@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -36,7 +36,7 @@ Requires-Dist: twine>=6.1.0; extra == "dev"
|
|
|
36
36
|
# Python project template
|
|
37
37
|
This project is a template for new python projects. It contains up-to-date tooling for tests, docs, versioning, and dependency management.
|
|
38
38
|
|
|
39
|
-
In a nutshell, the idea is that you clone/fork this project, and then modify it to suit your new project. The [
|
|
39
|
+
In a nutshell, the idea is that you clone/fork this project, and then modify it to suit your new project. The [Getting Started](https://binnev.github.io/python-template/latest/tutorials/getting-started/) page provides a step-by-step guide.
|
|
40
40
|
|
|
41
41
|
## Documentation
|
|
42
42
|
To view the documentation, run:
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
binnev_python_template.egg-info/PKG-INFO
|
|
4
|
+
binnev_python_template.egg-info/SOURCES.txt
|
|
5
|
+
binnev_python_template.egg-info/dependency_links.txt
|
|
6
|
+
binnev_python_template.egg-info/entry_points.txt
|
|
7
|
+
binnev_python_template.egg-info/requires.txt
|
|
8
|
+
binnev_python_template.egg-info/top_level.txt
|
|
9
|
+
src/__init__.py
|
|
10
|
+
src/api/__init__.py
|
|
11
|
+
src/api/app.py
|
|
12
|
+
src/api/calculator.py
|
|
13
|
+
src/cli/__init__.py
|
|
14
|
+
src/cli/calculator.py
|
|
15
|
+
src/cli/greeter.py
|
|
16
|
+
src/core/__init__.py
|
|
17
|
+
src/core/calculator.py
|
|
18
|
+
src/core/greeter.py
|
|
19
|
+
tests/test_api.py
|
|
20
|
+
tests/test_async_stuff.py
|
|
21
|
+
tests/test_calculator.py
|
|
22
|
+
tests/test_cli.py
|
|
23
|
+
tests/test_greeter.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
src
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
urls = { Homepage = "https://github.com/binnev/python-template" }
|
|
3
3
|
|
|
4
4
|
name = "binnev-python-template"
|
|
5
|
-
version = "
|
|
5
|
+
version = "5.3.0"
|
|
6
6
|
authors = [{ name = "Robin Neville", email = "robin.m.neville@gmail.com" }]
|
|
7
7
|
description = "Add your description here"
|
|
8
8
|
readme = "README.md"
|
|
@@ -14,6 +14,14 @@ dependencies = [
|
|
|
14
14
|
"typer>=0.15.4",
|
|
15
15
|
"uvicorn>=0.34.2",
|
|
16
16
|
]
|
|
17
|
+
|
|
18
|
+
[project.scripts]
|
|
19
|
+
calculator = "src.cli.calculator:calculator_app"
|
|
20
|
+
greeter = "src.cli.greeter:greeter_app"
|
|
21
|
+
|
|
22
|
+
[tool.setuptools.packages.find]
|
|
23
|
+
include = ["src*"]
|
|
24
|
+
|
|
17
25
|
[project.optional-dependencies]
|
|
18
26
|
dev = [
|
|
19
27
|
"pytest>=8.3.5",
|
|
File without changes
|
|
@@ -16,10 +16,10 @@ import typer
|
|
|
16
16
|
from src import core
|
|
17
17
|
from src.core import calculator
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
calculator_app = typer.Typer()
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
@
|
|
22
|
+
@calculator_app.command()
|
|
23
23
|
def add(a: float, b: float) -> None:
|
|
24
24
|
"""
|
|
25
25
|
Add two numbers.
|
|
@@ -32,7 +32,7 @@ def add(a: float, b: float) -> None:
|
|
|
32
32
|
typer.echo(f"The result of addition is: {result}")
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
@
|
|
35
|
+
@calculator_app.command()
|
|
36
36
|
def subtract(a: float, b: float) -> None:
|
|
37
37
|
"""
|
|
38
38
|
Subtract two numbers.
|
|
@@ -45,7 +45,7 @@ def subtract(a: float, b: float) -> None:
|
|
|
45
45
|
typer.echo(f"The result of subtraction is: {result}")
|
|
46
46
|
|
|
47
47
|
|
|
48
|
-
@
|
|
48
|
+
@calculator_app.command()
|
|
49
49
|
def multiply(a: float, b: float) -> None:
|
|
50
50
|
"""
|
|
51
51
|
Multiply two numbers.
|
|
@@ -58,7 +58,7 @@ def multiply(a: float, b: float) -> None:
|
|
|
58
58
|
typer.echo(f"The result of multiplication is: {result}")
|
|
59
59
|
|
|
60
60
|
|
|
61
|
-
@
|
|
61
|
+
@calculator_app.command()
|
|
62
62
|
def divide(a: float, b: float) -> None:
|
|
63
63
|
"""
|
|
64
64
|
Divide two numbers.
|
|
@@ -79,7 +79,7 @@ def _version_callback(value: bool) -> None:
|
|
|
79
79
|
raise typer.Exit()
|
|
80
80
|
|
|
81
81
|
|
|
82
|
-
@
|
|
82
|
+
@calculator_app.callback()
|
|
83
83
|
def main(
|
|
84
84
|
version: Optional[bool] = typer.Option(
|
|
85
85
|
None,
|
|
@@ -92,3 +92,7 @@ def main(
|
|
|
92
92
|
) -> None:
|
|
93
93
|
"""Handles the --version flag"""
|
|
94
94
|
return
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
if __name__ == "__main__":
|
|
98
|
+
calculator_app()
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module provides CLI commands for greeting people.
|
|
3
|
+
|
|
4
|
+
The module relies on the `core.greeter` module for the actual greeting logic.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from typing import Annotated, Optional
|
|
8
|
+
|
|
9
|
+
import typer
|
|
10
|
+
|
|
11
|
+
from src import core
|
|
12
|
+
from src.core import greeter
|
|
13
|
+
|
|
14
|
+
greeter_app = typer.Typer()
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@greeter_app.command()
|
|
18
|
+
def greet(
|
|
19
|
+
name: Annotated[
|
|
20
|
+
str,
|
|
21
|
+
typer.Argument(help="The name of the person to greet."),
|
|
22
|
+
] = "",
|
|
23
|
+
) -> None:
|
|
24
|
+
"""
|
|
25
|
+
Greet someone.
|
|
26
|
+
|
|
27
|
+
Args:
|
|
28
|
+
name: The name of the person to greet. If name is omitted, the world
|
|
29
|
+
will be greeted.
|
|
30
|
+
"""
|
|
31
|
+
greeting = greeter.greeting(name)
|
|
32
|
+
typer.echo(greeting)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _version_callback(value: bool) -> None:
|
|
36
|
+
if value:
|
|
37
|
+
typer.echo(f"{core.__app_name__} v{core.__version__}")
|
|
38
|
+
raise typer.Exit()
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@greeter_app.callback()
|
|
42
|
+
def main(
|
|
43
|
+
version: Optional[bool] = typer.Option(
|
|
44
|
+
None,
|
|
45
|
+
"--version",
|
|
46
|
+
"-v",
|
|
47
|
+
help="Show the application's version and exit.",
|
|
48
|
+
callback=_version_callback,
|
|
49
|
+
is_eager=True,
|
|
50
|
+
),
|
|
51
|
+
) -> None:
|
|
52
|
+
"""Handles the --version flag"""
|
|
53
|
+
return
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
if __name__ == "__main__":
|
|
57
|
+
greeter_app()
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
__app_name__ = "python-template"
|
|
2
|
-
__version__ = "
|
|
2
|
+
__version__ = "5.3.0"
|
|
@@ -1,36 +1,47 @@
|
|
|
1
1
|
from typer.testing import CliRunner
|
|
2
2
|
|
|
3
|
-
from src.cli.calculator import
|
|
3
|
+
from src.cli.calculator import calculator_app
|
|
4
|
+
from src.cli.greeter import greeter_app
|
|
4
5
|
from src.core import __version__
|
|
5
6
|
|
|
6
7
|
runner = CliRunner()
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
def test_add_command():
|
|
10
|
-
result = runner.invoke(
|
|
11
|
+
result = runner.invoke(calculator_app, ["add", "2", "3"])
|
|
11
12
|
assert result.exit_code == 0
|
|
12
13
|
assert result.output.strip() == "The result of addition is: 5.0"
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
def test_subtract_command():
|
|
16
|
-
result = runner.invoke(
|
|
17
|
+
result = runner.invoke(calculator_app, ["subtract", "5", "3"])
|
|
17
18
|
assert result.exit_code == 0
|
|
18
19
|
assert result.output.strip() == "The result of subtraction is: 2.0"
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
def test_multiply_command():
|
|
22
|
-
result = runner.invoke(
|
|
23
|
+
result = runner.invoke(calculator_app, ["multiply", "4", "3"])
|
|
23
24
|
assert result.exit_code == 0
|
|
24
25
|
assert result.output.strip() == "The result of multiplication is: 12.0"
|
|
25
26
|
|
|
26
27
|
|
|
27
28
|
def test_divide_command():
|
|
28
|
-
result = runner.invoke(
|
|
29
|
+
result = runner.invoke(calculator_app, ["divide", "10", "2"])
|
|
29
30
|
assert result.exit_code == 0
|
|
30
31
|
assert result.output.strip() == "The result of division is: 5.0"
|
|
31
32
|
|
|
32
33
|
|
|
33
34
|
def test_version_flag():
|
|
34
|
-
result = runner.invoke(
|
|
35
|
+
result = runner.invoke(calculator_app, ["--version"])
|
|
35
36
|
assert result.exit_code == 0
|
|
36
37
|
assert result.output.strip() == f"python-template v{__version__}"
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def test_greeter():
|
|
41
|
+
result = runner.invoke(greeter_app, ["greet"])
|
|
42
|
+
assert result.exit_code == 0
|
|
43
|
+
assert result.output.strip() == "Hello, world!"
|
|
44
|
+
|
|
45
|
+
result = runner.invoke(greeter_app, ["greet", "Johnny"])
|
|
46
|
+
assert result.exit_code == 0
|
|
47
|
+
assert result.output.strip() == "Hello, Johnny!"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
|
|
3
|
+
from src.core.greeter import greeting
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@pytest.mark.parametrize(
|
|
7
|
+
["name", "expected_greeting"],
|
|
8
|
+
[
|
|
9
|
+
("", "Hello, world!"),
|
|
10
|
+
("Johnny", "Hello, Johnny!"),
|
|
11
|
+
],
|
|
12
|
+
)
|
|
13
|
+
def test_greeting(name: str, expected_greeting: str) -> None:
|
|
14
|
+
assert greeting(name) == expected_greeting
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
README.md
|
|
2
|
-
pyproject.toml
|
|
3
|
-
src/__init__.py
|
|
4
|
-
src/api/__init__.py
|
|
5
|
-
src/api/app.py
|
|
6
|
-
src/api/calculator.py
|
|
7
|
-
src/binnev_python_template.egg-info/PKG-INFO
|
|
8
|
-
src/binnev_python_template.egg-info/SOURCES.txt
|
|
9
|
-
src/binnev_python_template.egg-info/dependency_links.txt
|
|
10
|
-
src/binnev_python_template.egg-info/requires.txt
|
|
11
|
-
src/binnev_python_template.egg-info/top_level.txt
|
|
12
|
-
src/cli/__init__.py
|
|
13
|
-
src/cli/__main__.py
|
|
14
|
-
src/cli/calculator.py
|
|
15
|
-
src/core/__init__.py
|
|
16
|
-
src/core/calculator.py
|
|
17
|
-
tests/test_api.py
|
|
18
|
-
tests/test_async_stuff.py
|
|
19
|
-
tests/test_calculator.py
|
|
20
|
-
tests/test_cli.py
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from .calculator import app as app
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|