busy-piano-29318
05/08/2024, 7:01 AMpython_distribution in the BUILD file when building wheels.
I would like to use a pyproject.toml file as the source of metadata, that also defines the python source files. If I understand the flow correctly, the pants package command do the building in a sandbox and therefore need to know about the paths to use. I got the pyproject.toml right, and the Python files too, if I specify one of the targets. Is it possible to specify the top folder only?
Current setup, in a BUILD file at a subfolder (projects/my_fastapi_project/BUILD):
resource(name="pyproject", source="pyproject.toml")
python_distribution(
name="my-fastapi-project",
dependencies=[
":pyproject",
"bases/example/greet_api:greet_api",
],
provides=python_artifact(),
sdist = False,
generate_setup = False,
)
I would like to be able to set the "bases" part as something like bases or bases/* or even bases/example - but that causes failure in the package command. Posting my experimenting-repo in a thread (with the commits showing the steps I'm taking to learn Pants.busy-piano-29318
05/08/2024, 7:01 AMbusy-piano-29318
05/08/2024, 7:03 AM[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "my_fastapi_project"
version = "0.0.1"
description = 'A Python Polylith example code repo'
authors = [{ name = "David Vujic" }]
[tool.hatch.build.targets.wheel.force-include]
"../../bases/example/greet_api" = "example/greet_api"
"../../components/example/greeting" = "example/greeting"
"../../components/example/log" = "example/log"busy-piano-29318
05/08/2024, 7:04 AMcomponents when I only specified the bases folder in the python_distribution.busy-piano-29318
05/08/2024, 7:04 AMbases/example/greet_api:greet_api I get a failure.happy-kitchen-89482
05/09/2024, 1:46 PMbases/example/greet_api:greet_api is the entry point, and it transitively imports everything it depends on, then dependency inference should pull in all the deps you need. Pants will plop those into a sandbox, along with pyproject.toml, and then run setup.py (or an alternative pep517 build backend of your choice). So if the wrong thing is happening the first place to investigate is the sandbox.happy-kitchen-89482
05/09/2024, 1:46 PM--keep-sandboxes=alwayshappy-kitchen-89482
05/09/2024, 1:46 PMhappy-kitchen-89482
05/09/2024, 1:47 PMcomponents isn't in the sandbox, then I guess there is no import chain from bases to it, and you'll have to add it as an explicit dephappy-kitchen-89482
05/09/2024, 1:48 PMbusy-piano-29318
05/09/2024, 2:55 PMhappy-kitchen-89482
05/09/2024, 2:58 PM