cherab / solps

Other
6 stars 5 forks source link

Building on Python 3.10 #71

Open jacklovell opened 1 year ago

jacklovell commented 1 year ago

Cython 3.0a5, which is required to build cherab-solps 1.2.0, does not work with Python 3.10. Attempting to build on Python 3.10 with Cython 3.0a5 results in many lvalue required as decrement operand errors.

In fact, we specify Cython 3.0a5 for cherab-solps to work around 2 separate bugs: Cython 0.x doesn't support PEP 420 namespaces (see https://github.com/cython/cython/issues/2918) so we need to use Cython 3.0, but building Raysect (a Cherab dependency) with anything above 3.0a5 also causes issues (see https://github.com/raysect/source/issues/373).

In fact we can build cherab-solps using a more recent alpha version of Cython, as long as raysect is built using 3.0a5 or below. It's fairly hard to arrive at this arrangement accidentally though, since cherab-solps wheels exist on all platforms for which raysect wheels already exist: if you're having to build cherab-solps then you're probably having to build raysect too. As such, setting the Cython version required for cherab-solps to one which also correctly builds raysect made sense, and didn't cause any problems until we started supporting Python 3.10 where there isn't a single verion of Cython which can build both packages.

Raysect 0.8.0 and later resolve this problem as there is a proper pyproject.toml describing the build dependencies, so it can be built in isolation using a suitable version of Cython. For cherab-solps versions which require raysect 0.8.0 or later we'll just specify the latest Cython 3.x package as a build dependency. But we can't do this for raysect 0.7.1 as it doesn't have a pyproject.toml.

In summary: