free-claude-code/pyproject.toml
Ali Khokhar 51157f91bd
Refactor admin config into catalog-driven package (#926)
## Problem

Admin config was a single responsibility hub with manually duplicated
provider metadata. Provider labels, fields, template loading,
validation, persistence, and status lived in one place.

## Changes

| Before | After |
| --- | --- |
| Admin config lived in one large `api/admin_config.py` module. | Admin
config lives in package modules for manifest, sources, values,
validation, persistence, and status. |
| Provider admin fields and UI labels were manually duplicated. |
Provider admin fields and display names derive from `PROVIDER_CATALOG`
with admin-only help overrides. |
| `fcc-init` and Admin UI loaded `.env.example` separately. | `fcc-init`
and Admin UI use shared `config.env_template` loading. |
| Architecture docs pointed to the old admin config module. |
Architecture docs describe the package owners and catalog-driven
provider manifest. |

<!-- greptile_comment -->

<details open><summary><h3>Greptile Summary</h3></summary>

This PR refactors admin configuration into a catalog-driven package. The
main changes are:

- Split the former monolithic `api/admin_config.py` into manifest,
source loading, value presentation, validation, persistence, and
provider status modules.
- Generate provider admin fields and display names from
`PROVIDER_CATALOG` with admin-specific help overrides.
- Share `.env.example` loading between `fcc-init` and Admin UI defaults
through `config.env_template`.
- Update admin routes, Admin UI provider labels, architecture docs,
version metadata, and contract/API tests for the new module layout.
</details>

<h3>Confidence Score: 5/5</h3>

The refactor appears merge-safe with no code issues identified in the
reviewed changes.

The package split, catalog-driven provider metadata, shared environment
template loading, route updates, and tests/docs changes are cohesive and
covered by corresponding contract/API/CLI test updates.

<details><summary><h3><a href="https://www.greptile.com/trex"><img
alt="T-Rex"
src="https://greptile-static-assets.s3.amazonaws.com/trex/trex_green.svg"
height="20" align="absmiddle"></a> T-Rex Logs</h3></summary>

**What T-Rex did**
- T-Rex ran manifest validation for catalog provider before and after
routes, capturing base and head responses and catalog-alignment checks,
and confirmed the validation completed successfully.
- T-Rex evaluated the shared-env-template scenarios, observing the
before run with no config.env\_template module and the after run with
the module present, with patched loader values and all consistency
checks passing, and the run exited with code 0.
- T-Rex executed the package-admin-workflow validation, verifying the
base and after import paths, the load/validate/write workflow produced
matching outputs, and the run completed with exit code 0.

<a
href="https://app.greptile.com/trex/runs/12529845/artifacts"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewAllArtifactsDark.svg?v=1"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewAllArtifacts.svg?v=1"><img
alt="View all artifacts"
src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewAllArtifacts.svg?v=1"
height="32"></picture></a>

<sub><a href="https://www.greptile.com/trex"><img alt="T-Rex"
src="https://greptile-static-assets.s3.amazonaws.com/trex/trex_green.svg"
height="14" align="absmiddle"></a> Ran code and verified through
T-Rex</sub>
</details>

<sub>Reviews (1): Last reviewed commit: ["Refactor admin config into
catalog-drive..."](d6239d7953)
| [Re-trigger
Greptile](https://app.greptile.com/api/retrigger?id=40315222)</sub>

<!-- /greptile_comment -->
2026-06-27 15:37:29 -07:00

130 lines
3.6 KiB
TOML

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "free-claude-code"
version = "2.3.18"
description = "Middleware between Claude Code CLI (Anthropic API) and NVIDIA NIM"
readme = "README.md"
requires-python = ">=3.14.0"
dependencies = [
"fastapi[standard]>=0.136.3",
"uvicorn>=0.49.0",
"httpx[socks]>=0.28.1",
"markdown-it-py>=4.2.0",
"pydantic>=2.13.4",
"python-dotenv>=1.2.2",
"tiktoken>=0.13.0",
"python-telegram-bot>=22.8",
"discord.py>=2.7.1",
"pydantic-settings>=2.14.1",
"openai>=2.43.0",
"loguru>=0.7.0",
"aiohttp>=3.14.1",
"jsonschema>=4.25.0",
]
[project.scripts]
fcc-server = "cli.entrypoints:serve"
free-claude-code = "cli.entrypoints:serve"
fcc-init = "cli.entrypoints:init"
fcc-claude = "cli.launchers.claude:launch"
fcc-codex = "cli.launchers.codex:launch"
[project.optional-dependencies]
voice = [
"grpcio>=1.81.1",
"grpcio-tools>=1.81.1",
"nvidia-riva-client>=2.26.0",
]
voice_local = [
"torch>=2.12.1",
"transformers>=5.12.1",
"accelerate>=1.14.0",
"librosa>=0.10.0",
]
[tool.hatch.build.targets.wheel]
packages = ["api", "cli", "config", "core", "messaging", "providers"]
[tool.hatch.build.targets.wheel.force-include]
".env.example" = "config/env.example"
[tool.uv]
required-version = ">=0.11.0"
[tool.uv.sources]
torch = { index = "pytorch-cu130" }
[[tool.uv.index]]
name = "pytorch-cu130"
url = "https://download.pytorch.org/whl/cu130"
explicit = true
[dependency-groups]
dev = [
"pytest>=9.1.0",
"pytest-asyncio>=1.4.0",
"pytest-cov>=7.1.0",
"ty>=0.0.50",
"ruff>=0.15.18",
"pytest-xdist>=3.8.0",
]
[tool.ruff]
target-version = "py314"
line-length = 88
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # Pyflakes (undefined names, unused imports)
"I", # isort (import ordering)
"UP", # pyupgrade (modernise syntax for target Python version)
"B", # flake8-bugbear (common bugs and anti-patterns)
"C4", # flake8-comprehensions (idiomatic comprehensions)
"SIM", # flake8-simplify (simplifiable code patterns)
"PERF", # Perflint (performance anti-patterns)
"RUF", # Ruff-specific rules
]
ignore = [
"E501", # line too long — enforced by the formatter instead
"B008", # FastAPI Depends() in argument defaults is intentional
"RUF006", # fire-and-forget tasks intentionally not awaited
]
[tool.ruff.lint.isort]
known-first-party = ["api", "cli", "config", "core", "messaging", "providers", "smoke"]
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
line-ending = "auto"
skip-magic-trailing-comma = false
[tool.pytest.ini_options]
pythonpath = ["."]
addopts = "-n auto"
testpaths = ["tests"]
markers = [
"live: opt-in local smoke tests that can touch real services",
"interactive: smoke tests requiring manual user interaction",
"provider: live provider checks",
"messaging: live messaging platform checks",
"cli: CLI integration checks",
"clients: client compatibility checks",
"voice: voice transcription checks",
"contract: deterministic feature contract checks",
"smoke_target(name): route a smoke test behind FCC_SMOKE_TARGETS",
"xdist_group(name): group smoke provider items under pytest-xdist --dist=loadgroup",
]
[tool.ty.environment]
python-version = "3.14"
[tool.ty.analysis]
# Optional voice_local extra: torch, transformers, librosa for local whisper transcription
# Optional voice extra: nvidia-riva-client for nvidia_nim transcription provider
allowed-unresolved-imports = ["torch", "transformers", "librosa", "riva.client"]