pdm-project / pdm

A modern Python package and dependency manager supporting the latest PEP standards
https://pdm-project.org
MIT License
7.76k stars 382 forks source link

`pdm install` does not install all files included in sdist with `pdm build` #2972

Closed NiklasRosenstein closed 1 month ago

NiklasRosenstein commented 2 months ago

Steps to reproduce

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.

frostming commented 2 months 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.

o-moe commented 2 months ago

@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).

frostming commented 2 months ago

Try this again because pdm-backend has an update recently

NiklasRosenstein commented 1 month ago

Indeed this works now @frostming, thanks!

I will consider your suggestion though @o-moe, thanks as well.