#can you show the configuration?

1 messages · Page 1 of 1 (latest)

fallow oak
#
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build]
sources = ["src"]

[project]
name = "example-4a6eaaab-a"
version = "1.0.0"
dependencies = ["example-4a6eaaab-b>=1.0.0"]
requires-python = ">=3.7"
description = ""
weary grove
#

okay a few things

#

[tool.hatch.build] should be used very rarely, the new docs page about building discourages global config. it has caused so many issues in the past, I just implemented it originally because I thought it might be useful. bad idea

#

same result, but faster

fallow oak
#

hm yeah the sources config was leftover from me doing something really dumb, I can remove that

#

I'm building wheels and sdists, I found it confusing that the hatch makes me configure them both separately?

weary grove
#

I mean, they are separate artifacts

fallow oak
#

I guess but the files in my package don't tend to change between them

weary grove
fallow oak
#

Anyway, I'm doing

[tool.hatch.build.targets.wheel]
packages = ["src/{{ module-name }}"]

[tool.hatch.build.targets.sdist]
packages = ["src/{{ module-name }}"]
#

it's slightly faster

weary grove
#

do not do that for the source distribution!

fallow oak
#

Oh?

weary grove
#

[...] the shipped path will be collapsed to only include the final component.

fallow oak
#

I honestly don't know what that means haha

weary grove
#

for source distributions just use include/exclude/only-include

#

it means that your source distribution will have a top level module not the src

#

so then when a wheel gets built from the source distribution it will break

fallow oak
#

I see that's no good, a warning admonition there in the docs would be good

#

helpful*

#

We're still on the order of ~1s for packaging these three projects

#

I need to generate hundreds of wheels in my test suite

#

I'll look into some parallelism next

weary grove
#
[tool.hatch.build.targets.wheel]
packages = ["src/{{ module-name }}"]

[tool.hatch.build.targets.sdist]
only-include = ["src/{{ module-name }}"]
#

that should be your config

#

the next thing you can do is just install Hatchling, then do hatchling build

#

assuming you have no other build-time dependencies

#

i.e. all build environments require just Hatchling

fallow oak
#

Yeah there are no other build dependencies

weary grove
#

then that will be way faster yeah

fallow oak
#

Ooo yeah that's better now down to 0.3s

weary grove
#

if you are comfortable publishing your benchmarks somewhere I would gladly showcase that on the "Why Hatch?" page in the section comparing backends

fallow oak
#

I'd be happy to if I get to a point where it's worth sharing!

#

It might not be worth the hassle (for my use-case) to compare to other build backends at all

#

Since hatchling seems clearly fast

weary grove
#

I just compare to setuptools on that page for now, so if you have that really that's okay

fallow oak
#

I only hacked that in for a minute. I might need it later to test legacy packages and then I'll definitely reach out.

#

Thanks for your help though! With your changes and a couple thread pool executors, my test suite went from 80s to 2.5s!

weary grove
#

that's awesome! happy to help

#

what is this project btw?