Skip to content

__package____spec__.parent#1719

Open
DimitriPapadopoulos wants to merge 1 commit intopypa:mainfrom
DimitriPapadopoulos:__package__
Open

__package____spec__.parent#1719
DimitriPapadopoulos wants to merge 1 commit intopypa:mainfrom
DimitriPapadopoulos:__package__

Conversation

@DimitriPapadopoulos
Copy link
Contributor

@DimitriPapadopoulos DimitriPapadopoulos commented Feb 26, 2026

  • I have added a news fragment under changelog.d/ (if the patch affects the end users)

Summary of changes

Removed deprecated __package__, scheduled for removal in Python 3.15.

Test plan

Just CI.

import sys

if not __package__:
if not __spec__ or not __spec__.parent:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had to add the not __spec__ test to avoid this MyPy error:

src/pipx/__main__.py:4: error: Item "None" of "ModuleSpec | None" has no attribute "parent"  [union-attr]

But then I doubt __main__.__spec__ can be None here. Perhaps disabel this MyPy error?

@DimitriPapadopoulos DimitriPapadopoulos marked this pull request as ready for review February 26, 2026 23:59
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.

1 participant