Skip to content

Modernize repo: src layout, pyproject.toml, CI/docs scaffolding#4

Merged
rfrenchseti merged 4 commits into
mainfrom
rf_260511_update_repo
May 11, 2026
Merged

Modernize repo: src layout, pyproject.toml, CI/docs scaffolding#4
rfrenchseti merged 4 commits into
mainfrom
rf_260511_update_repo

Conversation

@rfrenchseti
Copy link
Copy Markdown
Collaborator

@rfrenchseti rfrenchseti commented May 11, 2026

Purpose

Bring rms-picmaker onto the current SETI/RMS Python project template so it can be tested, type-checked, documented, and published like the other rms-* libraries. Prior to this branch the repository was a flat collection of three legacy scripts (picmaker.py, tiff16.py, colornames.py) at the repo root, with no packaging, no CI, no docs, and no tests directory.

Closes #

Changes/Implementation Details

  • Layout: moved the three source files to a src layout under src/picmaker/ (picmaker.py, tiff16.py, colornames.py); the package is now installable as rms-picmaker and importable as picmaker. The original imports inside picmaker.py were updated to from picmaker.colornames import ColorNames / from picmaker.tiff16 import ....
  • Packaging: added pyproject.toml (PEP 621) with [project] metadata, setuptools_scm for versioning, [project.scripts] picmaker = "picmaker.picmaker:main" console entry point, and dev / docs optional dependency groups.
  • requirements.txt: reduced to a single -e . line per the project's dependency-management rule.
  • CI scaffolding (.github/workflows/):
    • run-tests.yml — lint and test job templates (currently workflow_dispatch only; most steps commented out pending tests).
    • publish_to_pypi.yml / publish_to_test_pypi.yml — release-driven publish workflows.
  • Docs (docs/): Sphinx project (conf.py, index.rst, module.rst, contributing.rst), Napoleon enabled, Mermaid + MyST extensions, RTD theme, .readthedocs.yaml for RTD builds.
  • Repo metadata: new README.md with badges, rewritten CONTRIBUTING.md, GitHub issue templates and PR template, codecov.yml, .gitignore refresh, .vscode/settings.json, and scripts/run-all-checks.sh / scripts/read-docs.sh developer scripts.
  • CODE_OF_CONDUCT.md removed from the repo root; the canonical copy is now linked from the docs site.
  • CODEBASE_REVIEW.md added at the repo root — a structured analysis of the legacy source against the new project rules (.cursor/rules/*), enumerating findings by dimension (structure, best-practices, types, testing, CI, packaging, ...) and a recommended priority list. This is intended as a working document for the follow-up cleanup work and is not a user-facing artifact.

Type of Change

  • Bug fix (non-breaking)
  • New feature (non-breaking)
  • Breaking change (fix or feature that alters existing behavior or public API)
  • Refactor (no functional or API changes)
  • Documentation
  • Tests only (no production code change)
  • CI / Build / Dependencies

The "Breaking change" box is checked because the import path moved from top-level picmaker / tiff16 / colornames modules at the repo root to picmaker.picmaker / picmaker.tiff16 / picmaker.colornames. No prior PyPI release of rms-picmaker exists, so there are no downstream consumers to break, but the rename is mechanical and worth flagging.

Testing

  • Unit tests pass
  • Integration tests pass (if applicable)
  • End-to-end tests pass (if applicable)
  • New or updated tests for changed code
  • Tested manually (describe below if applicable)

Manual verification: pip install -e \".[dev]\" succeeds end-to-end in a clean Python 3.12 venv (the previous pyproject.toml self-reference issue — \"picmaker\" / \"picmaker[docs]\" in the dev extra — was fixed in this branch to \"rms-picmaker[docs]\" so pip no longer tries to resolve a non-existent picmaker distribution on PyPI). No pytest runs yet because tests/ is empty; this is called out as a Critical finding in CODEBASE_REVIEW.md §4.

Potential Impacts

  • Import paths change (import picmakerfrom picmaker import picmaker for the legacy entry points). The console script picmaker is unchanged for end users.
  • CI is intentionally inert at the end of this branch — workflows are present but only workflow_dispatch-triggered, and most steps are commented out. Follow-up PRs should re-enable the matrix and individual checks (this is Priority 1 in CODEBASE_REVIEW.md).
  • No runtime behavior change in any of the three legacy source files (only the imports inside picmaker.py were rewritten to use the new package layout; tiff16.py and colornames.py are byte-identical aside from their new location).

Checklist

  • Code follows project style (ruff check, ruff format) — legacy code not yet reformatted; tracked in the review document
  • Type annotations present and mypy passes — legacy code has no annotations; tracked in the review document
  • No secrets or credentials committed
  • No warnings or errors introduced (CI, linters, type checking, builds) — CI not yet running
  • Docstrings and Sphinx docs updated (if applicable) — Sphinx config added; legacy docstrings unchanged
  • CHANGES.md updated (if user-facing change) — no CHANGES.md in the repo yet
  • No temporary or debug code left in
  • Performance impact assessed (see Potential Impacts above)
  • Breaking changes flagged in Type of Change above

Notes

This PR is the packaging/scaffolding half of modernization. It deliberately does not touch the contents of the three legacy source files beyond the import rewrites required by the layout move, so the diff stays reviewable. The work needed to bring the source itself up to the project's .cursor/rules/python_best_practices.mdc standard (split the 3,493-line picmaker.py, add __init__.py / __all__ / py.typed, migrate optparseargparse, add type annotations, replace print with logging, fix mutable defaults / builtin shadowing, write tests) is captured in CODEBASE_REVIEW.md at the repo root and should land in follow-up PRs.

The commit history on the branch is rough (Everything gone, New repo format, Working repo, Prior to reorg); reviewers should look at the squash diff rather than per-commit.

Made with Cursor

Summary by CodeRabbit

  • New Features

    • Added automated documentation site with Sphinx integration via ReadTheDocs
    • Added CI/CD pipelines for automated testing and publishing to PyPI
  • Documentation

    • Added comprehensive project documentation with guides and examples
    • Added structured issue templates for bug reports and feature requests
    • Expanded contributor guidelines and pull request standards
  • Chores

    • Modernized project configuration using pyproject.toml
    • Added development environment setup and verification scripts
    • Configured editor and code quality tools

Review Change Stack

@rfrenchseti rfrenchseti merged commit 9f55adf into main May 11, 2026
1 check was pending
@rfrenchseti rfrenchseti deleted the rf_260511_update_repo branch May 11, 2026 19:21
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 11, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: b9a8f048-bb42-4498-963b-6d8d18e50840

📥 Commits

Reviewing files that changed from the base of the PR and between ae564fd and da18d60.

📒 Files selected for processing (45)
  • .coveragerc
  • .cursor/rules/bug_report.mdc
  • .cursor/rules/dependency_management.mdc
  • .cursor/rules/documentation.mdc
  • .cursor/rules/environment_best_practices.mdc
  • .cursor/rules/git_workflow.mdc
  • .cursor/rules/how_to.mdc
  • .cursor/rules/pull_request.mdc
  • .cursor/rules/python_best_practices.mdc
  • .cursor/rules/security.mdc
  • .cursor/settings.json
  • .cursor/skills/critique-test-suite/SKILL.md
  • .cursor/skills/python-codebase-analysis/SKILL.md
  • .cursor/skills/python-codebase-analysis/reference.md
  • .cursor/skills/run-all-checks/SKILL.md
  • .github/ISSUE_TEMPLATE/bug_report.md
  • .github/ISSUE_TEMPLATE/config.yml
  • .github/ISSUE_TEMPLATE/feature_request.md
  • .github/ISSUE_TEMPLATE/other.md
  • .github/pull_request_template.md
  • .github/workflows/publish_to_pypi.yml
  • .github/workflows/publish_to_test_pypi.yml
  • .github/workflows/run-tests.yml
  • .gitignore
  • .readthedocs.yaml
  • .vscode/settings.json
  • CODEBASE_REVIEW.md
  • CODE_OF_CONDUCT.md
  • CONTRIBUTING.md
  • README.md
  • codecov.yml
  • docs/Makefile
  • docs/code_of_conduct.md
  • docs/conf.py
  • docs/contributing.rst
  • docs/index.rst
  • docs/make.bat
  • docs/module.rst
  • pyproject.toml
  • requirements.txt
  • scripts/read-docs.sh
  • scripts/run-all-checks.sh
  • src/picmaker/colornames.py
  • src/picmaker/picmaker.py
  • src/picmaker/tiff16.py

Walkthrough

This PR modernizes the entire rms-picmaker project infrastructure. It establishes Python best practices via Cursor AI rules, configures the package with setuptools and pyproject.toml, sets up Sphinx documentation with Read the Docs integration, creates GitHub Actions workflows for testing and publishing, provides structured contribution guidelines with issue templates, and includes AI-powered code analysis skills. Minor import fixes align the codebase with the new package structure.

Changes

Project Modernization: Tooling, Standards, and Infrastructure Setup

Layer / File(s) Summary
Coding Standards & Project Rules
.cursor/rules/python_best_practices.mdc, .cursor/rules/security.mdc, .cursor/rules/documentation.mdc, .cursor/rules/dependency_management.mdc, .cursor/rules/git_workflow.mdc, .cursor/rules/environment_best_practices.mdc, .cursor/rules/pull_request.mdc, .cursor/rules/how_to.mdc, .cursor/rules/bug_report.mdc
Establishes enforced coding standards (Python 3.10+, type hints, Google-style docstrings, strict mypy/ruff, TDD), security practices, documentation requirements (Sphinx + ReadTheDocs, complete cross-referencing), dependency management (single-source-of-truth in pyproject.toml), Git workflow (Conventional Commits, squash merges), environment isolation, and contributor expectations.
Package Metadata and Build Configuration
pyproject.toml, requirements.txt, codecov.yml
Defines build system (setuptools + setuptools_scm), project metadata (rms-picmaker, Python ≥3.10), runtime dependencies (astropy, numpy, pillow, scipy, rms-*), optional dev/docs groups, tool configuration (pytest, coverage at 90%, mypy strict, ruff), and console entry point. Simplifies requirements.txt to editable install.
Editor and Environment Configuration
.cursor/settings.json, .vscode/settings.json, .gitignore
Standardizes editor indentation (tabs, trailing whitespace trimming, rulers at 80/90/100 columns). Updates .gitignore for PDM (.pdm.toml, .pdm-python, .pdm-build/), virtual environments (.venv*, env/, venv*/), and common artifacts (caches, logs, backups).
Documentation Build and Serving
docs/conf.py, .readthedocs.yaml, docs/Makefile, docs/make.bat, docs/index.rst, docs/module.rst, docs/contributing.rst, docs/code_of_conduct.md
Configures Sphinx with autodoc, Napoleon (Google docstrings), MyST (Markdown), Intersphinx, and Mermaid; integrates with Read the Docs (Ubuntu 24.04, Python 3.12, docs extra); provides Unix/Windows build scripts; creates landing page, auto-generated module API docs, and split contributing/CoC pages.
CI/CD Workflows and Automation
.github/workflows/publish_to_pypi.yml, .github/workflows/publish_to_test_pypi.yml, .github/workflows/run-tests.yml, scripts/run-all-checks.sh, scripts/read-docs.sh
Adds PyPI publish workflow (on GitHub Release), Test PyPI manual workflow, and skeleton test runner. Implements comprehensive check script supporting parallel/sequential ruff lint/format, mypy, pytest, Sphinx build, pymarkdown scan. Includes documentation builder with platform-specific HTML opening (Linux xdg-open, macOS open, Windows cmd.exe).
Contributor Guidance and Issue Templates
.github/ISSUE_TEMPLATE/bug_report.md, .github/ISSUE_TEMPLATE/feature_request.md, .github/ISSUE_TEMPLATE/other.md, .github/ISSUE_TEMPLATE/config.yml, .github/pull_request_template.md, CONTRIBUTING.md
Creates structured issue templates (bug with environment/reproduction/expected/actual, feature with motivation/solution/alternatives, general question/discussion). Defines PR template with purpose/changes/testing/impacts/checklist sections. Rewrites CONTRIBUTING.md with Getting Started, Development Workflow, and Coding Standards. Disables blank issues.
AI Skills and Codebase Analysis Tools
.cursor/skills/critique-test-suite/SKILL.md, .cursor/skills/python-codebase-analysis/SKILL.md, .cursor/skills/python-codebase-analysis/reference.md, .cursor/skills/run-all-checks/SKILL.md
Defines skills for AI-assisted test suite critique (23-point checklist on assertions, coverage, fixtures), high-level codebase analysis (10 dimensions: structure, best practices, typing, testing, performance, maintainability, security, dependencies, technical debt, packaging), and running project checks. Includes severity/phrasing conventions and .cursor/rules/ references.
Project Overview and Codebase Review
README.md, CODEBASE_REVIEW.md
Expands README with badges (release, tests, docs, coverage, PyPI, activity, license), Features, Installation, Getting Started, Contributing, Links, and Licensing sections. Adds comprehensive CODEBASE_REVIEW.md documenting critical/high findings (legacy god module, missing tests, type annotations, CI gaps) with prioritized action plan spanning CI enforcement, package scaffolding, testing, ruff fixes, CLI migration, module splitting, logging, mypy annotation, and publishing. Deletes global CODE_OF_CONDUCT.md (moved to docs/).
Code Import Fixes
src/picmaker/picmaker.py
Updates imports to use package-qualified paths (picmaker.colornames, picmaker.tiff16) and unconditional astropy.io.fits import (removes legacy pyfits fallback).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant