Skip to content

feat!: migrate API response keys to camelCase and mark v3.0.0 release#151

Merged
aditeyabaral merged 23 commits into
pesu-dev:devfrom
aditeyabaral:refactor/camelCase-field-names
May 24, 2026
Merged

feat!: migrate API response keys to camelCase and mark v3.0.0 release#151
aditeyabaral merged 23 commits into
pesu-dev:devfrom
aditeyabaral:refactor/camelCase-field-names

Conversation

@aditeyabaral
Copy link
Copy Markdown
Member

@aditeyabaral aditeyabaral commented May 22, 2026

This pull request introduces several significant improvements to the codebase, focusing on modernizing the Python environment, updating dependencies and tooling, standardizing API field naming to camelCase, and enhancing documentation and workflow automation. The changes ensure better consistency, improved developer experience, and alignment with current best practices.

Key changes:

Python version and dependency management updates:

  • Raised the minimum required Python version to 3.12 across documentation, workflows, and the Dockerfile, and added support for Python 3.14 in CI. Switched to using the uv tool for dependency management and virtual environment creation throughout the project. [1] [2] [3] [4] [5]
  • Updated the Docker build process to use a multi-stage build with uv and Python 3.14, improving image size and reproducibility.

Pre-commit, linting, and workflow enhancements:

  • Updated pre-commit configuration to use ruff-check and mdformat, removed blacken-docs and pyupgrade, and added new formatting checks such as check-added-large-files. Updated pre-commit workflow to use uv for installing and running hooks. [1] [2] [3]
  • Updated the list of enforced checks and development instructions in .github/CONTRIBUTING.md to reflect these changes. [1] [2] [3]

API field naming and serialization improvements:

  • Standardized API request and response fields to camelCase (e.g., knowYourClassAndSection, campusCode, instituteName) in the models, documentation, and usage examples. Updated the KYCASModel to use an alias generator for camelCase, and ensured output serialization uses these aliases. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14]

General codebase modernization:

  • Replaced pytz with the standard library's zoneinfo for timezone handling in app/app.py.
  • Dynamically set the FastAPI app version using the package version from metadata.

Documentation and template improvements:

  • Updated documentation, API examples, and pull request templates to reflect the new field naming conventions and script locations. [1] [2] [3] [4] [5] [6]

These updates collectively modernize the project's tooling, improve consistency and clarity in the API, and streamline the developer workflow.

@aditeyabaral aditeyabaral requested a review from a team as a code owner May 22, 2026 03:30
Replaces pip + requirements.txt with uv multi-stage build:
- builder: ghcr.io/astral-sh/uv:python3.12-bookworm-slim
- runtime: python:3.12-slim-bookworm (no uv in final image)
- UV_COMPILE_BYTECODE=1 for faster startup
- UV_LINK_MODE=copy for cross-stage compatibility
- uv.lock as source of truth

Image size: 285 MB (pip) → 231 MB (uv multi-stage), 54 MB reduction
… scripts

- lint and pre-commit CI: remove multi-version matrix, pin to Python 3.12
  (ruff and pre-commit hooks don't require multi-version runs)
- scripts/benchmark/util.py: add know_your_class_and_section param to make_request
- scripts/benchmark/benchmark_requests.py: add --know-your-class-and-section flag
ZoneInfo (Python 3.9+) is a drop-in replacement for pytz.timezone().
Removes pytz as a runtime dependency.
[dependency-groups] (PEP 735) is the correct home for dev-only tools
that are never published as package extras. Updates pre-commit CI to
install via uv sync instead of pip install .[dev].
@aditeyabaral aditeyabaral changed the title [BREAKING] Replace snake_case keys with camelCase feat!: migrate API response keys to camelCase and mark v3.0.0 release May 23, 2026
@aditeyabaral aditeyabaral self-assigned this May 23, 2026
Comment thread .github/CONTRIBUTING.md
Comment thread app/docs/authenticate.py
Comment thread app/app.py
Comment thread tests/functional/test_authenticate_functional.py
Comment thread tests/integration/test_app_integration.py
Comment thread tests/unit/test_request_model.py
- Upgrade Dockerfile base images from python3.12 to python3.14
- Update ruff target-version from py312 to py314
- Fix ruff pre-commit hook id from legacy alias `ruff` to `ruff-check`
- Fix stale Python 3.11 references in README to 3.12 (matching requires-python)
Reduces image size from ~150MB to ~117MB. Both builder and runtime
use Alpine to ensure musl-compatible wheels are installed for
compiled extensions (pydantic-core, selectolax).
Move AsyncIterator and Request to TYPE_CHECKING in app.py (annotation-only
uses); add from __future__ import annotations to keep them lazy on Python
<3.14. Configure runtime-evaluated-base-classes for pydantic.BaseModel to
suppress false positives in Pydantic model files where field types must
remain available at runtime.
@aditeyabaral aditeyabaral requested a review from Copilot May 24, 2026 03:20
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR delivers a breaking v3.0.0 update that standardizes the FastAPI /authenticate API contract to camelCase keys, modernizes the runtime/tooling (Python 3.12+, uv), and adjusts Docker/CI/docs/tests to match.

Changes:

  • Migrated request/response models to camelCase serialization via Pydantic alias_generator=to_camel, updated app logic to emit camelCase keys, and tightened request validation (extra="forbid").
  • Upgraded project metadata/tooling: Python >=3.12, version bump to 3.0.0, uv-based dependency management, and refreshed CI/pre-commit configuration.
  • Updated Docker build to a multi-stage uv flow and adjusted benchmarks/docs/tests to reflect the new API surface.

Reviewed changes

Copilot reviewed 22 out of 24 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
app/app.py Uses ZoneInfo and switches response dumping to camelCase aliases; app version now pulled from package metadata.
app/pesu.py Updates default field names and response payload keys (e.g., campusCode, knowYourClassAndSection).
app/models/request.py Enforces camelCase request aliases and forbids unknown request fields.
app/models/response.py Enables camelCase aliases for response serialization.
app/models/profile.py Enables camelCase aliases for profile serialization.
app/models/kycas.py Enables camelCase aliases for KYCAS serialization.
app/docs/authenticate.py Updates OpenAPI examples to camelCase keys.
Dockerfile Moves to uv-based builder image and Python 3.14 Alpine runtime.
pyproject.toml Bumps version to 3.0.0, Python to >=3.12, and adopts uv dependency groups.
requirements.txt Regenerated lock output for updated dependency set.
README.md Updates setup instructions and API docs/examples to camelCase and Python 3.12+.
.github/CONTRIBUTING.md Updates contributor setup to Python 3.12+ and uv workflows.
.github/workflows/pre-commit.yaml Uses uv sync --all-groups and updates Python matrix.
.github/workflows/lint.yaml Updates Python matrix to 3.12–3.14.
.pre-commit-config.yaml Updates ruff hook configuration and adds markdown formatting/size checks.
.github/PULL_REQUEST_TEMPLATE.md Updates benchmark script paths referenced by the template.
scripts/benchmark/util.py Adds KYCAS flag support and sends camelCase request key.
scripts/benchmark/benchmark_requests.py Adds CLI flag to include KYCAS in benchmark requests.
tests/unit/test_request_model.py Updates request validation tests for camelCase + forbidding deprecated keys.
tests/unit/test_pesu.py Updates response assertions for camelCase keys and adds CSRF client lifecycle test.
tests/unit/test_app_unit.py Adds unit test for CSRF refresh loop error logging.
tests/integration/test_app_integration.py Updates integration assertions for camelCase and adds deprecated/extra key rejection coverage.
tests/functional/test_authenticate_functional.py Updates functional assertions for camelCase response keys.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Dockerfile
Comment thread app/app.py
…ields

Define ProfileField as a Literal type alias in pesu.py and derive
DEFAULT_FIELDS from it via get_args(). Replace Literal[*PESUAcademy.DEFAULT_FIELDS]
in RequestModel with list[ProfileField], removing the PESUAcademy import
from the model entirely.
@aditeyabaral aditeyabaral merged commit 4e14e18 into pesu-dev:dev May 24, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants