> On 23 Mar 2021, at 19:13, Julian Smith <ju...@op59.net> wrote:
> 
> Approach 1 is to pass callbacks to distutils.core.setup() or
> setuptools.setup(). However there doesn't appear to be documentation in
> either of these modules about what such callbacks should do or how/when
> they are called. The only way to figure things out seems to be to look
> at the distutils or setuptools source, which i'm finding pretty opaque.

[snipped]

> As far as i can tell, callbacks are only given information about the
> original command line arguments rather than more abstract information
> such as where to put output files, so distutils and setuptools don't
> seem to be giving any added value here.

[snipped]

> Given how fundamental the pip tool is to Python packaging, i was hoping
> that the command-line arguments that pip passes to setup.py would be
> standardised and documented, but this doesn't seem to be the case.

What you get from pip is standardised and documented in PEP 517. The
part that’s not so is what happens *after* setup tools receives those
things, which is entirely setuptools internals.

[snipped]

> So as far as i can tell, there are two levels of abstraction at which
> on can implement customised Python packaging (the setuptools.setup()'s
> callbacks or the setup.py command line), but neither one seems to be
> documented or standardised.
> 
> Is that right? Or am i missing something fundamental here?

You’re basically correct, there are two abstractions in play. The first
(between pip and setuptools) is documented. The second (between
setuptools and the external command) is not, because that’s setuptools
internals and setuptools doesn’t really expect people to mess with
them. You still can if you want to, of course, but you’re on your own.

So my advice would be to ditch setup tools entirely and work directly with
the PEP 517 interface. You don’t need to start from scratch though; there
are several PEP 517 implementations other than setuptools, and some of
them already implemented some mechanisms to call external build commands,
such as enscons[1] (via SCons) and PDM[2] (via setuptools). Some other
projects also have already expressed interests supporting this, such as
Flit[3], and I think they’d be more than happy to discuss this if you
want to work this with them.

[1]: https://github.com/dholth/enscons
[2]: https://github.com/frostming/pdm
[3]: https://github.com/takluyver/flit

--
Tzu-ping Chung (@uranusjr)
uranu...@gmail.com
https://uranusjr.com

--
Distutils-SIG mailing list -- distutils-sig@python.org
To unsubscribe send an email to distutils-sig-le...@python.org
https://mail.python.org/mailman3/lists/distutils-sig.python.org/
Message archived at 
https://mail.python.org/archives/list/distutils-sig@python.org/message/BDGNJTUU7A36XZIRKE64LA73GJ6LWXFT/

Reply via email to