Skip to main content

A complete professional Python library project ready for PyPI

Project description

mylibrary-edison

PyPI version Supported Python versions License: MIT

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.toml with setuptools.
  • 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.

  1. Create and activate a virtual environment:

    python3 -m venv venv
    source venv/bin/activate  # On Windows, use `venv\Scripts\activate`
    
  2. 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.toml under optional-dependencies. For now, you can also just run pip install pytest build twine.)

Testing

This project uses pytest for testing.

  1. Install testing tools:

    pip install pytest
    
  2. Run the test suite:

    pytest
    

Building the Package

To package the project into source distributions and wheels for PyPI:

  1. Install the build tool:

    pip install --upgrade build
    
  2. Build the distributions:

    python -m build
    

    This will generate a source archive .tar.gz and a built wheel .whl inside the dist/ directory.

Publishing to PyPI

Once the package is built, you can upload it to PyPI using twine.

  1. Install Twine:

    pip install --upgrade twine
    
  2. Validate the built package:

    python -m twine check dist/*
    
  3. Upload to TestPyPI (Recommended first step to verify):

    python -m twine upload --repository testpypi dist/*
    
  4. 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:

  1. Set up the Python environment.
  2. Build the package distribution.
  3. 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

mylibrary_edison-0.1.0.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

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

mylibrary_edison-0.1.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

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

Hashes for mylibrary_edison-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1d0b70aa47e4e3e05fc8c2c46a07e29e38315634587f0019998b67b2c177490e
MD5 b1a5060761a3874a62c40a56b55ea8a3
BLAKE2b-256 0e75fa570ef30905a6e06aa271a54467f53900ef7d95ff5874d2828abf206644

See more details on using hashes here.

File details

Details for the file mylibrary_edison-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mylibrary_edison-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 63324776d4b6ba72b7c167dfd578ece91196e5a2fca0c2d839ecf8ef6fd5d99b
MD5 f4dd08221641562280bdce7746b99647
BLAKE2b-256 22df43dcd8bc44fa2f9ad3d10a858dc855aa616948ea87e053e67af4676efede

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