-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Use TypedDict argument unpacking for setuptools/distutils's setup #13400
Use TypedDict argument unpacking for setuptools/distutils's setup #13400
Conversation
This comment has been minimized.
This comment has been minimized.
Diff from mypy_primer, showing the effect of this PR on open source code: comtypes (https://github.com/enthought/comtypes)
- comtypes/test/setup.py:2: error: Cannot find implementation or library stub for module named "distutils.core" [import-not-found]
- comtypes/test/setup.py:2: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
+ comtypes/test/setup.py:4: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
+ comtypes/test/setup.py:6: error: Unexpected keyword argument "console" for "setup" [call-arg]
streamlit (https://github.com/streamlit/streamlit)
+ lib/setup.py:103:1: error: Unexpected keyword argument "project_urls" for "setup" [call-arg]
+ lib/setup.py:103:1: error: Unexpected keyword argument "python_requires" for "setup" [call-arg]
+ lib/setup.py:103:1: error: Unexpected keyword argument "install_requires" for "setup" [call-arg]
+ lib/setup.py:103:1: error: Unexpected keyword argument "extras_require" for "setup" [call-arg]
+ lib/setup.py:103:1: error: Unexpected keyword argument "zip_safe" for "setup" [call-arg]
+ lib/setup.py:103:1: error: Unexpected keyword argument "entry_points" for "setup" [call-arg]
apprise (https://github.com/caronc/apprise)
+ setup.py:64: error: Unexpected keyword argument "install_requires" for "setup" [call-arg]
+ setup.py:64: error: Unexpected keyword argument "entry_points" for "setup" [call-arg]
+ setup.py:64: error: Unexpected keyword argument "python_requires" for "setup" [call-arg]
+ setup.py:64: error: Unexpected keyword argument "setup_requires" for "setup" [call-arg]
antidote (https://github.com/Finistere/antidote)
+ setup.py:11: error: Unexpected keyword argument "use_scm_version" for "setup" [call-arg]
+ setup.py:11: error: Unexpected keyword argument "python_requires" for "setup" [call-arg]
+ setup.py:11: error: Unexpected keyword argument "install_requires" for "setup" [call-arg]
+ setup.py:11: error: Unexpected keyword argument "zip_safe" for "setup" [call-arg]
arviz (https://github.com/arviz-devs/arviz)
+ setup.py:48: error: Unexpected keyword argument "install_requires" for "setup" [call-arg]
+ setup.py:48: error: Unexpected keyword argument "extras_require" for "setup" [call-arg]
+ setup.py:48: error: Unexpected keyword argument "python_requires" for "setup" [call-arg]
schemathesis (https://github.com/schemathesis/schemathesis)
- File "/tmp/mypy_primer/old_mypy/venv/bin/mypy", line 8, in <module>
+ File "/tmp/mypy_primer/new_mypy/venv/bin/mypy", line 8, in <module>
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.13/site-packages/mypy/__main__.py", line 15, in console_entry
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.13/site-packages/mypy/__main__.py", line 15, in console_entry
cwltool (https://github.com/common-workflow-language/cwltool)
+ setup.py:86:1: error: Unexpected keyword argument "install_requires" for "setup" [call-arg]
+ setup.py:86:1: error: Unexpected keyword argument "extras_require" for "setup" [call-arg]
+ setup.py:86:1: error: Unexpected keyword argument "python_requires" for "setup" [call-arg]
+ setup.py:86:1: error: Unexpected keyword argument "use_scm_version" for "setup" [call-arg]
+ setup.py:86:1: error: Unexpected keyword argument "setup_requires" for "setup" [call-arg]
+ setup.py:86:1: error: Unexpected keyword argument "test_suite" for "setup" [call-arg]
+ setup.py:86:1: error: Unexpected keyword argument "tests_require" for "setup" [call-arg]
+ setup.py:86:1: error: Unexpected keyword argument "entry_points" for "setup" [call-arg]
+ setup.py:86:1: error: Unexpected keyword argument "zip_safe" for "setup" [call-arg]
materialize (https://github.com/MaterializeInc/materialize)
+ misc/python/materialize/setup.py:19: error: Unexpected keyword argument "install_requires" for "setup" [call-arg]
+ ci/deploy/pypi.py:27: error: Module has no attribute "run_setup" [attr-defined]
- ci/deploy/pypi.py:10: error: Cannot find implementation or library stub for module named "distutils.core" [import-not-found]
- ci/deploy/pypi.py:10: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
+ misc/python/materialize/cli/ci_coverage_pr_report.py:17: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
httpx-caching (https://github.com/johtso/httpx-caching)
+ setup.py:38: error: Unexpected keyword argument "python_requires" for "setup" [call-arg]
+ setup.py:38: error: Unexpected keyword argument "project_urls" for "setup" [call-arg]
+ setup.py:38: error: Unexpected keyword argument "zip_safe" for "setup" [call-arg]
+ setup.py:38: error: Unexpected keyword argument "install_requires" for "setup" [call-arg]
+ setup.py:38: error: Unexpected keyword argument "extras_require" for "setup" [call-arg]
dd-trace-py (https://github.com/DataDog/dd-trace-py)
- ddtrace/sourcecode/setuptools_auto.py:11: error: Unused "type: ignore" comment [unused-ignore]
|
I think the new errors is expected, currently Unpack[] in kwargs doesn't support extra |
Thanks for pointing me to the appropriate PEP Jelle! I considered the |
Less repetition, feels cleaner, and can be extended.
I also plan on using this technique in setuptools directly (pypa/setuptools#2345 (comment)) after which it'll be really close to be ready to be marked as
py.typed
Edit: hmm, I have to add
setuptools._distutils.core
, kinda muddles my "less repetition" point above...Edit 2: Unpacked TypedDict as kwargs doesn't seem to work as expected form the mypy_primer hit. Maybe that's something to be added to the spec. Or a mypy issue, idk