How to use pyproject.toml with src-layout and __main__.py? #3872
Replies: 1 comment 1 reply
-
Hi @dragondive, please see my 3 comments below:
|
Beta Was this translation helpful? Give feedback.
-
Hi @dragondive, please see my 3 comments below:
|
Beta Was this translation helpful? Give feedback.
-
In the flat layout, I can create and execute a local module with (
python -m mypkg
) by including a__main__.py
insidemypkg
:Is it possible to achieve the same using the src-layout?
If I create the src-layout like this:
Then the module name becomes
src
and can be executed aspython -m src
, which is obviously not what I want. I could move the__main__.py
insidemypkg
:and in
pyproject.toml
:This "works", but it also creates (what looks to me as) another problem. It installs the following modules:
Notice there's some duplication(?) of installed modules, once under
mypkg
and once undersrc\mypkg
.Version information
OS: Windows 11
python: 3.11.1
pip: 22.3.1
Commands used
python -m venv venv_mypkg
python -m pip install .
Beta Was this translation helpful? Give feedback.
All reactions