This file provides comprehensive guidance to Claude Code (claude.ai/code) when working with the Foundry Python Core repository.
It is your goal to enable the contributor while insisting on highest standards at all times:
- Fully read, understand and follow this CLAUDE.md and ALL recursively referenced documents herein for guidance on style and conventions.
- In case of doubt apply best practices of enterprise grade software engineering.
- On every review you make or code you contribute raise the bar on engineering and operational excellence in this repository
- Do web research on any libraries, frameworks, principles or tools you are not familiar with.
- CRITICAL: Continuously update this CLAUDE.md when you discover new learnings, tool usage patterns, architecture insights, or efficiency improvements. This ensures you become a more effective pair programmer over time. Document what you learned, why it matters, and how to apply it.
ALWAYS follow these principles when writing ANY code, especially tests:
-
SonarQube Rules Compliance: All code must comply with SonarQube rules before considering it complete.
- S1192 (String Duplication): Extract repeated string literals (duplicated 3+ times) into module-level constants
- Define constants at the top of the file after imports with descriptive names (e.g.,
EXPECTED_TIMESTAMP_PREFIX,API_ENDPOINT_BUCKET_WRITE) - This applies to test files as well - tests are production code and must meet the same quality standards
-
DRY Principle (Don't Repeat Yourself): Never duplicate code or string literals
- If you find yourself copying the same string literal multiple times, extract it to a constant
- If you find yourself copying test logic, extract it to a helper function or fixture
- Even in tests: constants improve maintainability and reduce typo risks
-
Raise the Bar on Clean Code: Every commit should improve code quality
- Run
mise run lintAFTER writing code to catch issues immediately - Fix all SonarQube issues before considering work complete
- Never generate code that violates quality rules - prevent technical debt at the source
- Run
Why this matters: SonarQube failures block CI/CD pipelines. Code that doesn't meet quality gates cannot be merged. By following these principles proactively, we prevent wasted cycles and maintain the high quality standards this project demands.
- uv, python and development dependencies are already installed
- Use
uv sync --all-extrasto install any missing dependencies - Use
pytest ...to run tests - Use
aignostics_foundry_core ...to run the CLI - Use
mise run lintto check code style and types - Use
mise run test_unit,mise run test_integration,mise run test_e2efor testing - Use
mise run auditfor security audits
If you write code yourself, it is a strict requirement to validate before completion:
- ALWAYS run
mise run lintfirst - Linting must pass before running tests - Unit, integration and e2e test suites must pass
- Auditing must pass
Foundry Python Core - Foundational infrastructure for Foundry components.
See the Toolchain Overview section in FOUNDRY_README.md for the complete toolchain.
CRITICAL: Requires Python 3.11+ (>=3.11, <3.15). Specified in .python-version, CI tests against 3.11-3.14.
Every test MUST have at least one marker (unit, integration, or e2e). Tests without markers won't run in CI.
mise run test_unit # Fast, isolated
mise run test_integration # Real local services
mise run test_e2e # End-to-endCoverage: Goal 100%, minimum 85%.
See tests/CLAUDE.md for detailed testing guidance including markers, fixtures, parallelization, and best practices.
git clone git@github.com:aignostics/foundry-python-core.git
cd foundry-python-core
mise run install # uv sync + pre-commit hooks
mise run lint && mise run test_unitgit checkout -b feat/my-feature
# Make changes, then validate
mise run lint # MUST pass before tests
mise run test_unit
mise run test_integration
# Full validation before PR
mise run all # lint + test + docs + audit
git commit -m "feat(module): description"
git push origin feat/my-featureuv is the package manager:
uv sync --all-extras # Install all dependencies
uv add package-name # Add dependency
uv build # Build wheel and sdistConfiguration: See pyproject.toml for:
requires-python = ">=3.11, <3.15"dependencies- Runtimedependency-groups.dev- Development tools
Build system: Hatchling
Primary tasks:
mise run all # Run all checks (lint + test + docs + audit)
mise run install # Setup dev environment
mise run clean # Remove artifacts
mise run lint # Ruff, pyright
mise run test_* # Various test suites
mise run docs # Build documentation
mise run audit # Security and license checksNox sessions: lint, test, docs, audit - See noxfile.py for details.
Pre-commit hooks: Auto-format with ruff, type check with pyright, detect secrets. Run manually: mise run pre_commit_run_all
Type checking: PyRight (strict mode) must pass in CI.
Code style: Ruff handles all formatting and linting (120 char limit, Google-style docstrings). See pyproject.toml for configuration.
All tool configuration lives in these files (single source of truth):
pyproject.toml- Ruff, MyPy, pytest, coverage, commitizenpyrightconfig.json- PyRight configuration.pre-commit-config.yaml- Pre-commit hooksnoxfile.py- Test and build automation.license-types-allowed- License compliance
Workflows: ci-cd.yml (main pipeline), reusable workflows for lint, test, audit, deploy.
Tests run on: Python 3.11-3.14, Linux (ubuntu-latest)
See .github/CLAUDE.md for complete CI/CD documentation.
- README.md - Quick start
- CONTRIBUTING.md - Contribution guidelines
- CODE_STYLE.md - Code style guide
- SECURITY.md - Security policy
- FOUNDRY_README.md - Comprehensive project guide and toolchain overview
- RELEASE_WORKFLOW.md - Release process
- ATTRIBUTIONS.md - Third-party licenses
# Get started
mise run install && mise run lint && mise run test_unit
# Development loop
mise run lint && mise run test_unit && mise run test_integration
# Full validation before PR
mise run all # runs lint + test + docs + audit
# Version bump and release
cz bump [patch|minor|major]
# Run CLI
aignostics_foundry_core --helpBuilt with operational excellence practices.