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

Bugfix/incompatibility with setuptools 63.4.0 #8

Merged

Conversation

StefanD986
Copy link
Contributor

setuptools removed the format_command property of the bdist command, which setuptools-cythonize relies on.

This results in the following error:

File "D:\win_temp\pip-build-env-avucl34u\overlay\Lib\site-packages\setuptools_cythonize.py", line 166, in set_default_wheel_format
    cls.format_command['wheel'] = ('bdist_wheel', "Python .whl file")
AttributeError: type object 'CythonizeBdist' has no attribute 'format_command'

This PR contains two solutions:

  • It still works with setuptools versions <=63.3.0, so a workaround is to constrain the setuptools version to that (commit 318c6b4)
  • A future proof, way is in the second commit (aadd766), where only the format_commands dict (note the s at the end) is used, because since 63.3.0 this dict will retain the order, the list is not required/supported anymore. Because this is a fix that is not compatible with setuptools <63.3.0 the constraint in the setup.py was updated.

@anxuae I would suggest to make separate releases for the two commits, so that people who cannot use setuptools 63.4.0 for any reason can still fall back to the backwards compatible first fix.

setuptools removed the `format_command` property of the `bdist` command, which setuptools-cythonize relies on.

This results in the following error:
```
File "D:\win_temp\pip-build-env-avucl34u\overlay\Lib\site-packages\setuptools_cythonize.py", line 166, in set_default_wheel_format
    cls.format_command['wheel'] = ('bdist_wheel', "Python .whl file")
AttributeError: type object 'CythonizeBdist' has no attribute 'format_command'
```

It works with setuptools versions <=63.3.0, so a workaround is to constrain the setuptools version to that.
Using the `bdist.format_command`  property is not possible and not required anymore. The property was removed in setuptools 63.4.0 (commit c0a4ea65ab68c8c6cb6ad54cc646c58bede6f0f4 on the setuptools repo).

So with setuptools 63.4.0 it is enough to update the `format_commands` dict, however this also requires setuptools 63.4.0 to work. If setuptools <63.4.0 is required, then the previous commit offers a solution.
@jaraco
Copy link

jaraco commented Aug 3, 2022

I was not aware this interface was used publicly. I'll restore the compatibility shim.

I'd recommend setuptools-cythonize to implement something like pypa/setuptools@b8d50cf for backward compatibility if it's unacceptable to drop support for older Setuptools.

@jaraco
Copy link

jaraco commented Aug 3, 2022

Setuptools v63.4.1 is going out and should address the incompatibility. I'd still like to see setuptools-cythonize adapt to the new preferred interface.

@anxuae
Copy link
Owner

anxuae commented Aug 3, 2022

Thanks for reporting @StefanD986!

As @jaraco suggest it, I will implement a way to address the incompatibility

@anxuae
Copy link
Owner

anxuae commented Aug 8, 2022

Hi @StefanD986,

Can you try if the changes I've made fit for your needs?

@StefanD986
Copy link
Contributor Author

StefanD986 commented Aug 8, 2022

I tested it with setuptools 63.4.0 and 63.4.1 (these were the problematic versions for me), and the changes solve it for these. Thanks!

Sidenote: Trying this out is in theory easy (just specify the wheel as a direct reference) but was surprisingly hard: I was running into a bug in the packaging package that seems to have problems when a package was installed from a file:/// URL. In the end I worked around it by creating an sdist and deploying it to an internal pypi mirror.

@anxuae anxuae merged commit 50776c9 into anxuae:master Aug 8, 2022
clrpackages pushed a commit to clearlinux-pkgs/pypi-setuptools that referenced this pull request Aug 9, 2022
…version 63.4.1

Jason R. Coombs (26):
      Revert "Limit the scope of deprecation of the upload_docs command."
      Run pyupgrade --py37-plus
      In DummyCommand, simplify setting of kwargs.
      Implement TempdirManager setup and teardown as a pytest fixture.
      Implement LoggingSilencer setup and teardown as a pytest fixture. Required building a fixture combiner.
      Ran unittest2pytest
      ⚫ Fade to black.
      👹 Feed the hobgoblins (delint).
      Convert many tests to pytest native
      Remove compatibility shims for Setuptools.
      Replace save/restore of argv and cwd as pytest fixtures.
      Move setup/teardown from BuildExtTestCase into a fixture.
      Add tests capturing failure. Ref pypa/distutils#164.
      Use itertools.product to compute the product of two generators. Fixes pypa/distutils#164.
      Extract 'roots' variable.
      Add test compatibility on Windows.
      spell out read the docs
      Update changelog
      👹 Feed the hobgoblins (delint).
      Update changelog
      Bump version: 63.3.0 → 63.4.0
      Clean up cruft in changelog.
      Revert "Remove compatibility shims for Setuptools."
      Mark use of format_commands.append as deprecated. Ref anxuae/setuptools-cythonize#8.
      Update changelog.
      Bump version: 63.4.0 → 63.4.1

Manuel Kaufmann (3):
      Docs: enable tooltips on documentation
      Docs: create nice 404 pages
      Docs: pin sphinx-hoverxref as minor than v2
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.

3 participants