[WIP] Fix-up Cython build #4326
Closed
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.
As the modules we Cythonize are
.pyfile, both the compiled extension and the.pyfile get installed. On macOS and Linux, this doesn't appear to present an issue as the.sowill be loaded before the.pyfile. So the.pyfiles are effectively ignored on these platforms. However it seems Windows loads the.pyfile before the.pyd(Windows compiled extension).To fix this, we make some tweaks to the build process. Namely we rename the
.pyfile to a.pyxfile, which exclude from packaging (just as we exclude the.cfile Cython generates). Thus we avoid having two files with the same name and different file extensions, which may be loaded in arbitrary order. We make sure to return the source directory to the original state by reverting the renaming when we are done.For this to work effectively on CI, we start installing into the Conda environment instead of doing an editable install. This way we know only the compiled extension was installed.