Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Use of flit as a build-backend in pybuild

1 view
Skip to first unread message

Scott Kitterman

unread,
Nov 29, 2021, 2:40:03 PM11/29/21
to
The versions of pybuild in stable, testing, and unstable all support flit as a
build-backend for packages built upstream using flit. You can tell if your
package is built using flit if it has a pyproject.toml file and it contains a
paragraph like:

[build-system]
requires = ["flit_core >=3.2.0,<4"]
build-backend = "flit_core.buildapi"

Of the packages I've looked at, they either have no setup.py at all or a very
rudimentary generated setup.py. Although the generated setup.py will work,
it's only going to provide limited Python metadata for the package. Under the
hood, using flit provides a nicer package.

To use the flit backend for pybuild all you should need to do is add flit to
build-depends and drop whichever of python3-setuptools or python3-distutils
you are using now. Flit will be autodetected (and you will see it mentioned
in the build log).

Flit 3.0 is the lowest version in Debian, so if the requires version is 3.0 or
less, then an unversioned build-depends on flit is appropriate. For the
example above it would be:

flit >= 3.2.0

There is one issue at present, currently if upstream provides optional depends
in PEP 621 metadata (there is a [project.optional-dependencies] paragraph in
the pyproject.toml) these optional dependencies are added to the binary
depends through the python3:Depends expansion variable. I expect this to be
fixed in the next dh-python upload. In the meantime this can be disabled by:

override_dh_python3:
dh_python3 --no-guessing-deps

As I'm going through updating my packages, I'm finding flit use is much more
common than I was expecting. You may be able to use this more than you
thought. I certainly am.

Scott K
signature.asc

Stefano Rivera

unread,
Nov 29, 2021, 4:40:03 PM11/29/21
to
Hi Scott (2021.11.29_19:38:52_+0000)
> The versions of pybuild in stable, testing, and unstable all support flit as a
> build-backend for packages built upstream using flit.

While we're talking about this. Until recently, the flit plugin in
pybuild didn't have the test-runner support that was available when
using setuptools. That is now fixed, so if you were using a workaround
to run the test manually, you can probably drop it now (for bookworm).

SR

--
Stefano Rivera
http://tumbleweed.org.za/
+1 415 683 3272
0 new messages