Skip to content

Do not pre-cythonize when calling sdist - #15567

Merged
jeremiedbb merged 3 commits into
scikit-learn:masterfrom
ogrisel:no-cythonize-sdist
Nov 8, 2019
Merged

jeremiedbb merged 3 commits into
scikit-learn:masterfrom
ogrisel:no-cythonize-sdist

Conversation

@ogrisel

@ogrisel ogrisel commented Nov 8, 2019

Copy link
Copy Markdown
Member

Pre-generated c/cpp source files from Cython are not guaranteed to be forward with future Python releases. This PR changes the setup.py to always require a recent version of Cython when building scikit-learn from source.

This is a variant of #15533 that does not try to attempt to automatically install the build dependencies (numpy, scipy and cython) using a pyproject.toml file because of how pip current work.

See the discussion in #15533 for more details.

This means that cython must be installed manually first when building
scikit-t learn from a source tarball for future releases.

In case Cython is missing or too old, an informative error message is
raised.
@jeremiedbb

Copy link
Copy Markdown
Member

So just to be sure, this PR will only affect people who install sklearn by downloading the source distribution right ?

@ogrisel

ogrisel commented Nov 8, 2019 •

Copy link
Copy Markdown
Member Author

So just to be sure, this PR will only affect people who install sklearn by downloading the source distribution right?

Yes.

For users building from a git clone, it will also give a more informative error message when Cython is missing or too old.

@ogrisel

ogrisel commented Nov 8, 2019

Copy link
Copy Markdown
Member Author

I also fixed the ability to do python setup.py dist_info which was broken for no valid reason.

@adrinjalali adrinjalali left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks a bunch @ogrisel

@jeremiedbb
jeremiedbb merged commit 82e2f54 into scikit-learn:master Nov 8, 2019
@jeremiedbb

Copy link
Copy Markdown
Member

thanks @ogrisel !

@ogrisel
ogrisel deleted the no-cythonize-sdist branch November 8, 2019 12:21
@jeremiedbb

Copy link
Copy Markdown
Member

Just realized: should we add a what's new entry to mention that now cython is required when building from source distribution ?

@adrinjalali

Copy link
Copy Markdown
Member

Not sure about a whats_new entry. I'm happy with or without.

@thomasjpfan

Copy link
Copy Markdown
Member

We are basing our minimum Cython version on the newest version on conda supporting Python 3.5. Can we try to keep the Cython version up to date with the latest Cython release?

@adrinjalali

Copy link
Copy Markdown
Member

Sounds like a good idea to me. We're only doing that to have a passing CI, as long as the CI passes, I'm happy to have the latest possible Cython.

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.

4 participants