Skip to content

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

Merged
RonnyPfannschmidt merged 1 commit into
mainfrom
claude/project-thread-p5dhgd
Oct 17, 2026
Merged

RonnyPfannschmidt merged 1 commit 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.

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().

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

@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?

@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
@bluetech

Copy link
Copy Markdown
Member

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

But it's not shared by default right?

IMO commit messages are public-facing messages, so they shouldn't contain cruft that is private to the author only.

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.

The _name2plugin cleanup becomes an is_blocked() check plus a pop: the
old truthiness guard only had to keep a blocked name's marker, and the
assert only narrowed the type for mypy. test_unregister_blocked now
checks that the block survives.

Fixes #763.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@RonnyPfannschmidt
RonnyPfannschmidt force-pushed the claude/project-thread-p5dhgd branch from c72b184 to 50585e0 Compare October 17, 2026 06:04
@RonnyPfannschmidt
RonnyPfannschmidt merged commit 09fabb1 into main Oct 17, 2026
20 checks passed
@RonnyPfannschmidt
RonnyPfannschmidt deleted the claude/project-thread-p5dhgd branch October 17, 2026 06:08
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