Skip to main content

A minimal but complete example of a modern Python package published to PyPI.

Project description

bloodhound-python

A minimal but complete example of a modern Python package: src layout, PEP 621 metadata in pyproject.toml, a typed library, a console script, tests, and a GitHub Actions release workflow that publishes to PyPI with Trusted Publishing (no API tokens stored anywhere).

Install

pip install bloodhound-python

Use it as a library

from bloodhound_python import Greeter, greet

greet("Ada")  # 'Hello, Ada!'
greet("Ada", salutation="Howdy")  # 'Howdy, Ada!'
Greeter(salutation="Hi", punctuation="?").greet("Ada")  # 'Hi, Ada?'

Use it from the shell

sample-greet Ada
sample-greet Ada --salutation Howdy --times 3
sample-greet --version

Develop

python -m venv .venv
.venv\Scripts\activate        # Windows;  source .venv/bin/activate on POSIX
pip install -e ".[dev]"

pytest                        # tests + coverage
ruff check . && ruff format --check .
mypy

Release

  1. Bump __version__ in src/bloodhound_python/__init__.py (the single source of truth — pyproject.toml reads it via [tool.hatch.version]).

  2. Update CHANGELOG.md.

  3. Tag and push:

    git tag v0.1.0 && git push origin v0.1.0
    

The release.yml workflow builds the sdist and wheel, uploads them to TestPyPI, then publishes to PyPI. Configure both as Trusted Publishers for this repo first (PyPI → Your projectsPublishing), matching workflow name release.yml and environments testpypi / pypi.

Manual release, if you'd rather not use CI

pip install build twine
python -m build            # -> dist/*.whl and dist/*.tar.gz
twine check dist/*
twine upload dist/*

Layout

bloodhound-python/
├── pyproject.toml              # build backend, metadata, tool config
├── README.md                   # rendered as the PyPI project page
├── LICENSE
├── CHANGELOG.md
├── src/bloodhound_python/
│   ├── __init__.py             # public API + __version__
│   ├── core.py                 # library logic
│   ├── cli.py                  # console script entry point
│   └── py.typed                # ships inline type hints (PEP 561)
├── tests/
└── .github/workflows/          # ci.yml, release.yml

The src layout is deliberate: tests import the installed package rather than the working directory, so a missing py.typed or an unlisted subpackage fails in CI instead of after release.

License

MIT — see LICENSE.

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

bloodhound_python-0.1.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

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

bloodhound_python-0.1.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file bloodhound_python-0.1.0.tar.gz.

File metadata

  • Download URL: bloodhound_python-0.1.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.10

File hashes

Hashes for bloodhound_python-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1da278b9095db4272f9a49d2609a3c7165999048e2e7fa8eb7752f8b26e5c045
MD5 8f1ef03e9f335df438d67ec8bb09d4df
BLAKE2b-256 d8eac965b8d314240d647e3940e95a374451e44cf32c72fc70ebcc555a6edbc5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bloodhound_python-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b920a046a6aff42a9a3cc209aa4a7d5422916e550eeff4ba198abf424a4e75d5
MD5 a76cff79f85657741c6b8be05c4ce609
BLAKE2b-256 fa320d822d8a9dd8a1aa1937da649d91c350c5baba5e292d38063a4c11c598f2

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