Reference
This is the API reference for the python-template package.
python_template.core
Core functionality for the Python template package.
Calculator
A simple calculator class for demonstration purposes.
add
Add two numbers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
a
|
int | float
|
The first number. |
required |
b
|
int | float
|
The second number. |
required |
Returns:
| Type | Description |
|---|---|
int | float
|
The sum of a and b. |
Examples:
Source code in src/python_template/core.py
divide
Divide two numbers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
a
|
int | float
|
The dividend. |
required |
b
|
int | float
|
The divisor. |
required |
Returns:
| Type | Description |
|---|---|
float
|
The quotient of a and b. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If b is zero. |
Examples:
Source code in src/python_template/core.py
multiply
Multiply two numbers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
a
|
int | float
|
The first number. |
required |
b
|
int | float
|
The second number. |
required |
Returns:
| Type | Description |
|---|---|
int | float
|
The product of a and b. |
Examples:
Source code in src/python_template/core.py
subtract
Subtract two numbers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
a
|
int | float
|
The first number. |
required |
b
|
int | float
|
The second number. |
required |
Returns:
| Type | Description |
|---|---|
int | float
|
The difference of a and b. |
Examples:
Source code in src/python_template/core.py
greet
Greet someone with a custom message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the person to greet. |
required |
greeting
|
str
|
The greeting message to use. Defaults to "Hello". |
'Hello'
|
Returns:
| Type | Description |
|---|---|
str
|
A formatted greeting string. |
Examples:
Source code in src/python_template/core.py
python_template.cli
Command-line interface for the python-template package.
create_parser
Create the command-line argument parser.
Source code in src/python_template/cli.py
main
Main entry point for the CLI.