Skip to main content

OpenAI-first hexagonal Python application scaffold for llmframe.

Project description

llmframe

OpenAI-first Python hexagonal application scaffold for the llmframe repository.

Requirements

  • Python 3.11+
  • uv for environment and dependency management

Setup

Install the project and development dependencies:

uv sync --all-extras

Project layout

The repository follows a hexagonal architecture layout:

src/llmframe/
├── domain/          # Pure business logic and invariants
├── application/     # Use cases and port interfaces
│   └── ports/
└── adapters/        # Input/output adapters at the system boundary
    ├── input/
    └── output/
tests/
├── unit/
└── integration/

LLM adapters

The repository includes reusable LLM output adapters under llmframe.adapters.output.llm. Today this package is intentionally OpenAI-first: OpenAI is the only implemented provider integration, while the surrounding structure is being kept hexagonal so additional providers can be added later without leaking provider-specific concerns into the shared/application layers.

Key package areas:

  • llmframe.adapters.output.llm.llm_adapter - provider-neutral high-level structured JSON and text generation adapter
  • llmframe.adapters.output.llm.providers.openai - OpenAI provider adapter, client builder, transport, DTOs, and parsing helpers
  • llmframe.adapters.output.llm.usage_tracker - aggregated token/cost tracking utilities

The sibling providers/anthropic and providers/gemini directories are architectural placeholders only; they are not wired integrations yet.

Example imports:

from llmframe.adapters.output.llm import LlmAdapter
from llmframe.adapters.output.llm.providers.openai import OpenAIClientSettings, build_provider
from llmframe.adapters.output.llm.usage_tracker import LlmUsageTrackerConfig, OpenAILlmUsageTracker

Quality checks

Run the local quality gate with uv:

uv run ruff format .
uv run ruff check .
uv run mypy .
uv run pytest

Release publishing

GitHub Actions publishes this package to PyPI using the workflow at .github/workflows/ci_cd.yaml.

  • Publishing is triggered by pushes to the master branch or manual workflow dispatch.
  • The workflow uses Python Semantic Release to determine the next version from conventional commits, create the release commit and tag, and generate changelog updates.
  • pyproject.toml version updates are release-managed: do not bump project.version in regular feature or fix commits; Semantic Release writes the new version during the release commit.
  • Package artifacts are built in CI and published to PyPI only.
  • If no releasable commits are detected, the publish job is skipped.
  • Publishing targets the llmframe project on pypi.org.

Before the workflow can publish successfully, configure a trusted publisher in the PyPI project settings for this GitHub repository and workflow file.

Also ensure the workflow has permission to use the repository GITHUB_TOKEN for creating release commits and tags.

Example release flow:

git commit -m "feat: add new llm transport option"
git push origin master

Notes

  • The import package name is llmframe.
  • Keep business logic inside domain/ and application/.
  • Keep framework, transport, persistence, and integration concerns in adapters/.

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

llmframe-2.0.1.tar.gz (132.9 kB view details)

Uploaded Source

Built Distribution

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

llmframe-2.0.1-py3-none-any.whl (29.1 kB view details)

Uploaded Python 3

File details

Details for the file llmframe-2.0.1.tar.gz.

File metadata

  • Download URL: llmframe-2.0.1.tar.gz
  • Upload date:
  • Size: 132.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for llmframe-2.0.1.tar.gz
Algorithm Hash digest
SHA256 6aedbee75ff3aeea03234877944a29715d318935d5174c713bc939804c93b63a
MD5 63ea1f922936e6c2337e1de83f04fabc
BLAKE2b-256 06918a351cf3c754761eb507b4028125e0a38bea30fcedc6376e8d1c3aebe139

See more details on using hashes here.

Provenance

The following attestation bundles were made for llmframe-2.0.1.tar.gz:

Publisher: ci_cd.yaml on Nexus-Thread/py-llmframe

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file llmframe-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: llmframe-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 29.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for llmframe-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6edea7e282af10ee8f200381e4c1ba756186488a5150bf27fb67a86558340070
MD5 6b2ec62766e5cae715890b332674fcd8
BLAKE2b-256 07d38c45a01066d80ebde41690e51bdb3730f633df306cc0892c060b257247ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for llmframe-2.0.1-py3-none-any.whl:

Publisher: ci_cd.yaml on Nexus-Thread/py-llmframe

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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