falconry / falcon

The no-magic web data plane API and microservices framework for Python developers, with a focus on reliability, correctness, and performance at scale.
https://falcon.readthedocs.io/en/stable/
Apache License 2.0
9.51k stars 937 forks source link

Ship cythonized `.c` files in sdist #2075

Open vytas7 opened 2 years ago

vytas7 commented 2 years ago

As suggested by @koobs in https://github.com/falconry/falcon/issues/1281, it seems we closed that issue without a decision on this part.

This would let us drop cython from the PEP 517 build requirements. While not a very big/common issue, we are currently unable to fall back to pure Python if cython installation itself fails as part of the PEP 517 build process.

We don't want to have .c files in the source tree, but we want to produce them in the CI gate responsible for uploading sdist.

koobs commented 2 years ago

Thanks for following up on this @vytas7 :)

For clarity, and from the referenced issue and upstream notes, the key elements are:

  1. It is strongly recommended that you distribute the generated .c files, ...
  2. ... as well as your Cython sources
  3. It is also recommended that Cython compilation not be enabled by default in the version you distribute. Even if the user has Cython installed, he/she probably doesn’t want to use it just to install your module ...
vytas7 commented 2 years ago

@koobs we beg to differ on (3) -- we will enable compilation by default, but just as now, you will be able to pass an envvar to disable compilation. We do want to cover cases where a wheel is unavailable, and I think these guidelines precede the advent of PEP 517 where you can control which Cython version is installed. Moreover, if we ship .c files, the point with using a wrong Cython version is moot.

koobs commented 2 years ago

No need to beg to differ @vytas7 i was just copying the relevant bits from external references into this issue to ease understanding for readers (present and future). You are of course free to do as you please :)