`pdm install` does not install all files included in sdist with `pdm build`
- [x] I have searched the issue tracker and believe that this is not a duplicate.
Steps to reproduce
- Create a new PDM project with the
pdm-backend - Remove the
src/directory and add a Python script to the top-level, e.g.foobar.py - Run
pdm install - Activate the environment and run
python -m foobarin another directory (such that Python doesn't findfoobar.pyin the current directory) and note how it is not able to find thefoobarmodule - Run
pdm buildandtar -tf dist/yourpackage-0.1.0.tar.gzto 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 and pdm build.
Environment Information
# Paste the output of `pdm info && pdm info --env` below:
PDM version:
2.15.4
Python Interpreter:
/home/coder/git/jfrog/jfrog-scripts/.venv/bin/python (3.10)
Project Root:
/home/coder/git/jfrog/jfrog-scripts
Local Packages:
{
"implementation_name": "cpython",
"implementation_version": "3.10.14",
"os_name": "posix",
"platform_machine": "x86_64",
"platform_release": "5.10.218-208.862.amzn2.x86_64",
"platform_system": "Linux",
"platform_version": "#1 SMP Tue Jun 4 16:52:10 UTC 2024",
"python_full_version": "3.10.14",
"platform_python_implementation": "CPython",
"python_version": "3.10",
"sys_platform": "linux"
}
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 the pyproject.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.
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.