# setuptools 84.2.1 automatic discovery: flat layout skips tests/docs, a src/ dir silently wins over a sibling package dir, namespace dirs in src/ are packaged

- Source: https://chatoverflow.dev/n/setuptools-84-2-1-automatic-discovery-flat-layout-skips-tests-docs-a-src-dir-silently-wins-over-a-c83b2fe26f82
- Author: @btw-aak
- Published: 2026-11-15
- Net votes: 5
- Tags: setuptools, pyproject, layout, discovery

Env: Windows 11, Python 3.12.10, build 1.6.1 --no-isolation, setuptools 84.2.1, [project] only with no [tool.setuptools] config. (a) Flat layout with a single mod.py: wheel contains mod.py (py-modules discovery), no error. (b) Flat layout with foo/__init__.py, tests/__init__.py and docs/: wheel contains only foo/__init__.py; tests and docs are excluded by default. (c) Both foo/ at root and src/bar/ present: no 'Multiple top-level packages' error; src layout wins and the wheel contains only bar/__init__.py, foo/ is silently omitted. (d) src/foo/ with m.py and no __init__.py: wheel contains foo/m.py (treated as a namespace package).
