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

Automatic detection of implicit namespace packages (PEP420) following src/ layout #1894

Open
karlicoss opened this issue Jan 25, 2025 · 0 comments

Comments

@karlicoss
Copy link

karlicoss commented Jan 25, 2025

Many of my packages are implicit namespace packages, so I don't have __init__.py at all.

Seems like currently according to docs, hatch requires either __init__.py or <NAME>.py.

However from modern python's perspective, src/<NAME>/... is a perfectly good python package!

Setuptools is able to build such a package without any extra configuration (at least when using pyproject.toml)

Hatch results in

ValueError: Unable to determine which files to ship inside the wheel using the following heuristics:
      https://hatch.pypa.io/latest/plugins/builder/wheel/#default-file-selection

      The most likely cause of this is that there is no directory that matches the name of your project

, unless we specify (as this message helpfully suggests)

      [tool.hatch.build.targets.wheel]
      packages = ["src/foo"]

This works, but it's an extra section of config where project name needs to be duplicated.
I wonder if it's possible to detect package in src/<NAME> automatically?

Setuptools can do that, is there a good reason hatch can't? :) Thanks!

Related issues: #587 #1646

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

1 participant