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

hotfix: address metaclass definition in PythranBuildExt #2230

Conversation

agriyakhetarpal
Copy link

@agriyakhetarpal agriyakhetarpal commented Aug 20, 2024

Description

I'm not sure if this is the best fix for #2228 or if this is something that should be resolved in setuptools instead, but this PR is a small fix that resolves the metaclass conflict in Pythran that is coming from setuptools's new v73.0.0 release. I can close this PR if it gets resolved elsewhere!

TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

The test suite is running on my fork here: agriyakhetarpal#1 and I have verified that the fix works by running a few of the tests locally with both setuptools>=73 and setuptools<73 (the tests do take some time to fire away, though!), and in the meantime, #2229 pins setuptools to <73 which is an easier fix to incorporate.

Changes made

  • PythranBuildExtMeta derives from type(LegacyBuildExt) – which ensures that PythranBuildExtMeta is a subclass of the metaclass used by LegacyBuildExt, and
  • instead of defining a new class inside the __getitem__ method, it now uses the type() function to dynamically construct a new class.

Additional context

xref to some downstream issues where this was discovered:

  1. SciPy v1.13.1 pyodide/pyodide#5011, Scipy build issue with setuptools 73.0 pyodide/pyodide#5018
  2. BLD: build failure with new setuptools 73.0.0 scipy/scipy#21416
  3. setuptools v73.0.0 conda-forge/setuptools-feedstock#356

@agriyakhetarpal
Copy link
Author

The offending commit in setuptools (between version 72.0.0 and version 73.0.0) seems to be f9398b1f. I can confirm that the fix I propose through this PR works – I verified by testing a portion of the tests: python -m pytest pythran/tests/test_list.py.

@agriyakhetarpal
Copy link
Author

Closing since this is not needed anymore: https://github.com/pypa/setuptools/releases/tag/v73.0.1. A release should be up on PyPI soon.

@agriyakhetarpal agriyakhetarpal deleted the fix/setuptools-73-metaclass branch August 20, 2024 18:28
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.

1 participant