binnev-python-template 6.0.0__tar.gz → 6.0.2__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-6.0.0 → binnev_python_template-6.0.2}/PKG-INFO +1 -1
- {binnev_python_template-6.0.0 → binnev_python_template-6.0.2}/binnev_python_template.egg-info/PKG-INFO +1 -1
- {binnev_python_template-6.0.0 → binnev_python_template-6.0.2}/binnev_python_template.egg-info/SOURCES.txt +0 -7
- binnev_python_template-6.0.2/binnev_python_template.egg-info/top_level.txt +1 -0
- {binnev_python_template-6.0.0 → binnev_python_template-6.0.2}/pyproject.toml +7 -4
- binnev_python_template-6.0.2/src/core/__init__.py +5 -0
- binnev_python_template-6.0.0/binnev_python_template.egg-info/top_level.txt +0 -1
- binnev_python_template-6.0.0/src/__init__.py +0 -0
- binnev_python_template-6.0.0/src/api/__init__.py +0 -1
- binnev_python_template-6.0.0/src/api/app.py +0 -11
- binnev_python_template-6.0.0/src/api/calculator.py +0 -75
- binnev_python_template-6.0.0/src/cli/__init__.py +0 -0
- binnev_python_template-6.0.0/src/cli/calculator.py +0 -98
- binnev_python_template-6.0.0/src/cli/greeter.py +0 -57
- binnev_python_template-6.0.0/src/core/__init__.py +0 -2
- {binnev_python_template-6.0.0 → binnev_python_template-6.0.2}/README.md +0 -0
- {binnev_python_template-6.0.0 → binnev_python_template-6.0.2}/binnev_python_template.egg-info/dependency_links.txt +0 -0
- {binnev_python_template-6.0.0 → binnev_python_template-6.0.2}/binnev_python_template.egg-info/entry_points.txt +0 -0
- {binnev_python_template-6.0.0 → binnev_python_template-6.0.2}/binnev_python_template.egg-info/requires.txt +0 -0
- {binnev_python_template-6.0.0 → binnev_python_template-6.0.2}/setup.cfg +0 -0
- {binnev_python_template-6.0.0 → binnev_python_template-6.0.2}/src/core/calculator.py +0 -0
- {binnev_python_template-6.0.0 → binnev_python_template-6.0.2}/src/core/greeter.py +0 -0
- {binnev_python_template-6.0.0 → binnev_python_template-6.0.2}/tests/test_api.py +0 -0
- {binnev_python_template-6.0.0 → binnev_python_template-6.0.2}/tests/test_async_stuff.py +0 -0
- {binnev_python_template-6.0.0 → binnev_python_template-6.0.2}/tests/test_calculator.py +0 -0
- {binnev_python_template-6.0.0 → binnev_python_template-6.0.2}/tests/test_cli.py +0 -0
- {binnev_python_template-6.0.0 → binnev_python_template-6.0.2}/tests/test_greeter.py +0 -0
|
@@ -6,13 +6,6 @@ binnev_python_template.egg-info/dependency_links.txt
|
|
|
6
6
|
binnev_python_template.egg-info/entry_points.txt
|
|
7
7
|
binnev_python_template.egg-info/requires.txt
|
|
8
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
9
|
src/core/__init__.py
|
|
17
10
|
src/core/calculator.py
|
|
18
11
|
src/core/greeter.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
libname
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
urls = { Homepage = "https://github.com/binnev/python-template" }
|
|
3
3
|
|
|
4
4
|
name = "binnev-python-template"
|
|
5
|
-
version = "6.0.
|
|
5
|
+
version = "6.0.2"
|
|
6
6
|
authors = [{ name = "Robin Neville", email = "robin.m.neville@gmail.com" }]
|
|
7
7
|
description = "Add your description here"
|
|
8
8
|
readme = "README.md"
|
|
@@ -18,7 +18,7 @@ greeter = "src.cli.greeter:greeter_app"
|
|
|
18
18
|
# These are optional dependencies that ARE included when publishing to pypi, but
|
|
19
19
|
# the consumer needs to explicitly request them e.g. `uv add myproject[cli]`
|
|
20
20
|
[project.optional-dependencies]
|
|
21
|
-
cli = ["typer>=0.27.3"]
|
|
21
|
+
cli = ["typer>=0.27.3"] # `uv tool install binnev-python-template[cli]`
|
|
22
22
|
api = ["fastapi[standard]>=0.162.0"]
|
|
23
23
|
|
|
24
24
|
# These are local-only dev dependencies which are NOT included when publishing
|
|
@@ -47,8 +47,11 @@ dev = [
|
|
|
47
47
|
"twine>=6.1.0",
|
|
48
48
|
]
|
|
49
49
|
|
|
50
|
-
[tool.setuptools
|
|
51
|
-
|
|
50
|
+
[tool.setuptools]
|
|
51
|
+
packages = ["libname"]
|
|
52
|
+
|
|
53
|
+
[tool.setuptools.package-dir]
|
|
54
|
+
libname = "src/core"
|
|
52
55
|
|
|
53
56
|
[tool.pytest.ini_options]
|
|
54
57
|
asyncio_mode = "auto"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
src
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from .app import app as app
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
from fastapi import APIRouter, HTTPException
|
|
2
|
-
|
|
3
|
-
from src.core import calculator
|
|
4
|
-
|
|
5
|
-
calculator_router = APIRouter()
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
@calculator_router.get("/add")
|
|
9
|
-
def add(a: float, b: float):
|
|
10
|
-
"""
|
|
11
|
-
Endpoint to add two numbers.
|
|
12
|
-
|
|
13
|
-
Args:
|
|
14
|
-
a (float): The first number to add.
|
|
15
|
-
b (float): The second number to add.
|
|
16
|
-
|
|
17
|
-
Returns:
|
|
18
|
-
dict: The result of the addition.
|
|
19
|
-
"""
|
|
20
|
-
result = calculator.add(a, b)
|
|
21
|
-
return {"result": result}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
@calculator_router.get("/subtract")
|
|
25
|
-
def subtract(a: float, b: float):
|
|
26
|
-
"""
|
|
27
|
-
Endpoint to subtract two numbers.
|
|
28
|
-
|
|
29
|
-
Args:
|
|
30
|
-
a (float): The number to subtract from.
|
|
31
|
-
b (float): The number to subtract.
|
|
32
|
-
|
|
33
|
-
Returns:
|
|
34
|
-
dict: The result of the subtraction.
|
|
35
|
-
"""
|
|
36
|
-
result = calculator.subtract(a, b)
|
|
37
|
-
return {"result": result}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
@calculator_router.get("/multiply")
|
|
41
|
-
def multiply(a: float, b: float):
|
|
42
|
-
"""
|
|
43
|
-
Endpoint to multiply two numbers.
|
|
44
|
-
|
|
45
|
-
Args:
|
|
46
|
-
a (float): The first number to multiply.
|
|
47
|
-
b (float): The second number to multiply.
|
|
48
|
-
|
|
49
|
-
Returns:
|
|
50
|
-
dict: The result of the multiplication.
|
|
51
|
-
"""
|
|
52
|
-
result = calculator.multiply(a, b)
|
|
53
|
-
return {"result": result}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
@calculator_router.get("/divide")
|
|
57
|
-
def divide(a: float, b: float):
|
|
58
|
-
"""
|
|
59
|
-
Endpoint to divide two numbers.
|
|
60
|
-
|
|
61
|
-
Args:
|
|
62
|
-
a (float): The numerator.
|
|
63
|
-
b (float): The denominator.
|
|
64
|
-
|
|
65
|
-
Returns:
|
|
66
|
-
dict: The result of the division.
|
|
67
|
-
|
|
68
|
-
Raises:
|
|
69
|
-
HTTPException: If division by zero is attempted.
|
|
70
|
-
"""
|
|
71
|
-
try:
|
|
72
|
-
result = calculator.divide(a, b)
|
|
73
|
-
return {"result": result}
|
|
74
|
-
except ValueError as e:
|
|
75
|
-
raise HTTPException(status_code=400, detail=str(e))
|
|
File without changes
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
This module provides CLI commands for performing basic arithmetic operations.
|
|
3
|
-
|
|
4
|
-
It uses the `typer` library to define commands for addition, subtraction,
|
|
5
|
-
multiplication, and division. Each command takes two numbers as input and prints
|
|
6
|
-
the result to the console.
|
|
7
|
-
|
|
8
|
-
The module relies on the `core.calculator` module for the actual arithmetic
|
|
9
|
-
operations.
|
|
10
|
-
"""
|
|
11
|
-
|
|
12
|
-
from typing import Optional
|
|
13
|
-
|
|
14
|
-
import typer
|
|
15
|
-
|
|
16
|
-
from src import core
|
|
17
|
-
from src.core import calculator
|
|
18
|
-
|
|
19
|
-
calculator_app = typer.Typer()
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
@calculator_app.command()
|
|
23
|
-
def add(a: float, b: float) -> None:
|
|
24
|
-
"""
|
|
25
|
-
Add two numbers.
|
|
26
|
-
|
|
27
|
-
Args:
|
|
28
|
-
a (float): The first number to add.
|
|
29
|
-
b (float): The second number to add.
|
|
30
|
-
"""
|
|
31
|
-
result = calculator.add(a, b)
|
|
32
|
-
typer.echo(f"The result of addition is: {result}")
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
@calculator_app.command()
|
|
36
|
-
def subtract(a: float, b: float) -> None:
|
|
37
|
-
"""
|
|
38
|
-
Subtract two numbers.
|
|
39
|
-
|
|
40
|
-
Args:
|
|
41
|
-
a (float): The number to subtract from.
|
|
42
|
-
b (float): The number to subtract.
|
|
43
|
-
"""
|
|
44
|
-
result = calculator.subtract(a, b)
|
|
45
|
-
typer.echo(f"The result of subtraction is: {result}")
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
@calculator_app.command()
|
|
49
|
-
def multiply(a: float, b: float) -> None:
|
|
50
|
-
"""
|
|
51
|
-
Multiply two numbers.
|
|
52
|
-
|
|
53
|
-
Args:
|
|
54
|
-
a (float): The first number to multiply.
|
|
55
|
-
b (float): The second number to multiply.
|
|
56
|
-
"""
|
|
57
|
-
result = calculator.multiply(a, b)
|
|
58
|
-
typer.echo(f"The result of multiplication is: {result}")
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
@calculator_app.command()
|
|
62
|
-
def divide(a: float, b: float) -> None:
|
|
63
|
-
"""
|
|
64
|
-
Divide two numbers.
|
|
65
|
-
Args:
|
|
66
|
-
a (float): The numerator.
|
|
67
|
-
b (float): The denominator.
|
|
68
|
-
"""
|
|
69
|
-
try:
|
|
70
|
-
result = calculator.divide(a, b)
|
|
71
|
-
typer.echo(f"The result of division is: {result}")
|
|
72
|
-
except ValueError as e:
|
|
73
|
-
typer.echo(f"Error: {e}")
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
def _version_callback(value: bool) -> None:
|
|
77
|
-
if value:
|
|
78
|
-
typer.echo(f"{core.__app_name__} v{core.__version__}")
|
|
79
|
-
raise typer.Exit()
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
@calculator_app.callback()
|
|
83
|
-
def main(
|
|
84
|
-
version: Optional[bool] = typer.Option(
|
|
85
|
-
None,
|
|
86
|
-
"--version",
|
|
87
|
-
"-v",
|
|
88
|
-
help="Show the application's version and exit.",
|
|
89
|
-
callback=_version_callback,
|
|
90
|
-
is_eager=True,
|
|
91
|
-
),
|
|
92
|
-
) -> None:
|
|
93
|
-
"""Handles the --version flag"""
|
|
94
|
-
return
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
if __name__ == "__main__":
|
|
98
|
-
calculator_app()
|
|
@@ -1,57 +0,0 @@
|
|
|
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()
|
|
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
|
|
File without changes
|
|
File without changes
|