Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

jaraco
Copy link
Member

@jaraco jaraco commented Aug 13, 2021

Fixes #337 by eschewing the namedtuple superclass. Allows for removal of PyPy workaround and incidental namedtuple interfaces.

@jaraco jaraco changed the base branch from main to maint/3.8.x August 13, 2021 22:38
@jaraco jaraco changed the base branch from maint/3.8.x to main August 13, 2021 22:38
@jaraco jaraco force-pushed the feature/337-EntryPoint-object branch from 3ab8f91 to 2eca591 Compare August 13, 2021 22:47

dist: Optional['Distribution'] = None

def __init__(self, *, name, value, group):
Copy link
Contributor

Choose a reason for hiding this comment

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

I would recommend going for explicit assignment here for the sake of readability and setting self.dist as well

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd actually like to keep the name/group/value as the essential attributes separate from the dist, which is optional and auxiliary. Agree with explicit assignment. I'm not sure it's possible.

Co-authored-by: Ronny Pfannschmidt <[email protected]>
@jaraco jaraco mentioned this pull request Aug 26, 2021
@jaraco
Copy link
Member Author

jaraco commented Aug 29, 2021

I'm a little reluctant to move forward with this implementation primarily because of concerns about compatibility. This change removes the ability to construct EntryPoint objects from three positional args. I'm debating whether this change can be introduced without supporting that interface, or if the positional args is worth retaining, or if it should be deprecated.

I'm aiming for "preferably one obvious way" to initialize an EntryPoint to limit the support surface. I'm even tempted to disallow construction of EntryPoint objects altogether.

Maybe the best approach is to implement a simple constructor, retain compatibility, and consider constraining the interface later. Edit: This approach is the one this PR enacts, attempting to retain compatibility.

@jaraco jaraco merged commit fa620f1 into main Aug 29, 2021
@jaraco jaraco deleted the feature/337-EntryPoint-object branch August 29, 2021 03:18
@mr-c
Copy link

mr-c commented Aug 29, 2021

Hello, this change broke stevedore which broke bandit for at least myself (but probably others)

https://github.com/common-workflow-language/cwltool/pull/1482/checks?check_run_id=3454232416#step:9:50
PyCQA/bandit#730

Reverting to importlib_metadata version 4.7.1 resolves the problem for me

@jaraco jaraco changed the title Exploring EntryPoint as a simple object Implement EntryPoint as a simple object (remove namedtuple) Aug 29, 2021
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.

Entrypoint __iter__ implemementation breaks _asdict
3 participants