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.1.0.tar.gz (133.3 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.1.0-py3-none-any.whl (29.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for llmframe-2.1.0.tar.gz
Algorithm Hash digest
SHA256 51a6eea1948d693569c80f6bf969c49e0b33f33d5f1922b7a296e06fdeb9074b
MD5 6ef823ff1d450dcaa09e24e9a29a378b
BLAKE2b-256 6e5b400ca825e571ae9f0e60e79558289a9c260dca1bd6dd3a3748180a6165ac

See more details on using hashes here.

Provenance

The following attestation bundles were made for llmframe-2.1.0.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.1.0-py3-none-any.whl.

File metadata

  • Download URL: llmframe-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 29.2 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 de22eae5a262f0c3cb59b334d3e1bf4a2809d8fbcd37687f8a3349c331da67b2
MD5 9ff7c76d5aca5b24436d4296f581a2f8
BLAKE2b-256 8dadc7d7f64be077def47f8ec829a0e637a4c6ef9850fd32026146a6e1068014

See more details on using hashes here.

Provenance

The following attestation bundles were made for llmframe-2.1.0-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