On 28/10/23 03:21, '
pdx_s...@yahoo.com' via cython-users wrote:
> I have a
> pyproject.toml, a vestigial setup.py,
Why do you need setup.py at all?
> and a src/_custom_build.py.
This should not be necessary to build extension modules.
> But I'm probably not setting up the run time and optional dependencies
> correctly. I don't seem to be linking the build with binary extensions
> correctly to a python version.
I don't know what you mean with this statement. If the extension modules
you build do not work, evidently there is something wrong with how you
setup the build, but if you use a custom setuptools command to do the
build there is very little to suggest without debugging the
implementation of your custom build command, and this is something that
most do not have time for. It would be much easier if you were to use
the standard infrastructure.
> I have a dependency on an external C
> library -- is there a way to specify that dependency within the Python
> build environment?
What do you mean with "the Python build environment"? You use setuptools
to build your package. setuptools do not offer facilities to discover
which compilation flags you need to link to an external library on a
given platform.
> I would appreciate specific, substantive suggestions. I'm using
> setuptools because I think they're the most available / best supported.
setuptools is probably the most widely used build system for Python
packages. Among the ones available, it is one of the few that supports
building extension modules. However, it lacks advanced features like the
ability to discover the compilation flags necessary to link to an
external library.
> If you suggest alternate build tools, please explain why they're better
> (as opposed to developer taste) and how specifically to use them.
I think you are asking too much here. I can point you to other
solutions, but you would need to do some reading on your side to decide
which solution solves your use case in the way you like the most.
I'm biased, but as other have suggested, I think that meson and
meson-python, its integration with the Python package build framework,
strike a very nice balance between flexibility, features, and ease of
use. Most packages in the scientific Python stack switched or are
switching to meson-python as their build system (in fact the development
of meson-python was initially driven by the needs of scipy).
> Please help with the run time and optional dependencies,
This is a bit too vague of a formulation to be able to offer concrete
advice. It depends on what the run-time and optional dependencies are.
In the case of libraries, it depends on whether you expect the library
to be provided by the platform or if it should be part of your package.
> how to link
> builds with python versions,
I don't understand what you mean here. Any Python build tool should
produce extension modules that work with the Python version that a
specific build invocation is targeting (except for very fundamental
bugs, that is).
> and how to integrate with something like
> cibuildwheel to build for many versions.
cibuildwheel uses pip or build as Python package build front-ends. In
turn pip and build invoke the build back-end using a standard interface.
Therefore cibuildwheel works with any (PEP517 compliant) build back-end.
setuptools is one such back-end.
Cheers,
Dan