Skip to content

Modernize repo: type hints, ruff, pre-commit, Python 3.14 CI#2

Merged
lijunzh merged 2 commits into
masterfrom
modernize-repo
Mar 8, 2026
Merged

Modernize repo: type hints, ruff, pre-commit, Python 3.14 CI#2
lijunzh merged 2 commits into
masterfrom
modernize-repo

Conversation

@lijunzh
Copy link
Copy Markdown
Owner

@lijunzh lijunzh commented Mar 8, 2026

Summary

This PR brings the 10-year-old wiggle repo into 2025 with modern Python tooling and best practices.

Changes

Code Quality & Typing

  • Type annotations throughout wiggle.py using from __future__ import annotations
  • py.typed marker (PEP 561) for downstream type checker support
  • verbose is now keyword-only in wiggle() — prevents positional arg footguns
  • Renamed wiggle_input_check_validate_inputs (private helper, clearer name)
  • Bug fix: xx validation was checking tt.shape[0] instead of xx.shape[0]

Linting & Formatting

  • Ruff added as linter/formatter with rules: E/W/F/I/UP/B/SIM/RUF
  • Pre-commit config with ruff hooks for auto-fixing on commit
  • All code passes ruff check and ruff format --check

CI/CD

  • Python test matrix expanded: 3.10 → 3.14 (was 3.10–3.12)
  • Dedicated lint job in CI pipeline
  • actions/setup-python updated from v3 → v5 (with allow-prereleases for 3.14)
  • Publish jobs now depend on both lint and tests

Packaging & Metadata

  • PyPI classifiers added (typed, Python versions, scientific/engineering)
  • pytest.ini_options in pyproject.toml

Tests

  • Expanded from 5 → 12 tests covering verbose output, sf/ax type validation
  • autouse fixture to close matplotlib figures after each test (no leaks)
  • Modernized RNG: np.random.randnnp.random.default_rng().standard_normal

Housekeeping

  • .gitignore cleaned up (removed irrelevant Django/Flask/Scrapy entries)
  • README rewritten with quick-start example, dev instructions, fixed CI badge URL

lijunzh added 2 commits March 7, 2026 18:01
…README

- Add type annotations throughout wiggle.py with from __future__ import annotations
- Add py.typed marker for PEP 561 typed package support
- Add ruff for linting & formatting with modern rule set (E/W/F/I/UP/B/SIM/RUF)
- Add pre-commit config with ruff hooks
- Expand CI test matrix to Python 3.10-3.14
- Add dedicated lint job to CI pipeline
- Update actions/setup-python from v3 to v5 (with allow-prereleases for 3.14)
- Add PyPI classifiers (Typing::Typed, all supported Python versions)
- Rename wiggle_input_check -> _validate_inputs (private, clearer name)
- Fix xx validation bug (was checking tt.shape[0] instead of xx.shape[0])
- Modernize RNG: np.random.randn -> np.random.default_rng().standard_normal
- Clean up .gitignore (remove irrelevant Django/Flask/Scrapy entries)
- Rewrite README with quick-start example and development instructions
- Fix CI badge URL (gatechzhu -> lijunzh)
- Add pytest.ini_options to pyproject.toml
- Add autouse fixture to close matplotlib figures after each test
- Expand test coverage: verbose output, sf type, ax type validation
- Make verbose keyword-only in wiggle() signature
Pillow 11.1.0 (transitive dep via matplotlib) doesn't ship pre-built
wheels for Python 3.14 yet, causing source builds to fail on CI runners
missing libjpeg headers. Will re-add once the ecosystem catches up.
@lijunzh lijunzh merged commit b1d2101 into master Mar 8, 2026
7 checks passed
@lijunzh lijunzh deleted the modernize-repo branch March 8, 2026 00:07
lijunzh added a commit that referenced this pull request Mar 15, 2026
Fixes dependabot alerts:
- #2: Pillow out-of-bounds write when loading PSD images (high)
- #1: fontTools arbitrary file write and XML injection (medium)
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