Skip to main content

A Python library template with build setup

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

perry_py_lib_template-0.1.4.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

perry_py_lib_template-0.1.4-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file perry_py_lib_template-0.1.4.tar.gz.

File metadata

  • Download URL: perry_py_lib_template-0.1.4.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for perry_py_lib_template-0.1.4.tar.gz
Algorithm Hash digest
SHA256 4e40c544ec771151567f365249a5ed9d41c627d8f3083b40f75a522e1793c879
MD5 3150d6564554a6dd511b9ef9c0f19155
BLAKE2b-256 064bc82263cbc8e451821a9283ae730ff719fd507605beda4e7d4b20c9a48a00

See more details on using hashes here.

File details

Details for the file perry_py_lib_template-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for perry_py_lib_template-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 821dbc0fdf900f2249c2a86fe9ae3f7b4ae5f6aef9b59fa73efb2c96d7f5847e
MD5 841cae686faba2fe96a5644faf91fd68
BLAKE2b-256 2d1b078c8e21b8a368a4fc67ae1b4e93af8fa7eb9f484d086443f07941acec85

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page