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

Support next types-setuptools update #14781

Merged
merged 4 commits into from
Feb 26, 2023

Conversation

Avasam
Copy link
Contributor

@Avasam Avasam commented Feb 25, 2023

A simple type-only change since mypyc explicitely uses setuptools' monkeypatching. And setup.py imports from setuptools.

Tests should stay the same. This should fix a sudden failure of tests once python/typeshed#9795 is merged.

setup.py Outdated
# Use multi-file compilation mode on windows because without it
# our Appveyor builds run out of memory sometimes.
multi_file=sys.platform == "win32" or force_multifile,
ext_modules = cast(
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need the cast here?

Copy link
Contributor Author

@Avasam Avasam Feb 25, 2023

Choose a reason for hiding this comment

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

setup is imported from setuptools, the ext_modules param expects a Sequence[setuptools.Extension] but mypycify can return a list of either setuptools.Extension or distutils.core.Extension in python < 3.12.

Since setup.py imports setuptools. We know mypycify will always return list[setuptools.Extension], but the type system doesn't know that.

Copy link
Member

Choose a reason for hiding this comment

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

I'd strongly prefer to avoid casts here, since they don't work well with mypyc. Can we use an assertion instead?

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 sure can. It's a list so I think I'd have to use a typeguard. Hopefully that's fine.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd strongly prefer to avoid casts here, since they don't work well with mypyc.

Is the setup.py compiled by mypyc?

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

setup.py Outdated Show resolved Hide resolved
Co-authored-by: Jelle Zijlstra <[email protected]>
@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@AlexWaygood
Copy link
Member

(I just merged the typeshed PR)

@JelleZijlstra JelleZijlstra merged commit ab7b69a into python:master Feb 26, 2023
@AlexWaygood
Copy link
Member

Hmm, looks like this hasn't fixed things unfortunately — tests are now failing on master 😕

https://github.com/python/mypy/actions/runs/4275505309/jobs/7442902873

AlexWaygood added a commit to AlexWaygood/mypy that referenced this pull request Feb 26, 2023
@AlexWaygood
Copy link
Member

(I'm investigating now what's up)

AlexWaygood added a commit to AlexWaygood/mypy that referenced this pull request Feb 26, 2023
The latest release of `types-setuptools` is causing type-check errors (and, therefore, build errors) on the `master` branch: see, e.g. https://github.com/python/mypy/actions/runs/4275505309/jobs/7442902732. python#14781 addressed some of the new errors, but didn't quite fix the build.
@AlexWaygood
Copy link
Member

hauntsaninja pushed a commit that referenced this pull request Feb 28, 2023
- The latest release of `types-setuptools` started causing type-check
errors (and, therefore, mypyc build errors) on the `master` branch: see,
e.g.
https://github.com/python/mypy/actions/runs/4275505309/jobs/7442902732.
- #14781 addressed some of the new errors, but didn't quite fix the
build.
- #14788 then pinned the `types-setuptools` dependency as a temporary
stopgap measure.
- This PR now attempts to unpin `types-setuptools` and fix the build
errors in a more principled way.
@Avasam Avasam deleted the types-setuptools-update branch March 2, 2023 11:29
AlexWaygood pushed a commit to AlexWaygood/mypy that referenced this pull request Mar 2, 2023
A simple type-only change since mypyc explicitely uses setuptools'
monkeypatching. And `setup.py` imports from setuptools.

Tests should stay the same. This should fix a sudden failure of tests
once python/typeshed#9795 is merged.
AlexWaygood added a commit to AlexWaygood/mypy that referenced this pull request Mar 2, 2023
- The latest release of `types-setuptools` started causing type-check
errors (and, therefore, mypyc build errors) on the `master` branch: see,
e.g.
https://github.com/python/mypy/actions/runs/4275505309/jobs/7442902732.
- python#14781 addressed some of the new errors, but didn't quite fix the
build.
- python#14788 then pinned the `types-setuptools` dependency as a temporary
stopgap measure.
- This PR now attempts to unpin `types-setuptools` and fix the build
errors in a more principled way.
JelleZijlstra pushed a commit that referenced this pull request Mar 2, 2023
The mypyc build was recently broken by a new release of
`types-setuptools`. This was fixed on `master` by the following two PRs:
- #14781
- #14787

However, the mypyc build is still broken on the 1.1 branch:
https://github.com/python/mypy/actions/runs/4311688115/jobs/7521345529.

This PR cherry-picks the two PRs that fixed the build to the 1.1 branch.

---------

Co-authored-by: Avasam <[email protected]>
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.

4 participants