Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for PEP 560 #305

Merged
merged 6 commits into from Nov 5, 2019
Merged

Add support for PEP 560 #305

merged 6 commits into from Nov 5, 2019

Conversation

ilevkivskyi
Copy link
Contributor

This is mostly important for typing module that is extensively using PEP 560 since Python 3.7. The goal of this PR is to make

class G(six.with_metaclass(ABCMeta, Generic[T])):
    ...

behave equivalently to

class G(Generic[T], metaclass=ABCMeta):
    ...

and

class G(Generic[T]):
    __metaclass__ = ABCMeta

on all Python versions (also with custom metaclasses on Python versions where it is supported).

@@ -16,7 +16,7 @@ install:
- pip install --upgrade --force-reinstall "setuptools; python_version != '3.2' and python_version != '3.3'" "setuptools < 30; python_version == '3.2'" "setuptools < 40; python_version == '3.3'"
- pip uninstall --yes six || true
- pip install --upgrade --force-reinstall --ignore-installed -e .
- pip install pytest
- pip install pytest typing
Copy link
Owner

Choose a reason for hiding this comment

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

Is it possible to test this without depending on typing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, this was just the simplest way. I thought it is OK to add it here since typing will not be a dependency for six itself. Do you want me to add an extra test, or replace the existing one? (I would prefer to keep the existing one.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(FWIW I added a typing-agnostic test.)

Copy link
Owner

Choose a reason for hiding this comment

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

Yes, I mainly wanted to make sure that the semantic change was tested directly rather than relying on typing.

@@ -16,7 +16,7 @@ install:
- pip install --upgrade --force-reinstall "setuptools; python_version != '3.2' and python_version != '3.3'" "setuptools < 30; python_version == '3.2'" "setuptools < 40; python_version == '3.3'"
- pip uninstall --yes six || true
- pip install --upgrade --force-reinstall --ignore-installed -e .
- pip install pytest
- pip install pytest typing
Copy link
Owner

Choose a reason for hiding this comment

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

Yes, I mainly wanted to make sure that the semantic change was tested directly rather than relying on typing.

@benjaminp benjaminp merged commit ebb0db5 into benjaminp:master Nov 5, 2019
@ilevkivskyi ilevkivskyi deleted the pep-560 branch November 5, 2019 13:10
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.

None yet

2 participants