python-poetry / python-poetry/poetry

package.to is not respected when adding editable (develop=true) dependency

Open
#9,868 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

kind/bug status/triage
Dominant language
Python
Stars
34.3k
Forks
2.5k
Avg merge
2d 19h
Merged PRs (30d)
30

Description

Description

when adding a local dependency as editable the installation is not following the package.to option.

to reproduce the issue, please clone this repo:
https://github.com/salembream/editable_bug_poetry_

then test as below

cd check_packages

poetry install
poetry shell

python ./run_check.py

notice the non_editable package works fine, while the editable one fails.

Hello from non_editable_module
Traceback (most recent call last):
  File "D:\temp\testeditable\check_packages\run_check.py", line 5, in <module>
    from dist_name.editable.editable_module import editable_module
ModuleNotFoundError: No module named 'dist_name.editable'
Workarounds

not directly thru poetry, but I think we can have the required behavior by using symlinks when installing editable dependency which defines package.to

Poetry Installation Method

pipx

Operating System

Windows 11

Poetry Version

1.8.3

Poetry Configuration
experimental.system-git-client = false
installer.max-workers = null
installer.modern-installation = true
installer.no-binary = null
installer.parallel = true
keyring.enabled = true
solver.lazy-wheel = true
virtualenvs.create = true
virtualenvs.in-project = null
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.no-setuptools = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}\\virtualenvs"  # C:\Users\salem\AppData\Local\pypoetry\Cache\virtualenvs
virtualenvs.prefer-active-python = false
virtualenvs.prompt = "{project_name}-py{python_version}"
warnings.export = true
Python Sysconfig

No response

Example pyproject.toml
[tool.poetry]
packages = [{ include = "./**/*.py" }]
name = "check_packages"
version = "1"
description = "check_packages"
authors = ["author"]

[tool.poetry.dependencies]
python = "^3"
editable = { path = "../editable", develop = true }
non_editable = { path = "../non_editable" }

[build-system]
requires = ["poetry-core>=1.9.1"]
build-backend = "poetry.core.masonry.api"
Poetry Runtime Logs
N/A

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Clone the linked editable_bug_poetry_ repository and reproduce the issue with the documented poetry install, poetry shell, and run_check.py commands. Compare the editable and non-editable local dependency behavior, focusing on how package.to is handled during editable installation. Done means the editable dependency is importable from the package.to destination and run_check.py succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.