Skip to content

Modernize packaging and add type hints#26

Merged
craigds merged 12 commits intomasterfrom
cds-modernization
Dec 13, 2025
Merged

Modernize packaging and add type hints#26
craigds merged 12 commits intomasterfrom
cds-modernization

Conversation

@craigds
Copy link
Owner

@craigds craigds commented Dec 13, 2025

  • Migrate from setup.py to pyproject.toml
  • Support Django 4.2/5.2/6.0, Python 3.8-3.13
  • Add type hints and py.typed marker
  • Add ruff linting and mypy type checking
  • Update CI to use uv

@craigds craigds marked this pull request as ready for review December 13, 2025 10:49
Copilot AI review requested due to automatic review settings December 13, 2025 10:49
@craigds craigds merged commit d2d4b91 into master Dec 13, 2025
9 checks passed
Copy link

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 modernizes the django-fieldsignals package by migrating from setup.py to pyproject.toml-based packaging, adding comprehensive type hints throughout the codebase, and updating CI/CD infrastructure. The changes aim to improve maintainability, provide better IDE support through type annotations, and support contemporary Python and Django versions.

Key changes:

  • Migrated packaging from setup.py to pyproject.toml following PEP 621 standards
  • Added comprehensive type hints with mypy strict mode and py.typed marker for type checking support
  • Updated supported versions to Python 3.8-3.13 and Django 4.2+, with references to unreleased Django 5.2/6.0 (needs correction)

Reviewed changes

Copilot reviewed 11 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pyproject.toml Complete migration to modern pyproject.toml with build configuration, dependencies, and tool settings for ruff, mypy, and pytest. References Django 5.2/6.0 which don't exist yet.
setup.py Removed in favor of pyproject.toml
tox.ini Updated test matrix for Python 3.8-3.13 and Django 4.2/5.2/6.0, added mypy environment. References nonexistent Django versions.
fieldsignals/signals.py Added comprehensive type hints with TYPE_CHECKING imports, updated to use f-strings, and modernized super() calls
fieldsignals/tests/test_signals.py Added type hints to all test functions and helper classes, changed tuple to list for fields parameters, replaced django.utils.timezone.utc with datetime.timezone.utc
fieldsignals/init.py Added type imports, all export list, and changed version to string format
fieldsignals/tests/settings.py New minimal Django settings file for testing and django-stubs
fieldsignals/tests/init.py Removed test exports since pytest discovers tests automatically
fieldsignals/py.typed New empty marker file indicating the package supports type checking
MANIFEST.in Removed (no longer needed with pyproject.toml)
CLAUDE.md New documentation file with project overview and command reference
.gitignore Added entries for ruff cache, uv.lock, and Claude settings
.github/workflows/test.yml Updated to use uv for dependency management, added separate lint job, updated action versions, and expanded Python version matrix

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


[tool.setuptools.packages.find]
include = ["fieldsignals*"]

Copy link

Copilot AI Dec 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The py.typed marker file needs to be explicitly included in the package. Add a [tool.setuptools.package-data] section with: fieldsignals = ["py.typed"] to ensure the type marker is included in the distribution. Without this, type checkers won't recognize this package as typed.

Suggested change
[tool.setuptools.package-data]
fieldsignals = ["py.typed"]

Copilot uses AI. Check for mistakes.
Comment on lines +23 to +24
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.10",
Copy link

Copilot AI Dec 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing Python 3.9 and 3.11 classifiers. The project should either include these versions in testing and classifiers, or explicitly document why they are skipped.

Suggested change
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",

Copilot uses AI. Check for mistakes.
@craigds craigds deleted the cds-modernization branch December 23, 2025 00:19
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.

2 participants