happy-kitchen-89482
09/20/2021, 10:24 PMnumpy
in the example in that ticket (because numpy builds fortran extensions for you)build_dependencies
field that is a SpecialCasedDependencies
then that is nice and uniform - you specify build deps as targetsbuild_dependencies
to be not just python requirements, but any code we can install into a virtualenv, opening the door to having custom build tools (in the PEP 518 sense) in the repo.build_system_requirements
field that we treat as opaque and copy into a generated pyproject.toml
[build-system].requires
pyproject.toml
with the build requirementsenough-analyst-54434
09/20/2021, 10:31 PMhappy-kitchen-89482
09/20/2021, 10:33 PMenough-analyst-54434
09/20/2021, 10:33 PMhappy-kitchen-89482
09/20/2021, 10:34 PMenough-analyst-54434
09/20/2021, 10:35 PMhappy-kitchen-89482
09/20/2021, 10:35 PMsetup.py
, setup.cfg
, pyproject.toml
throw them in a virtualenv and let God sort them out...enough-analyst-54434
09/20/2021, 10:35 PMhappy-kitchen-89482
09/20/2021, 10:36 PMenough-analyst-54434
09/20/2021, 10:36 PMhappy-kitchen-89482
09/20/2021, 10:36 PMenough-analyst-54434
09/20/2021, 10:36 PMhappy-kitchen-89482
09/20/2021, 10:37 PMenough-analyst-54434
09/20/2021, 10:37 PMhappy-kitchen-89482
09/20/2021, 10:54 PMhundreds-father-404
09/20/2021, 10:58 PMhappy-kitchen-89482
09/20/2021, 11:00 PMwitty-crayon-22786
09/20/2021, 11:03 PMBut then project introspection goals will see those as dependencies of the python_distribution, which is not the right way to look at themi’m less sure about this: it depends why you are using project introspection, but a lot of folks use it in concert with
--changed-since
to implement CI. for that usecase, you do want these deps.enough-analyst-54434
09/20/2021, 11:03 PMwitty-crayon-22786
09/20/2021, 11:05 PMhappy-kitchen-89482
09/20/2021, 11:06 PMsetup_py_commands
in the python_distribution
target) although maybe that's fineenough-analyst-54434
09/20/2021, 11:10 PMpip wheel
- but hang on a sec for something more minimalhappy-kitchen-89482
09/20/2021, 11:12 PMenough-analyst-54434
09/20/2021, 11:14 PM$ python -mvenv /tmp/build.test.venv
$ source /tmp/build.test.venv/bin/activate
$ pip install build
$ cat <<EOF > pyproject.toml
[build-system]
requires = ["setuptools", "wheel", "requests"]
build-backend = "setuptools.build_meta"
EOF
$ cat <<EOF > setup.py
import requests
import wheel
from setuptools import setup
setup(name="foo", version="0.1.0")
EOF
Run experiment:
$ python -mbuild .
* Creating venv isolated environment...
* Installing packages in isolated environment... (requests, setuptools, wheel)
* Getting dependencies for sdist...
running egg_info
creating foo.egg-info
writing foo.egg-info/PKG-INFO
writing dependency_links to foo.egg-info/dependency_links.txt
writing top-level names to foo.egg-info/top_level.txt
writing manifest file 'foo.egg-info/SOURCES.txt'
reading manifest file 'foo.egg-info/SOURCES.txt'
writing manifest file 'foo.egg-info/SOURCES.txt'
* Building sdist...
running sdist
...
writing manifest file 'foo.egg-info/SOURCES.txt'
* Installing packages in isolated environment... (wheel)
* Building wheel...
running bdist_wheel
...
adding 'foo-0.1.0.dist-info/RECORD'
removing build/bdist.linux-x86_64/wheel
Successfully built foo-0.1.0.tar.gz and foo-0.1.0-py3-none-any.whl
build
is from PyPA.$ python -mbuild -h
usage: python -m build [-h] [--version] [--sdist] [--wheel] [--outdir OUTDIR] [--skip-dependency-check] [--no-isolation] [--config-setting CONFIG_SETTING] [srcdir]
A simple, correct PEP 517 package builder.
By default, a source distribution (sdist) is built from {srcdir}
and a binary distribution (wheel) is built from the sdist.
This is recommended as it will ensure the sdist can be used
to build wheels.
Pass -s/--sdist and/or -w/--wheel to build a specific distribution.
If you do this, the default behavior will be disabled, and all
artifacts will be built from {srcdir} (even if you combine
-w/--wheel with -s/--sdist, the wheel will be built from {srcdir}).
positional arguments:
srcdir source directory (defaults to current directory)
optional arguments:
-h, --help show this help message and exit
--version, -V show program's version number and exit
--sdist, -s build a source distribution (disables the default behavior)
--wheel, -w build a wheel (disables the default behavior)
--outdir OUTDIR, -o OUTDIR
output directory (defaults to {srcdir}/dist)
--skip-dependency-check, -x
do not check that build dependencies are installed
--no-isolation, -n do not isolate the build in a virtual environment
--config-setting CONFIG_SETTING, -C CONFIG_SETTING
pass options to the backend. options which begin with a hyphen must be in the form of "--config-setting=--opt(=value)" or "-C--opt(=value)"
setup_py_commands
but that's part of what you buy with a decision to force PEP-517/518 for builds. You leave the distutils commands infra behind.happy-kitchen-89482
09/20/2021, 11:19 PMbuild
seems like the answercurved-television-6568
09/21/2021, 4:58 AM