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

pyproject.toml requires mypy 1.4.0-1.5.0 + mypycify in setup.py: failure (AssertionError) #15877

Closed
mr-c opened this issue Aug 15, 2023 · 2 comments · Fixed by #16124
Closed
Labels
bug mypy got something wrong topic-mypyc mypyc bugs

Comments

@mr-c
Copy link
Contributor

mr-c commented Aug 15, 2023

Bug Report

When upgrading a mypycify-using Python project from mypy 1.3.0 to a newer version, a pip install of my project fails where it does not with mypy 1.3.0

To Reproduce

git clone https://github.com/common-workflow-language/cwltool
cd cwltool
sed  -i 's/mypy==1.3.0/mypy==1.4.0/' pyproject.toml  # or to 1.4.1, or 1.5.0
MYPYPATH=mypy-stubs CWLTOOL_USE_MYPYC=1 pip install  .

Expected Behavior

$ MYPYPATH=mypy-stubs CWLTOOL_USE_MYPYC=1 pip install .
Processing /home/michael/cwltool
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: setuptools in ./env3.11/lib/python3.11/site-packages (from cwltool==3.1) (66.1.1)

[snip]

Building wheels for collected packages: cwltool
  Building wheel for cwltool (pyproject.toml) ... done
  Created wheel for cwltool: filename=cwltool-3.1-cp311-cp311-linux_x86_64.whl size=3672349 sha256=c467454417b08ede66d0832b6a17e7b00cded2d7e6073be12100d83746bb04ae
  Stored in directory: /tmp/pip-ephem-wheel-cache-z0z1cpyr/wheels/ee/cd/42/595fc105979e9f4d5af86398d7a0f9de9008e61383a87ccdb1
Successfully built cwltool

Actual Behavior

(passing --no-binary mypy to pip install to get a more interesting stacktrace, the same error occurs without it)

$ MYPYPATH=mypy-stubs CWLTOOL_USE_MYPYC=1 pip install  . --no-binary mypy
Processing /home/michael/cwltool
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [35 lines of output]
      Traceback (most recent call last):
        File "/home/michael/cwltool/env3.11/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/michael/cwltool/env3.11/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/michael/cwltool/env3.11/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-rnls4s4_/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-rnls4s4_/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 323, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-rnls4s4_/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 338, in run_setup
          exec(code, locals())
        File "<string>", line 91, in <module>
        File "/tmp/pip-build-env-rnls4s4_/overlay/lib/python3.11/site-packages/mypyc/build.py", line 511, in mypycify
          groups, group_cfilenames = mypyc_build(
                                     ^^^^^^^^^^^^
        File "/tmp/pip-build-env-rnls4s4_/overlay/lib/python3.11/site-packages/mypyc/build.py", line 421, in mypyc_build
          group_cfiles, ops_text = generate_c(
                                   ^^^^^^^^^^^
        File "/tmp/pip-build-env-rnls4s4_/overlay/lib/python3.11/site-packages/mypyc/build.py", line 233, in generate_c
          emit_messages(options, errors.new_messages(), t2 - t1)
                                 ^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-rnls4s4_/overlay/lib/python3.11/site-packages/mypyc/errors.py", line 25, in new_messages
          return self._errors.new_messages()
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-rnls4s4_/overlay/lib/python3.11/site-packages/mypy/errors.py", line 871, in new_messages
          msgs.extend(self.file_messages(path))
                      ^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-rnls4s4_/overlay/lib/python3.11/site-packages/mypy/errors.py", line 857, in file_messages
          assert self.read_source
      AssertionError
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

Same for mypy 1.4.1 and 1.5.0

Your Environment

  • Mypy version used: 1.4.0+
  • Python version used: 3.11.2
@mr-c mr-c added the bug mypy got something wrong label Aug 15, 2023
@AlexWaygood AlexWaygood added the topic-mypyc mypyc bugs label Aug 15, 2023
@mr-c
Copy link
Contributor Author

mr-c commented Sep 7, 2023

I've git bisected this error down to 768ba66 by @koogoro from #15070
(using its parent commit 3d9661c I don't get an error).

Therefore the topic-mypyc label should probably be removed

@mr-c
Copy link
Contributor Author

mr-c commented Sep 15, 2023

Ping

hauntsaninja added a commit to hauntsaninja/mypy that referenced this issue Sep 16, 2023
Fixes python#15877

Regression was introduced by python#15070. Previously Errors objects created
in mypyc build would just use all the default values, now they use the
actual options object involved
ilevkivskyi pushed a commit that referenced this issue Sep 17, 2023
Fixes #15877

Regression was introduced by #15070. Previously Errors objects created
in mypyc build would just use all the default values, now they use the
actual options object involved
JukkaL pushed a commit that referenced this issue Oct 10, 2023
Fixes #15877

Regression was introduced by #15070. Previously Errors objects created
in mypyc build would just use all the default values, now they use the
actual options object involved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong topic-mypyc mypyc bugs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
@mr-c @AlexWaygood and others