Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is the canonical way to specify the packages to distribute? #1692

Open
laclouis5 opened this issue Aug 25, 2024 · 1 comment
Open

What is the canonical way to specify the packages to distribute? #1692

laclouis5 opened this issue Aug 25, 2024 · 1 comment

Comments

@laclouis5
Copy link

laclouis5 commented Aug 25, 2024

I'm quite confused by the Introduction Walkthrough. The hatch new "Hatch Demo" command used to showcase how to setup and build a project with hatch seems to setup a src-layout project which have this structure (presented in the tutorial):

hatch-demo
├── src
│   └── hatch_demo
│       ├── __about__.py
│       └── __init__.py
├── tests
│   └── __init__.py
├── LICENSE.txt
├── README.md
└── pyproject.toml

However, the generated pyproject.toml does not seem to take this src-layout into account: building this example project with the hatch build command generates a source distribution that contains the tests/ data and basically everything in the root directory.

I don't think that this default behavior is well understood and adequate. I think that at least the tutorial should be updated to better inform people of this choice. Anyway, I tried to find a workaround for this issue but the solutions are still unclear to me. Multiple solutions were discussed here and I ended up using this:

[tool.hatch.build.targets.sdist]
packages = ["src/hatch_demo"]

Is this workaround correct or is there a canonical way to specify where to find the packages to distribute in the configuration?

@timonviola
Copy link

I use this in my projects:

[tool.hatch.build.targets.sdist]
exclude = [
  "/.*",
  "/docs",
  "/tests"
]

[tool.hatch.build.targets.wheel]
packages = ["src/my-package"]

I hope it helps docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants