Grimoire Development Environment Setup
Summary
This process documents the configuration and standardization of the development environment for the grimoire repository. It details the transition to a uv-managed workflow, the replacement of legacy type checkers with ty, and the enforcement of separate virtual environments to prevent dependency coupling between the Grimoire standalone repository and the Sokrates monorepo.
Details
The grimoire project, specifically located within the grimoire/sets_app/ directory, underwent a significant environment stabilization process to ensure it remains independent of the primary Sokrates monorepo. Although the Sokrates workspace includes grimoire as a member for eventual merging, the current development strategy maintains them as separate entities with distinct git histories and dependency trees.
Virtual Environment Strategy
A key architectural decision was the implementation of two distinct virtual environments (venvs). This separation ensures that the grimoire standalone repository does not inherit or conflict with the dependencies of the Sokrates monorepo. The environment is managed using uv, which provides high-performance dependency resolution and synchronization.
Tooling and Dependency Migration
The project migrated its core development and quality assurance tools to a modernized stack:
- Type Checking: The project replaced
pyrightandbasedpyrightwithty. During the setup,tywas pinned to version0.0.25to establish a consistent baseline for type checking across the codebase. - Linting and Formatting:
ruffwas identified as the primary linter. During the environment refresh,ruffwas upgraded from version0.14.6to0.15.7to leverage the latest rules and performance improvements. - Build System: The project utilizes
hatchlingas the build backend, defined within thepyproject.tomlfile. - Testing Suite: To support robust testing of the FastAPI-based application, several development dependencies were integrated:
pytestandpytest-asynciofor asynchronous test execution.hypothesisfor property-based testing.httpxto serve as the test client for FastAPI endpoints.
Execution Workflow
The setup process followed a structured sequence to ensure environment integrity:
- Configuration Update: The
pyproject.tomlwas modified to remove legacy type checkers, addtyconfigurations, and include the new testing dependencies. - Synchronization: The command
uv syncwas executed to generate the virtual environment and install the exact versions specified in the lockfile. - Baseline Establishment: Following the sync, both
tyandruffwere executed against the source code to identify existing issues and establish a “clean” state for future development tickets. This baseline allows developers to distinguish between pre-existing technical debt and new issues introduced during feature development.