rgc-backend-kit
rgc-backend-kit is a reusable Python backend component library extracted from ai_recipes.
It currently provides:
rgc_backend_kit.security: framework-neutral JWT token lifecycle management.rgc_backend_kit.storage: S3-compatible object storage clients, capability presets, and profile routing.
The package is designed for business services that need shared infrastructure without importing another application's settings, ORM models, response classes, or global factories.
Host applications still own business logic such as login, password verification, permissions, file records, upload policies, and response schemas. See Integration Boundary.
Requirements
- Python
>=3.10 pyjwt>=2.8.0,<2.13.0for JWT support- Optional
redisfor Redis-backed token storage - Optional
fastapifor FastAPI dependency adapters - Optional
boto3/botocorefor S3-compatible storage
Install
From PyPI:
pip install rgc-backend-kit
With optional features:
pip install "rgc-backend-kit[fastapi,redis,storage]"
As a dependency in another project:
[project]
dependencies = [
"rgc-backend-kit>=0.1.1,<0.2.0",
]
Use extras only for the optional integrations that project needs:
[project]
dependencies = [
"rgc-backend-kit[redis]>=0.1.1,<0.2.0",
"rgc-backend-kit[storage]>=0.1.1,<0.2.0",
]
Host applications may add their own constraints for shared dependencies. For example, a Frappe 16 app should let Frappe keep PyJWT in its supported range and only add this package directly:
[project]
dependencies = [
"rgc-backend-kit>=0.1.1,<0.2.0",
]
Local development:
uv sync --extra dev
JWT Quick Start
from datetime import timedelta
from rgc_backend_kit.security import JWTConfig, JWTManager, RedisTokenStore
manager = JWTManager(
config=JWTConfig(
secret="replace-with-a-long-random-secret",
issuer="my-service",
audience="my-client",
access_token_ttl=timedelta(minutes=60),
refresh_token_ttl=timedelta(days=7),
),
token_store=RedisTokenStore(redis),
)
token_pair = await manager.issue_pair(subject="user-id", claims={"role": "admin"})
payload = await manager.decode_access_token(token_pair.access_token)
rotated = await manager.rotate_refresh_token(token_pair.refresh_token)
await manager.revoke_access_token(rotated.access_token)
Storage Quick Start
from rgc_backend_kit.storage import (
MINIO_CAPABILITIES,
S3StorageConfig,
StorageFactory,
StorageProfileConfig,
)
factory = StorageFactory.from_configs(
client_configs={
"minio_public": S3StorageConfig(
access_key="minio",
secret_key="minio123",
endpoint="127.0.0.1:9000",
public_endpoint="img.example.com",
bucket_name="public-assets",
secure=False,
secure_public=True,
capabilities=MINIO_CAPABILITIES,
)
},
profiles={
"avatars": StorageProfileConfig(
client="minio_public",
base_path="avatars",
public=True,
)
},
)
avatars = factory.get_profiled_storage("avatars")
url = avatars.build_public_url("demo.png")
Tests
Default tests do not require external services:
uv run --extra dev pytest -q
Redis integration tests require a real Redis instance:
REDIS_URL=redis://:password@127.0.0.1:6379/0 uv run --extra dev pytest -q -m integration
Build package artifacts:
uv build
Validate the built wheel in an isolated environment before publishing:
rm -rf /tmp/rgc-backend-kit-package-full-test
mkdir -p /tmp/rgc-backend-kit-package-full-test
cd /tmp/rgc-backend-kit-package-full-test
uv venv
uv pip install '/home/rgc318/Projects/rgc-backend-kit/dist/rgc_backend_kit-0.1.1-py3-none-any.whl[fastapi,redis,storage]' httpx
Documentation
Metadata
Release files for rgc-backend-kit 0.1.1
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 |
|---|---|---|---|---|
| rgc_backend_kit-0.1.1.tar.gz | 57.3 kB | With provenance | Details for rgc_backend_kit-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rgc_backend_kit-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for rgc_backend_kit-0.1.1-py3-none-any.whl |
Total release size: 73.0 kB
Release files / rgc_backend_kit-0.1.1.tar.gz
| Download URL | rgc_backend_kit-0.1.1.tar.gz |
|---|---|
| Size | 57.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
77500f659eb5b8525f778c83d2b70433ee4fcd371ae40aada989002b0e467eae
|
|
BLAKE2b-256 checksum How to use checksums |
9cc89e34e6efb74532350c1425ec13a04691ab6fd0aabb7498230e020b566fa3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 26, 2026.
Transparency logRelease files / rgc_backend_kit-0.1.1-py3-none-any.whl
| Download URL | rgc_backend_kit-0.1.1-py3-none-any.whl |
|---|---|
| Size | 15.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bb289ce70656ceac61d2698fe9144384e15422b8fce4b10ceebfb7d0f773e630
|
|
BLAKE2b-256 checksum How to use checksums |
870955794541f082d5836cf47be9914004dd2cd9306a25eb1a9545daef25a594
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 26, 2026.
Transparency logSecurity for rgc-backend-kit 0.1.1
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for rgc_backend_kit-0.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 26, 2026.
Transparency logA 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.