pypa / pypa/packaging.python.org

The packaging-projects tutorial does not work with hatch

Open
#1,316 15 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

component: tutorials type: question
Dominant language
Python
Stars
1.7k
Forks
1.7k
Avg merge
3d 12h
Merged PRs (30d)
4

Description

Hello,

I hope this is the right place :) after https://github.com/python/cpython/issues/111009
This tutorial
https://packaging.python.org/en/latest/tutorials/packaging-projects/
says:
"this tutorial uses Hatchling by default, but it will work identically with setuptools, Flit, PDM, and others that support the [project] table for metadata."

But it seems it was converted from a tutorial with setuptools.
Hatchling does not seem to work well when the source of the package is in a src/ folder.
My repository here
https://github.com/LLyaudet/django-monkey-patches
demonstrates the problem.
I had to switch from hatch to setuptools to have a wheel that is correct.
Otherwise code was installed in lib/python3.11/site-packages/src/django-monkey-patches instead of lib/python3.11/site-packages/django_monkey_patches.

Best regards,
Laurent Lyaudet

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the packaging-projects tutorial and reproduce the issue using the linked django-monkey-patches repository. Compare the Hatchling and setuptools configurations, then verify the built wheel installs the package as django_monkey_patches rather than under src/. Done means the tutorial works correctly with Hatchling or clearly documents the supported layout and configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system, documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.