Closed NiklasRosenstein closed 1 month ago
What is unexpected? From my testing pdm install
correctly adds the project root to the path.
pdm-backend(yeah it is not even related to PDM) has a default behavior to include source files, if that is unexpected, you can use includes
and excludes
under tool.pdm.build
table to customize it.
@NiklasRosenstein Maybe you want to handle it like described in the monorepo documentation? When you adjust the dev dependency to your script(s), they get installed as an editable dependency into your venv (you can change the sources without the need to re-install). But that would be picked up by pdm install
(if that's your goal).
Try this again because pdm-backend
has an update recently
Indeed this works now @frostming, thanks!
I will consider your suggestion though @o-moe, thanks as well.
Steps to reproduce
pdm-backend
src/
directory and add a Python script to the top-level, e.g.foobar.py
pdm install
python -m foobar
in another directory (such that Python doesn't findfoobar.py
in the current directory) and note how it is not able to find thefoobar
modulepdm build
andtar -tf dist/yourpackage-0.1.0.tar.gz
to find that it containsfoobar.py
Expected behavior
I would expect that
foobar.py
gets linked into the the virtual environment because it is also included in the source distribution.That being said, I'm not 100% sure about the exact process that PDM uses to find which Python source files make up the distribution and I have struggled to find this in the docs. It might be worthwhile to document the behaviour and double down to ensure this behaviour is consistent across
pdm install
andpdm build
.Environment Information
Additional notes
The behaviour I'm looking for is actually to have a PDM project that doesn't really require a distribution, but I want to be able to use
pdm install
to install Python files from the top-level of the project (i.e. next to thepyproject.toml
) in subdirectories. The idea here is to create a simple layout for a repository that contains one-off scripts that can do a bit of importing from each other.