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

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

Open
salembream opened this issue Nov 22, 2024 · 2 comments
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged

Comments

@salembream
Copy link

salembream commented Nov 22, 2024

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
@salembream salembream added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Nov 22, 2024
@akayunov
Copy link

akayunov commented Nov 29, 2024

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]

@salembream
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants