API development
Pinchana API development happens inside independent Git submodules. The parent pinchana-api repository is orchestration/configuration, not one root Python package.
Clone correctly
Section titled “Clone correctly”git clone --recurse-submodules https://github.com/Pinchana/pinchana-api.gitcd pinchana-apiIf you already cloned without submodules:
git submodule sync --recursivegit submodule update --init --recursiveWork inside a service
Section titled “Work inside a service”For a scraper or gateway package:
cd pinchana-instuv sync --frozenuv run uvicorn pinchana_inst.main:app --host 0.0.0.0 --port 8082 --reloadOther packages follow the same pinchana_<name>.main:app convention where they expose FastAPI.
pinchana-core is a local path dependency used by services, so keep the parent/submodule checkout coherent when resolving locks or running tests.
Development Compose
Section titled “Development Compose”For integration testing across services without production VPN credentials:
docker compose --env-file .env -f docker-compose.dev.yml up --detach --buildThe development stack uses bridge networking, service DNS endpoints, direct ports, and VPN_ENABLED=false. It is intentionally different from production’s shared Gluetun namespace.
Run tests from the submodule that owns them:
cd pinchana-serveruv sync --frozenuv run pytest -qcd pinchana-instuv sync --frozenuv run pytest -qSome scraper repositories have opt-in live tests controlled by repository-specific environment variables. Keep live test URLs/credentials outside source control.
For a module without broad test coverage, at minimum validate its import/startup and the affected request path. Do not invent a root-wide formatter/linter command that the repository does not define.
Docker builds
Section titled “Docker builds”Build from the parent repo root because service Dockerfiles copy both the target submodule and pinchana-core:
docker build -f pinchana-inst/Dockerfile -t pinchana-inst .Running docker build . from inside the submodule can omit required local path dependencies.
Adding or changing a module
Section titled “Adding or changing a module”A new production module requires coordinated changes:
- Public
pinchana-<name>repository/submodule with package and Dockerfile. - Route patterns/container metadata in
config/modules.yaml. - Production and development Compose services/networking.
.env.exampleimage/port/endpoint/container variables.- Docker publishing workflow detection/build mapping.
- Gateway schema/adapter changes only when the normalized v1 contract truly needs them.
- Documentation/platform matrix updates.
Avoid leaking platform-specific response shapes into new clients; adapt module output into the shared API v1 schema.
Git submodule discipline
Section titled “Git submodule discipline”Normal feature work:
- Commit and push the submodule change first.
- From the parent repository, stage the updated submodule pointer.
- Commit/push the parent pointer alongside any parent config changes.
A parent commit must not point to an unreachable local-only submodule SHA.
Version releases are different: the current scripts/version.py release flow automates version updates, submodule commits/pushes, parent pointer commit/push, and optional release publication. See Operations and releases rather than manually reproducing the old version-bump sequence.