jazzband / pip-tools

A set of tools to keep your pinned Python dependencies fresh.
https://pip-tools.rtfd.io
BSD 3-Clause "New" or "Revised" License
7.77k stars 611 forks source link

Use src-layout instead of flat-layout #2091

Open chrysle opened 6 months ago

chrysle commented 6 months ago

Any reason why this project doesn't adhere to src-layout? One should still be able to invoke pip-tools through runpy afterwards.

webknjaz commented 6 months ago

Probably historic state of things. It doesn't matter, really. And I don't see any reason to change it.

chrysle commented 6 months ago

Hmm, it would help to prevent any accidental importing of the code when it should be installed (also when developing, for that we have tox devenv). Besides, I found this line, it seems to have been intended: https://github.com/jazzband/pip-tools/blob/347fec59b418b6239e47dee8429e8401ac4330e6/pyproject.toml#L118

macro1 commented 6 months ago

I wonder if that comment is wrong.. Explicitly setting includes is needed due to the distribution package name not matching the import package name isn't it?

edit: I see. src-layout is supported directly by "Automatic discovery" in setuptools. Interesting. https://setuptools.pypa.io/en/latest/userguide/package_discovery.html#auto-discovery

chrysle commented 6 months ago

I wonder if that comment is wrong..

I don't think custom discovery is needed, anyway, as setuptools will also try its best at detecting packages with flat-layout, and we don't have any that we would want to exclude.