package.to is not respected when adding editable (develop=true) dependency
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
Have similar problem.
If I install package as dependency then it is installed in directory spesified by package.to,
but if I install it as main package by poetry install - it's installed in site-packages/[package-name], but expected directory is - site-packages/[package.to]/[package-name]
@akayunov
thanks for confirming, my use case actually must be a dependency, e.g. when developing a library and another project using it. which I think is a very reasonable use case. also can help when developing a package and one of its dependencies seamlessly.