Skip to main content

PyPI Python License

The shared Python substrate for ForkTex services.

Fourteen modules, one library, one set of opinions. Import only what you need — each module's third-party dependency is an optional extra, so a service that wants structured logging never pays for Qdrant.

forktex 0.9.0 is a different package from forktex 0.8.x. Up to 0.8.1 this name shipped an agentic CLI. That tool now lives in backlog/ pending republication under its own name. If you want the CLI, pin forktex==0.8.1.

pip install forktex

Modules

Primitives — always available, no extra required:

Module What it is
log Structured JSON logging (Loki-ready), trace_id contextvar, setup_logging
error AppError hierarchy, AppErrorCode, ErrorEnvelope, to_envelope
types Base Pydantic models, frozen value objects, camelCase wire shapes
iso Canonical ISO-8601 date/time — every datetime it returns is UTC-aware

Role facades — one per piece of infrastructure:

Module Extra What it is
database — Async Postgres/SQLAlchemy: sessions, ORM bases, CRUD, advisory locks, migrations
cache — Async Redis: @cached, namespaced keys, invalidation
graph — Typed multi-edge in-memory graph algebra (BFS/DFS, subgraphs)
queue [queue] arq background jobs: @task, enqueue, make_worker
storage [storage] S3/MinIO objects: presigned URLs, bucket lifecycle
store [store] Schemaless documents (MongoDB)
vector [vector] Qdrant vector search: collections, hybrid/dense/sparse
vault [vault] Fernet encryption at rest, EncryptedJSON column type

Bootstrap — process-level wiring:

Module Extra What it is
api [api] FastAPI app factory: middleware stack, error envelope, health probes
worker [worker] Queue-consumer hosts: standalone process, embedded in a lifespan, process pool

Install extras as needed — pip install "forktex[storage,vector]", or pip install "forktex[all]" for everything.

Quick start

from contextlib import asynccontextmanager

from fastapi import Depends, FastAPI
from sqlalchemy.ext.asyncio import AsyncSession

from forktex.database import close_engine, init_engine, session_scope
from forktex.log import setup_logging

setup_logging(service="my-api")


@asynccontextmanager
async def lifespan(app: FastAPI):
    init_engine(settings.db_url, pool_pre_ping=True, pool_recycle=1800)
    yield
    await close_engine()


app = FastAPI(lifespan=lifespan)


@app.get("/projects")
async def list_projects(session: AsyncSession = Depends(session_scope)):
    ...

Depends(session_scope) is the correct form. get_session is the same generator wrapped in asynccontextmanager for async with use in service code — passing it to Depends injects the context-manager object, not a session. See docs/database.md.

A module whose extra is missing raises an ImportError that names it:

ImportError: Install 'forktex[vector]' (qdrant-client) to use forktex.vector

Documentation

One page per module under docs/, each covering install, wiring, the public surface, the error contract, and measured gotchas. docs/development.md is the contributor guide.

Development

make install     # poetry install --with dev --all-extras
make test        # pytest with the coverage floor
make ci          # format-check · lint · license-check · typecheck · audit · test · build · smoke

Integration tests run against real Postgres, Redis, MinIO, Qdrant and MongoDB via testcontainers — Docker must be available.

License

Dual-licensed: AGPL-3.0-or-later, or a commercial license from FORKTEX S.R.L. (info@forktex.com). See LICENSE and NOTICE.

Metadata

Release files for forktex 0.11.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for forktex 0.11.0
File Size Uploaded Provenance Actions
forktex-0.11.0.tar.gz 102.4 kB Without provenance Details for forktex-0.11.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for forktex 0.11.0
File Interpreter ABI Platform Actions
forktex-0.11.0-py3-none-any.whl Python 3 none any Details for forktex-0.11.0-py3-none-any.whl

Total release size: 260.0 kB

Release files / forktex-0.11.0.tar.gz

Download URL forktex-0.11.0.tar.gz
Size 102.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f4d6fd9ad65f82f7a856bdb6640f8b52916551e7ac1b29743566c606e167711a
BLAKE2b-256 checksum
How to use checksums
07fcb293954fff4ca6e9a2a9a53fa717851566eb0d9e4edc5a2a18d71a4da14c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Release files / forktex-0.11.0-py3-none-any.whl

Download URL forktex-0.11.0-py3-none-any.whl
Size 157.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e524be03fe575beaf3ffce76ca149a7ef5541bfcf24688ede2bcad7b263b28fd
BLAKE2b-256 checksum
How to use checksums
039979a5d004e5107ee6a5b726186c0680050c8cc4e943f9fbbdacb74a2d2b3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Security for forktex 0.11.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page