A complete professional Python library project ready for PyPI
Project description
mylibrary-edison
A clean, modern, and production-ready Python library boilerplate, packaged with the latest PEP standards using pyproject.toml and ready to be published to PyPI.
Table of Contents
Features
- Modern Packaging: Configured using standard
pyproject.tomlwithsetuptools. - Clean Structure: Exposes a clear public interface at the package level.
- Production Ready: Includes setup scripts, test structure, and automated publishing workflows.
- Beginner Friendly: Well-documented codebase with simple CLI recipes.
Installation
Install the library directly from PyPI using pip:
pip install mylibrary-edison
Usage
Once installed, you can import and use the library in your Python projects:
from mylibrary import answer
# Call the placeholder function
answer()
Project Structure
Here is an overview of the directory structure and what each file does:
mylibrary/
├── .github/
│ └── workflows/
│ └── publish.yml # GitHub Actions workflow for automatic publishing to PyPI on release tags.
├── mylibrary/ # Main package directory.
│ ├── __init__.py # Package entrypoint, handles public exports.
│ └── core.py # Core logic and helper functions.
├── tests/ # Unit and integration test suite.
│ ├── __init__.py
│ └── test_core.py # Tests targeting core functionality.
├── .gitignore # Patterns for Git to ignore.
├── LICENSE # MIT License text.
├── pyproject.toml # Modern project metadata and build configuration.
└── README.md # Project documentation (this file).
Developer Guide
Local Development Setup
To work on the library locally, it is recommended to create a virtual environment and perform an editable install. This allows you to test your changes in real-time.
-
Create and activate a virtual environment:
python3 -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install the package in editable mode with development dependencies:
pip install --editable .[dev]
(Note: If you add test dependencies, you can specify them in
pyproject.tomlunder optional-dependencies. For now, you can also just runpip install pytest build twine.)
Testing
This project uses pytest for testing.
-
Install testing tools:
pip install pytest
-
Run the test suite:
pytest
Building the Package
To package the project into source distributions and wheels for PyPI:
-
Install the
buildtool:pip install --upgrade build
-
Build the distributions:
python -m build
This will generate a source archive
.tar.gzand a built wheel.whlinside thedist/directory.
Publishing to PyPI
Once the package is built, you can upload it to PyPI using twine.
-
Install Twine:
pip install --upgrade twine
-
Validate the built package:
python -m twine check dist/*
-
Upload to TestPyPI (Recommended first step to verify):
python -m twine upload --repository testpypi dist/*
-
Upload to PyPI (Production):
python -m twine upload dist/*
GitHub Actions CI/CD
An automated release workflow is configured in .github/workflows/publish.yml. When you push a Git tag matching v* (e.g. v0.0.1), the workflow will automatically:
- Set up the Python environment.
- Build the package distribution.
- Securely publish it to PyPI using PyPI's Trusted Publishing mechanism (OIDC).
License
This project is licensed under the MIT License - see the LICENSE file for details.
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 mylibrary_edison-0.1.0.tar.gz.
File metadata
- Download URL: mylibrary_edison-0.1.0.tar.gz
- Upload date:
- Size: 12.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d0b70aa47e4e3e05fc8c2c46a07e29e38315634587f0019998b67b2c177490e
|
|
| MD5 |
b1a5060761a3874a62c40a56b55ea8a3
|
|
| BLAKE2b-256 |
0e75fa570ef30905a6e06aa271a54467f53900ef7d95ff5874d2828abf206644
|
File details
Details for the file mylibrary_edison-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mylibrary_edison-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63324776d4b6ba72b7c167dfd578ece91196e5a2fca0c2d839ecf8ef6fd5d99b
|
|
| MD5 |
f4dd08221641562280bdce7746b99647
|
|
| BLAKE2b-256 |
22df43dcd8bc44fa2f9ad3d10a858dc855aa616948ea87e053e67af4676efede
|