Modernize packaging and prepare drawcal for PyPI#4
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Modernizes drawcal for PyPI distribution while tightening event-file validation and adding CI/test coverage to improve reliability and maintainability.
Changes:
- Migrates packaging from
setup.py/requirements.txtto PEP 517/518 viapyproject.tomland adds a GitHub Actions test workflow. - Improves event generation/reading: month-aware random events plus stricter JSON structure/date parsing with clearer failures.
- Refactors imports for cheaper package import, updates rendering helpers for Pillow compatibility, and adds regression tests with fixtures.
Reviewed changes
Copilot reviewed 15 out of 19 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
pyproject.toml |
Defines modern build metadata, dependencies, and entry points for PyPI. |
.github/workflows/tests.yml |
Adds CI matrix to run tests across Python 3.8–3.12. |
README.md |
Updates install/build/upload instructions and documents events JSON format. |
lib/drawcal/__init__.py |
Makes draw_calendar a lazy import to keep metadata import lightweight. |
lib/drawcal/cli.py |
Moves envstack initialization into CLI runtime and lazily imports renderer. |
lib/drawcal/events.py |
Adds month-aware bounds in get_events and validates JSON events structure/dates. |
lib/drawcal/drawlib.py |
Adds _text_size helper and fixes event start detection logic. |
lib/drawcal/config.py |
Updates copyright header (no functional change). |
tests/test_package.py |
Adds import/metadata and symbol exposure tests. |
tests/test_events.py |
Adds tests for invalid JSON/dates and month-bounded random events. |
tests/test_render.py |
Adds fixture-based render regression test. |
tests/fixtures/march-2025-events.json |
Provides deterministic events for render fixture test. |
tests/fixtures/march-2025-expected.png |
Adds expected image fixture for render regression. |
LICENSE |
Updates license header/copyright holder naming. |
.gitignore |
Adds ignores for build artifacts and agent/codex files. |
bin/drawcal |
Updates shebang/copyright header for script wrapper. |
setup.py |
Removes legacy setuptools packaging. |
requirements.txt |
Removes legacy dependency pin file. |
lib/drawcal/test.py |
Removes legacy in-package test script in favor of tests/. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several important updates to the
drawcalproject, focusing on modernizing the packaging and distribution, improving event file validation, updating copyright and project metadata, and enhancing compatibility and maintainability. The changes include migrating to PEP 517/518 build standards with a newpyproject.toml, improving event input validation and error handling, and updating documentation and CI workflows.Packaging and distribution modernization:
setup.pyto a modernpyproject.tomlbuild system, specifying metadata, dependencies, and project configuration for PEP 517/518 compliance. Removed the legacysetup.pyand test script. [1] [2] [3].github/workflows/tests.yml) to run tests across Python 3.8–3.12, improving CI coverage and reliability.Event input validation and error handling:
read_eventsfunction to validate that event files are lists of lists, ensure each date is a valid string inM/D/YYYYformat, and provide clear error messages for invalid files or JSON.get_eventsto respect the actual number of days in each month, preventing out-of-range dates.Codebase and API improvements:
__init__.pyandcli.pyto lazily load heavy dependencies, improving startup performance and keeping package metadata lightweight. [1] [2] [3]_text_sizehelper to ensure text rendering works across different Pillow versions. [1] [2] [3]Documentation and metadata updates:
README.mdwith new installation, build, and event file format instructions. [1] [2]LICENSEto reflect the new copyright holder and project name. [1] [2] [3] [4] [5] [6]These changes collectively modernize the project, improve user experience, and ensure better maintainability and reliability going forward.