Skip to content

[feature] Add __contains__ into PyRequires #20107

Description

@andrey-zherikov

What is your suggestion?

This request came up from working on renaming "python_requires" package (see #20076 for reference).

My "python_requires" package (let call it my-package) provides a class (let call it MyRecipe) that used through python_requires_extend. This MyRecipe class accesses self.python_requires["my-package"].path and this expression must be changed to support new and old names.

My current solution is to do this:

if 'my-package' in dict(self.python_requires.items()):
    use(self.python_requires['my-package'].path)
else:
    use(self.python_requires['my-new-package'].path)

However it would be better way to simply do this:

if 'my-package' in self.python_requires:
    use(self.python_requires['my-package'].path)
else:
    use(self.python_requires['my-new-package'].path)

Have you read the CONTRIBUTING guide?

  • I've read the CONTRIBUTING guide

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions