hatch: Running hatch build doesn't produce any executables, only wheel and stdist.

Good day, after following instructions in https://hatch.pypa.io/latest/plugins/builder/app/, which note that one must have Rust installed and having installed Rust, the hatch build command doesn’t produce anything binary.

  • I’ve created a new hatch project called test_rust_build,
  • put main.py with print(“helloworld”),
  • run hatch run python -m test_rust_build,
  • saw >helloworld.

And yet there is no binary! Only classical wheel and source dist.

Now I’m at a loss. I’m running Hatch, version 1.9.4 and from lack of anything else to to, I must ask for help here.

Addendum After writing this, I got inspired to ask for help

P:\Python\test-rust-build>hatch build --help
Usage: hatch build [OPTIONS] [LOCATION]

  Build a project.

Options:
  -t, --target TEXT    The target to build, overriding project defaults. This may be selected multiple times e.g. `-t
                       sdist -t wheel`
  --hooks-only         Whether or not to only execute build hooks [env var: `HATCH_BUILD_HOOKS_ONLY`]
  --no-hooks           Whether or not to disable build hooks [env var: `HATCH_BUILD_NO_HOOKS`]
  --ext                Whether or not to only execute build hooks for distributing binary Python packages, such as
                       compiling extensions. Equivalent to `--hooks-only -t wheel`
  -c, --clean          Whether or not existing artifacts should first be removed [env var: `HATCH_BUILD_CLEAN`]
  --clean-hooks-after  Whether or not build hook artifacts should be removed after each build [env var:
                       `HATCH_BUILD_CLEAN_HOOKS_AFTER`]
  -h, --help           Show this message and exit.

then run hatch build -t app and it started chugging and hooching!

Still, having read the documentation on building I have no idea how to tell hatch to assemble the binary using pyproject.toml. Mere adding [tool.hatch.build.app] what the docs suggest does nothing.

~P.S.~ PTSD: I have extreme difficulties understanding the docs, and started comprehending anything but the basics only after listening to a great podcast episode featuring @ofek a while ago.

About this issue

  • Original URL
  • State: open
  • Created 3 months ago
  • Comments: 15

Most upvoted comments

Please provide a repository so that I may reproduce.

The issue is that your test project is not on PyPI and therefore fails because by default it builds for releases. You would have to manually configure development builds by embedding a wheel or source distribution: https://ofek.dev/pyapp/latest/config/#project-embedding