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.
forktex0.9.0 is a different package fromforktex0.8.x. Up to 0.8.1 this name shipped an agentic CLI. That tool now lives inbacklog/pending republication under its own name. If you want the CLI, pinforktex==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_sessionis the same generator wrapped inasynccontextmanagerforasync withuse in service code — passing it toDependsinjects 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.10.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| forktex-0.10.0.tar.gz | 101.6 kB | Without provenance | Details for forktex-0.10.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| forktex-0.10.0-py3-none-any.whl | Python 3 | none | any | Details for forktex-0.10.0-py3-none-any.whl |
Total release size: 258.5 kB
Release files / forktex-0.10.0.tar.gz
| Download URL | forktex-0.10.0.tar.gz |
|---|---|
| Size | 101.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f7f41d807ee829a0b4344eaa387b314337a64cc710a9c96d4d9ff6e8b24dc59c
|
|
BLAKE2b-256 checksum How to use checksums |
69952bc761c09c8161f7c46a0af6741d5751c48639d9165bae3b4223a81300f2
|
| 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.10.0-py3-none-any.whl
| Download URL | forktex-0.10.0-py3-none-any.whl |
|---|---|
| Size | 156.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a992c77d072ec63e5d5121b3c317cbcdba3ffca2b9bcb0727bc11a786dc47d1c
|
|
BLAKE2b-256 checksum How to use checksums |
568fee804eb28ca8fa942ae045c68d8667817e3e3d7fa1dae68d641f882ebd70
|
| 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.10.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.