Drop C extension and move to pyproject.toml#1373
Draft
larsoner wants to merge 19 commits into
Draft
Conversation
Regenerate tvtk/src/array_ext.c with Cython 3.2.8. This supersedes the manual edit in enthoughtgh-1370 by picking up upstream Cython's own fix for the incorrect Py_DECREF after a failed PyList_SetItem in the generated __Pyx_CyFunction_get_is_coroutine helper (enthoughtgh-1369), rather than hand- editing generated code. Also add the `freethreading_compatible=True` directive to array_ext.pyx so the module declares Py_MOD_GIL_NOT_USED and does not force the GIL back on under a free-threaded interpreter. The module has no shared mutable state; verified on free-threaded CPython 3.14t that import keeps the GIL disabled and 128k concurrent set_id_type_array calls across 32 threads produce correct results. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Migrate all static metadata from setup.py into a PEP 621 [project] table in pyproject.toml (dynamic version, dependencies, entry points, SPDX BSD-3-Clause license). Bump the minimum Python to 3.10. setup.py now carries only the build-time TVTK class-ZIP generation and the doc commands; pytest config moves from setup.cfg (removed) to [tool.pytest.ini_options]. Drop the tvtk.array_ext Cython extension: set_id_type_array is now an alias of the existing pure-NumPy set_id_type_array_py in array_handler.py. Benchmarks showed the C loop was only ~2-3.5x faster on typical meshes for a once-per-dataset operation, so removing it drops the compiler requirement, yields a universal py3-none-any wheel, and works on free-threaded builds. This also makes enthoughtgh-1369 / enthoughtgh-1370 moot. Import tvtk lazily inside setup.py's build hooks (not at module scope) so that metadata/sdist builds under the PEP 517 setuptools.build_meta backend do not require tvtk to be importable; only the wheel's class-generation step does. Verified sdist/wheel contents against the 95 branch: the only differences are the removed extension sources/.so and intended metadata modernization (SPDX license, dropped "Programming Language :: C" classifier, py3-none-any wheel tag, no legacy not-zip-safe marker). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace the hardcoded mayavi.__version__ with setuptools_scm, which derives the version from git tags (e.g. "4.8.3" -> "4.8.4.dev22+g..."). At runtime mayavi/__init__.py reads the version from the installed package metadata via importlib.metadata, falling back to "0.0.0" when it cannot be resolved -- the same approach MNE-Python has used for years. No version_file or fallback_version is used, so sdist/wheel contents are unchanged (the version lives only in the package metadata). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Needs #1364 to be merged then a rebase
pyproject.toml+ setuptools_scm for versioning (modernize project)I compared the contents before and after this switch and they match!