Skip to content

Dev tooling setup, src/ layout migration, and notebook QA#1

Merged
Palamabron merged 7 commits intomainfrom
setup/dev-tooling
Sep 8, 2025
Merged

Dev tooling setup, src/ layout migration, and notebook QA#1
Palamabron merged 7 commits intomainfrom
setup/dev-tooling

Conversation

@Palamabron
Copy link
Owner

@Palamabron Palamabron commented Sep 7, 2025

Summary

  • Migrate the project to a standard src/ layout at the repository root and enable a reproducible developer workflow with Hatch + uv and pre-commit hooks.
  • Add code quality tooling (Ruff, Black, MyPy) and notebook support via nbQA.

What’s changed

  • Move package to root src layout: src/alphapulse/{init.py,about.py}.
  • Configure version path for Hatchling: tool.hatch.version.path -> src/alphapulse/about.py.
  • Add optional-dependencies dev group (pre-commit, ruff, black, mypy, nbQA, stubs) and enable it via features=["dev"].
  • Pre-commit config: Ruff (lint + format), Black, MyPy, nbQA for .ipynb; exclude .ipynb from EOF/trailing whitespace hooks.
  • Update README with minimal local development setup (Hatch + uv).

Why

  • Standard src/ layout prevents import path issues and aligns with modern Python packaging practices.
  • Enforced formatting, linting, and typing improve code reliability and PR review speed.
  • Notebook QA (nbQA + Ruff/Black/MyPy) keeps notebooks consistent with code standards.

Implementation details

  • pyproject.toml:
    • [project.optional-dependencies].dev defined for tooling.
    • [tool.hatch.envs.default]: installer=uv, features=["dev"] to install editable .[dev] automatically.
    • Ruff/Black/MyPy configured for Python 3.11.
  • .pre-commit-config.yaml:
    • Ruff (—fix) + ruff-format, Black, MyPy (+ types), nbQA hooks (ruff, black with —nbqa-mutate, mypy).
    • pre-commit-hooks: check-yaml, check-toml; exclude .ipynb from EOF/trailing-whitespace.

Developer setup and testing

  • Create and enter environment:
    • hatch env remove default && hatch env create && hatch shell
  • Verify tooling:
    • which pre-commit
    • pre-commit install
    • pre-commit run --all-files
  • Project scripts (optional):
    • hatch run lint
    • hatch run format
    • hatch run types
    • hatch run all

Backward compatibility / migration notes

  • All imports should continue to work with the new src/ layout (no runtime API changes).
  • CI may require environment refresh to install extras via editable install (.[dev]).

Out of scope

  • No production logic changes.
  • No release version bump.

Checklist

  • pre-commit hooks installed and pass locally
  • Lint, format, types scripts pass
  • README updated for local dev
  • Notebooks (if any) lint/format/type check clean via nbQA

@Pheoxis
Copy link
Collaborator

Pheoxis commented Sep 7, 2025

Great :)

@Palamabron Palamabron requested a review from Copilot September 7, 2025 19:40

This comment was marked as outdated.

@Palamabron Palamabron requested a review from Copilot September 8, 2025 07:37

This comment was marked as outdated.

Palamabron and others added 2 commits September 8, 2025 09:38
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Palamabron Palamabron requested a review from Copilot September 8, 2025 07:42
Copy link
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 migrates the project to a standard src/ layout and establishes a comprehensive developer tooling setup with Hatch + uv for environment management and pre-commit hooks for code quality.

  • Migrates package structure to src/alphapulse/ layout with proper version configuration
  • Configures development tooling including Ruff, Black, MyPy, and nbQA for notebooks
  • Sets up pre-commit hooks and Hatch scripts for consistent code quality enforcement

Reviewed Changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/alphapulse/init.py Package initialization file with SPDX license header
src/alphapulse/about.py Version definition file for dynamic versioning
tests/init.py Test package initialization with license header
pyproject.toml Complete project configuration with dev dependencies, tooling settings, and Hatch scripts
README.md Updated documentation with local development setup instructions
LICENSE.txt MIT license file
.pre-commit-config.yaml Pre-commit configuration for code quality hooks including notebook support

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Palamabron and others added 2 commits September 8, 2025 10:00
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Palamabron Palamabron merged commit 4de88d4 into main Sep 8, 2025
@Palamabron Palamabron deleted the setup/dev-tooling branch September 8, 2025 08:01
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