Skip to content

Conversation

@RonnyPfannschmidt
Copy link
Member

this time more focuesed an nuanced

  • add the config
  • drop python3.10
  • prepare the drop of the setuptools compat apis

RonnyPfannschmidt and others added 8 commits October 25, 2025 16:11
also add uv based tooling to ease things

Co-Authored-By: Claude <[email protected]>

- add ruff/mypy
- allow claude to run some commands directly
- Bump requires-python to >=3.10 in pyproject.toml
- Remove Python 3.9 from classifiers, CI matrix, tox envlist
- Update PyPy version references (pypy3.9 → pypy3.10)
- Modernize type hints: Union → |, Optional → | None
- Move Callable imports to collections.abc
- Update pyupgrade to --py310-plus

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Replace .format() with f-string in _tracing.py
- Use walrus operator for dict.get() pattern in _tracing.py
- Convert string concatenation to parenthesized f-strings in _callers.py

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Create src/pluggy/_compat.py for legacy pkg_resources compatibility
- Move DistFacade from _manager.py to _compat.py
- Update PluginManager to use stdlib Distribution internally
- Add new list_plugin_distributions() method returning unwrapped Distribution objects
- Update list_plugin_distinfo() to wrap with DistFacade for backward compatibility
- Update test import to use _compat module

This separates legacy setuptools API emulation from modern importlib.metadata usage,
while maintaining full backward compatibility.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Add test coverage for the new list_plugin_distributions() method
- Verify it returns unwrapped importlib.metadata.Distribution objects
- Confirm DistFacade wrapping only in legacy list_plugin_distinfo()
- Extend existing test_load_setuptools_instantiation test

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Replace standalone coverage package with pytest-cov for better pytest integration.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Add test coverage for the error path in HookCaller._remove_plugin()
when attempting to remove a plugin that isn't registered with the hook.

This improves coverage from 99% to nearly 100%, with only defensive
code remaining uncovered (isinstance check that's always true).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Convert the isinstance(res, list) conditional to an assertion since
res is guaranteed to always be a list in call_historic:

1. Historic hooks are called with firstresult=False, which always
   returns a list from _multicall
2. Historic hooks cannot have wrappers/hookwrappers (enforced by
   validation), so no teardowns can modify the result type

This change:
- Documents the invariant explicitly
- Achieves 100% branch coverage on _hooks.py (was 99%)
- Makes the code clearer by removing unreachable defensive code
- Will catch future bugs if the invariant is violated

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@RonnyPfannschmidt
Copy link
Member Author

i jsut upped coverage to 100% locally - seems like codecov is broken

@RonnyPfannschmidt RonnyPfannschmidt marked this pull request as ready for review October 25, 2025 21:15
@RonnyPfannschmidt RonnyPfannschmidt requested review from bluetech, Copilot and nicoddemus and removed request for nicoddemus October 25, 2025 21:15
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 drops Python 3.9 support, migrates from setuptools' extras to PEP 735 dependency-groups, and prepares for deprecation of setuptools compatibility APIs by introducing a new _compat module and modernizing type hints.

  • Drops Python 3.9 support across all configuration files
  • Migrates from project.optional-dependencies to PEP 735 dependency-groups
  • Introduces _compat module with DistFacade and new list_plugin_distributions() API
  • Modernizes imports by using collections.abc.Callable and union type syntax

Reviewed Changes

Copilot reviewed 17 out of 19 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tox.ini Updates Python version constraints and replaces extras=testing with dependency_groups=testing
pyproject.toml Removes Python 3.9 classifier, updates requires-python, migrates to dependency-groups, adds uv configuration
.pre-commit-config.yaml Updates pyupgrade to target Python 3.10+
.github/workflows/main.yml Removes Python 3.9 test jobs, updates PyPy to 3.10
src/pluggy/_compat.py New module containing DistFacade compatibility wrapper
src/pluggy/_manager.py Moves DistFacade to _compat, adds list_plugin_distributions(), updates internal storage type
src/pluggy/_hooks.py Replaces typing.Callable, Optional, Union with modern equivalents, adds assertion for historic hooks
src/pluggy/_result.py Modernizes type hints using union syntax
src/pluggy/_tracing.py Modernizes imports and string formatting
src/pluggy/_callers.py Improves string formatting for warning message
testing/*.py Updates test files to use collections.abc.Callable and modern union syntax
CLAUDE.md Adds Claude Code configuration documentation
.claude/settings.json Adds Claude Code permissions configuration

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

@@ -1,5 +1,5 @@
[tox]
envlist=docs,py{39,310,311,312,313,py3},py{39}-pytestmain
envlist=docs,py{310,311,312,313,py3},py{310}-pytestmain
Copy link

Copilot AI Oct 25, 2025

Choose a reason for hiding this comment

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

Corrected spelling of 'focuesed' to 'focused' in PR title (note: this is metadata, not code).

Suggested change
envlist=docs,py{310,311,312,313,py3},py{310}-pytestmain
envlist = docs, py310, py311, py312, py313, py3, py310-pytestmain

Copilot uses AI. Check for mistakes.
@bluetech
Copy link
Member

Hi @RonnyPfannschmidt, do you think you could split this into more focused PRs? Like adding uv, adding claude, requiring Python 3.10, setuptools stuff.

@RonnyPfannschmidt
Copy link
Member Author

Absolutely

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