Skip to content

Implement Python Dev Environment for library-python #1

@crypto-a

Description

@crypto-a

User Story

As a Python library maintainer,
I need a reproducible dev environment with linting, typing, tests, and CI,
So that contributors can develop and verify changes consistently.

Details and Assumptions

  • Use Hatch for envs, builds, and versioning (pyproject.toml).

  • Tooling:

    • ruff (lint + format), mypy (typing), pytest + coverage (tests).
    • pre-commit hooks for ruff, mypy (optional), end-of-file-fixer, trailing-whitespace.
  • Python support: 3.9–3.12.

  • Scripts (via Hatch tool.hatch.envs): lint, fmt, typecheck, test, cov.

  • CI: GitHub Actions matrix (3.9–3.12) running hatch run test, ruff, mypy.

  • Strict packaging: single source of truth in pyproject.toml (PEP 621 metadata).

Acceptance Criteria

Scenario: Local setup
  Given a clean checkout
  When I run "pipx install hatch" and "hatch env create"
  Then dependencies install successfully for Python 3.9–3.12

Scenario: Code quality gates
  When I run "hatch run lint" and "hatch run typecheck"
  Then ruff reports no errors
  And mypy reports no type issues

Scenario: Test suite
  When I run "hatch run test"
  Then all tests pass
  And coverage summary is printed

Scenario: Pre-commit hooks
  Given pre-commit is installed and configured
  When I commit changes
  Then hooks run ruff formatting and linting
  And commits are blocked on failures

Scenario: CI pipeline
  Given a pull request is opened
  When GitHub Actions runs
  Then lint, typecheck, and tests pass across Python 3.9–3.12

Metadata

Metadata

Labels

enhancementNew feature or request

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions