Skip to content

Drop entry-point distribution info when unregistering a plugin - #767

Open
RonnyPfannschmidt wants to merge 2 commits into
mainfrom
claude/project-thread-p5dhgd
Open

RonnyPfannschmidt wants to merge 2 commits into
mainfrom
claude/project-thread-p5dhgd

Conversation

@RonnyPfannschmidt

@RonnyPfannschmidt RonnyPfannschmidt commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

Requested by Ronny · project thread

🤖 Written by Claude Opus 5.5 via Claude Code for the pluggy maintainers; I prompted it, it did the work, I read it.

Fixes #763. Two commits on top of main (after #759).

Before: unregister() left the plugin in list_plugin_distinfo() / list_plugin_distributions() (and so in pytest's "plugins:" header), and reloading the entry point appended a duplicate row.

After: both listings only show entry-point plugins that are still registered, and a reload takes the old slot.

How: the private _plugin_distinfo list of (plugin, dist) tuples becomes _name2dist: dict[str, Distribution], keyed by the registration name like _name2plugin. unregister() pops the name; the listings are built from the two dicts, so no identity map over plugin objects is needed. list_plugin_distinfo() now just wraps list_plugin_distributions().

Second commit: the _name2plugin cleanup in unregister() becomes if not self.is_blocked(name): pop. The old guard existed only to keep a blocked name's marker, and the assert name is not None was a leftover mypy narrowing from 2019. test_unregister_blocked now asserts the block survives, which it did not check before.

🤖 Generated with Claude Code

https://claude.ai/code/session_018ZTVJoihfHRVor2TQqGTRn

@RonnyPfannschmidt RonnyPfannschmidt self-assigned this Oct 9, 2026
@RonnyPfannschmidt
RonnyPfannschmidt force-pushed the claude/project-thread-p5dhgd branch from c6590f0 to 9af388b Compare October 9, 2026 11:55
@RonnyPfannschmidt
RonnyPfannschmidt changed the base branch from main to claude/project-thread-yz2zw2 October 9, 2026 11:55
@RonnyPfannschmidt
RonnyPfannschmidt added this pull request to stack #769 October 9, 2026 12:13
Base automatically changed from claude/project-thread-yz2zw2 to main October 9, 2026 12:22
@bluetech

bluetech commented Oct 9, 2026

Copy link
Copy Markdown
Member

The stack is not very clear, it says 2 commits but there are 8?

claude added 2 commits October 9, 2026 12:23
Key the recorded distributions by plugin name instead of keeping a
list of (plugin, dist) tuples. unregister() pops the name, so the
listing no longer shows unloaded plugins, and reloading an entry point
overwrites its slot instead of appending a duplicate.

Fixes #763.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018ZTVJoihfHRVor2TQqGTRn
The truthiness guard only had to keep the block marker of a blocked
name in place, and the assert only existed to narrow the type for mypy
(added with the 2019 type annotations). Say that directly with
is_blocked() and pop, and make test_unregister_blocked check that the
block survives, which it did not cover before.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018ZTVJoihfHRVor2TQqGTRn
@RonnyPfannschmidt
RonnyPfannschmidt force-pushed the claude/project-thread-p5dhgd branch from 9af388b to c72b184 Compare October 9, 2026 12:23
@RonnyPfannschmidt

Copy link
Copy Markdown
Member Author

pr stacking misstake

@bluetech

Copy link
Copy Markdown
Member

@RonnyPfannschmidt

Claude-Session: https://claude.ai/code/session_018ZTVJoihfHRVor2TQqGTRn

Out of curiosity I clicked this, but it goes to a login wall.

I think it would be better to remove these links, we shouldn't add private links to commit messages IMO.

@RonnyPfannschmidt
RonnyPfannschmidt force-pushed the claude/project-thread-p5dhgd branch from c72b184 to 5528401 Compare October 11, 2026 07:55
@RonnyPfannschmidt

Copy link
Copy Markdown
Member Author

It works as reference when shared so I kinda like to keep it

@RonnyPfannschmidt
RonnyPfannschmidt force-pushed the claude/project-thread-p5dhgd branch from 5528401 to c72b184 Compare October 11, 2026 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

list_plugin_distinfo() keeps unregistered plugins

3 participants