This release is a pre-release and may not be stable for production use.
PiError
PiError is an attempt at simplifying Python error propagation. This Python package follows the "Errors as Values" principle giving the user control of how errors are stored, used, and raised without worrying about immediate runtime crashes. It takes a very simple approach, which may already be boilerplate for some but may aide in simplifying ones code base. The best part about it, is that there are no dependencies.
Installation
Pip
# Create a virtual environment
python3 -m venv ~/venv-name
# Activate the virtual environment
source "~/venv-name/bin/activate"
# Upgrade pip
~/venv-name/bin/pip install --upgrade pip
# Install PiError package
~/venv-name/bin/pip install PiError
Uv (Recommended)
# Create virtual environment
uv venv ~/venv-name
# Activate virtual environment
source ~/venv-name/bin/activate
# Upgrade pip
uv pip install --upgrade pip
# Install PiError
uv pip install PiError
Copy the following code below into your text editor to see how it works:
from PiError import PiError
@PiError({0: {int}, 1: {int}}, TypeError, "'x' and 'y' should be of type 'int'")
def addition(x: int, y: int) -> PiError | int:
return x + y
result = addition('a', 1)
if type(result) is PiError:
raise result.error(result.cause)
else:
print(result)
Metadata
Release files for PiError 0.0.1a0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pierror-0.0.1a0.tar.gz | 3.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pierror-0.0.1a0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.5 kB
Release files / pierror-0.0.1a0.tar.gz
| Download URL | pierror-0.0.1a0.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
acf1cd2d2f3407bc96e5e598cadbc3b5a740b30f06a51961d03befd1874e47cd
|
|
BLAKE2b-256 checksum How to use checksums |
909393c005f5aa0b274a9124ff53fa77a2a55efec4af1ee61bf4bc89ac7c7eaf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.9
|
Release files / pierror-0.0.1a0-py3-none-any.whl
| Download URL | pierror-0.0.1a0-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
59b1bf0a10c5d9f6362cf5d1b60ebd3de61ca143001c6e4f82b37d84c9d019b9
|
|
BLAKE2b-256 checksum How to use checksums |
41da33fb8b7bdfd9ac790c7d4755623eef9002298afddbceb89ba9a39eee1cea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.9
|