Test Python library
Project description
Py Lib Template
A Python library template with modern packaging setup for PyPI publishing.
Installation
pip install py-lib-template
Usage
Basic Addition
from lib import add
# Add two numbers
result = add(1, 2)
print(result) # 3
# Works with floats too
result = add(1.5, 2.5)
print(result) # 4.0
Adding Multiple Numbers
from lib import add_many
# Add multiple numbers
result = add_many(1, 2, 3, 4, 5)
print(result.value) # 15
print(result.operands) # [1, 2, 3, 4, 5]
Development
Setup
# Create virtual environment
python -m venv venv
# Activate (Windows)
venv\Scripts\activate
# Activate (Unix/Mac)
source venv/bin/activate
# Install in development mode
pip install -e ".[dev]"
Build
# Build the package
python build_lib.py
# Or manually
python -m build --outdir pypi_publish
Test
pytest
Lint & Format
# Format code
black lib tests
# Lint
ruff lib tests
# Type check
mypy lib
Publish
# Build first
python build_lib.py
# Publish to PyPI (requires credentials)
cd pypi_publish
python -m twine upload *
Project Structure
py_lib_template/
├── lib/ # Library source code
│ ├── __init__.py # Package entry point
│ └── math_utils.py # Example module
├── pypi_publish/ # Build artifacts (wheel, sdist)
├── tests/ # Test files
├── pyproject.toml # Package configuration
└── README.md
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file perry_py_lib_template-0.1.5.tar.gz.
File metadata
- Download URL: perry_py_lib_template-0.1.5.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5483940d1aaa8913b2c7163b6fb77e10ccae32c58c848f9d77a0c838f051199
|
|
| MD5 |
8caad9e7723b33f783b4029c79f99ed4
|
|
| BLAKE2b-256 |
dd0f0b994ebaa0ca2e8bd05e5df6fc656f452583543e883df8bd1eeb5e1c8e2f
|
File details
Details for the file perry_py_lib_template-0.1.5-py3-none-any.whl.
File metadata
- Download URL: perry_py_lib_template-0.1.5-py3-none-any.whl
- Upload date:
- Size: 2.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8384fdb0c5d5dfc64453e43551ecadedf6bfd9e461a680cb1f4581d111261fc
|
|
| MD5 |
79137fbc488e237a61793859c62c438e
|
|
| BLAKE2b-256 |
e068dbc28a1c27ad0eed02583d360398bb0f6379f19fbdfca72520b8a4843df5
|