vivarium-collective / vivarium-core

Core Interface and Engine for Vivarium
https://vivarium-core.readthedocs.io/
Apache License 2.0
25 stars 2 forks source link

replace all uses of distutils #136

Open 1fish2 opened 2 years ago

1fish2 commented 2 years ago

Python 3.10 deprecates distutils. It'll be removed in Python 3.12.

So with the move to support Python 3.10 in #135 , we should replace distutils in all vivarium projects. setuptools embeds a forked (and updated?) copy of distutils but there are compatibility issues and it's moving away from being a CLI tool to being just a library. setup.py is not dead but apparently we should not run it directly. It's a mess.

(Presumably wcEcoli will stay on Python 3.8.7 and distutils. I did try updating it to setuptools but reverted that due to https://github.com/CovertLab/wcEcoli/issues/1113.)

PEP 517 defines how to describe a project in a small, declarative pyproject.toml file.

Modern tools to consider:

Some of these tools can also obviate the Makefile.

eli-schwartz commented 2 years ago

All the tools on your list are distutils/setuptools alternatives, except for:

flit's design goal is to only support the simple cases of pure python and it philosophically rejects all forms of code building, including e.g. embedding version numbers into module/_version.py.

poetry doesn't officially support compiled extensions. It has an undocumented feature to do so, but it involves importing setuptools and using setuptools Extension objects, which then get injected back into poetry. Using it means that poetry builds wheels by generating a setup.py file and running python setup.py build which... you are not supposed to do. :D

bento is dead since 2014, and got mentioned in the SciPy blog post (they used to have bento as an alternative build system): https://labs.quansight.org/blog/2021/07/moving-scipy-to-meson/

  • Meson is a build tool like pyinvoke and Ruby rake, not a packaging tool

In case it wasn't already obvious, I am biased in favor of Meson. :D

Speaking of "a packaging tool"... As a build tool, it is less like pyinvoke and more like cmake, autotools, etc. And its core features include installing the results (to the python site-packages directory). For creating wheels specifically, you can use e.g. https://thiblahute.gitlab.io/mesonpep517/ to add wheel metadata on top of Meson, and make it pip-installable. In the long term, Meson does intend to support a builtin PEP 517 packaging backend, but we are not there yet.