Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDM plugins installed from project-root cannot be loaded, if they have dependencies #3067

Closed
1 task done
carstencodes opened this issue Jul 31, 2024 · 0 comments · Fixed by #3069
Closed
1 task done
Assignees
Labels
🐛 bug Something isn't working

Comments

@carstencodes
Copy link

carstencodes commented Jul 31, 2024

  • I have searched the issue tracker and believe that this is not a duplicate.

My plugin is used within its own CI-pipeline, so I added the following lines to my pyproject.toml:

[tool.pdm]
plugins = [
    "-e file:///${PROJECT_ROOT}",
]

With PDM < 2.16, my CI Pipeline was able to run:

$ pdm bump dev

Now, the following happens:

$ pdm -v bump dev
ERROR: Failed to load plugin pdm-bump=pdm_bump:main: No module named 'pdm_pfsc'
Usage: pdm [-h] [-V] [-c CONFIG] [-v | -q] [--no-cache] [-I]
 [--pep582 [SHELL]] [-n]
 ...
pdm: error: Script unknown: bump

Steps to reproduce

  • Checkout pdm-bump repository in an isolated environment, e.g. docker or a clean VM or without any local PIP modules
  • Run pdm install -G:all
  • Run pdm install --plugins
  • Run pdm bump

Actual behavior

The dependent libraries, installed in the (local) venv are not loaded.

HINT: The local pth file in .pdm-plugins only points to the src folder.

Expected behavior

The dependent libraries, installed in the (local) venv are loaded. This could be achieved by letting the pth file for the plugin also point to the venv.

Local fix:

Add $(pwd)/.venv/lib/python3.12/site-packages/ to $(pwd)/.pdm-plugins/python3.12/site-packages/local.pth

Environment Information

# Paste the output of `pdm info && pdm info --env` below:
$ pdm info
ERROR: Failed to load plugin pdm-bump=pdm_bump:main: No module named 'pdm_pfsc'
PDM version:
  2.17.1
Python Interpreter:
  /home/carsten/dev/python/pdm/plugins/pdm-bump/.venv/bin/python (3.12)
Project Root:
  /home/carsten/dev/python/pdm/plugins/pdm-bump
Local Packages:

$ pdm info --env  
ERROR: Failed to load plugin pdm-bump=pdm_bump:main: No module named 'pdm_pfsc'
{
  "implementation_name": "cpython",
  "implementation_version": "3.12.4",
  "os_name": "posix",
  "platform_machine": "x86_64",
  "platform_release": "6.8.0-39-generic",
  "platform_system": "Linux",
  "platform_version": "#39-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul  5 21:49:14 UTC 2024",
  "python_full_version": "3.12.4",
  "platform_python_implementation": "CPython",
  "python_version": "3.12",
  "sys_platform": "linux"
}
@carstencodes carstencodes added the 🐛 bug Something isn't working label Jul 31, 2024
@frostming frostming self-assigned this Aug 1, 2024
frostming added a commit that referenced this issue Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
2 participants