-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Installing local dependencies with develop = true causes unexpected behaviour which was not present in older versions #8597
Comments
* fix dependencies, pending on python-poetry/poetry#8597 * docker image working * improved docs + auto-push to dockerhub
the difference between
I doubt that any of this represents a bug, just quirks of how things work. |
Hi @dimbleby thanks for the quick response. Just a clarification on what you mentioned and why I still think this is a bug, or at least unintended behaviour.
I understand why
If I use |
poetry has a new installer since 1.2.2 - https://github.com/pypa/installer - it might very well behave differently than the old one but I am very not convinced that this is a bug. Even if it is you probably want to go that project with it. |
Hi @dimbleby, sorry if this was not clear, but I run This installs
This is the pip -e option documentation. With this clarified, don't you think that the previous example (behaviour of |
Then I don't reproduce, $ pip --version
pip 23.3.1 from /home/dch/.virtualenvs/foo/lib/python3.10/site-packages/pip (python 3.10)
$ (cd mymodule ; pip install -e .)
Obtaining file:///home/dch/example_local_python_module_poetry/mymodule
Installing build dependencies ... -^[[\^[[done
Checking if build backend supports build_editable ... done
Getting requirements to build editable ... done
Preparing editable metadata (pyproject.toml) ... done
Building wheels for collected packages: mymodule
Building editable for mymodule (pyproject.toml) ... done
Created wheel for mymodule: filename=mymodule-0.0.0-0.editable-py3-none-any.whl size=2462 sha256=7f3a82f1163ece52f9ab085b7af9fb84ec24974b919b55dcd0cfc7486ad4406e
Stored in directory: /tmp/pip-ephem-wheel-cache-5d3stkdu/wheels/ed/ff/fe/53c2d4c1bc0a2f162151c1faaa1708acc9cdd1e912e122883d
Successfully built mymodule
Installing collected packages: mymodule
Successfully installed mymodule-0.0.0
$ python -c 'from mymodule.mymodule.functions import print_hello; print_hello()'
hello |
Hi @dimbleby, it seems the behaviour of pip has changed. I was using pip 21.2.3 (🚨2 years old🚨) in my computer. I ran your small test on the new and old version of pip, and the new version of pip does not give an error indeed.
17c17
< pip install --upgrade pip
---
> pip install --upgrade pip==21.2.3 This was the only difference between the two actions. Not sure what to make of this, I would have not expected such a significant change in pip behaviour. I guess then poetry is mimicking pip behaviour and this can be closed. Thanks for taking the time to reproduce, and for maintaining poetry, which is really great. |
no worries, please close |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
-vvv
option) and have included the output below.Issue
First of all let me say that I love poetry, and that I recommend it to anyone working with python, so a big thanks for all the team for the great package manager.
This issue is related to discussion #5276 and issues #34, and #8513 but describes a different problem (I think). Tagging @neersighted since they closed #34 and @adam-grant-hendry since they created the discussion, and @francoisWeber since they created #8513.
In this repo I have a minimal example to highlight the problem, with a directory structure like below:
Where
mymodule
is a local python module. During development of an analysis pipeline, you may want to have code organised like this in a repository where you want to import common functions frommymodule
in scripts located in subfolders. I would expect that the way to import a function present inmymodule/mymodule/functions.py
from another script (./script.py
) would befrom mymodule.functions import print_hello
. poetry 1.6.1 gives an unexpected behaviour as described below, tested with github actions. The github action runs reproduce.sh, which:mymodule
dependency, installs it withpip install -e .
and runs script.py again.Installing module with poetry 1.6.1
from mymodule.functions import print_hello
works, but does not show the go-to-function in VSCode, as described in Local developping modules ill referenced by VSCode's "go to definition" #8513.from mymodule.mymodule.functions import print_hello
(mymodule twice) also works (I don't think it should, hence the bug🐛), and has go-to-function in VSCode.Installing module with
pip install -e .
or poetry 1.2.2from mymodule.functions import print_hello
works, and shows the go-to-function in VSCode (expected behaviour in Local developping modules ill referenced by VSCode's "go to definition" #8513).from mymodule.mymodule.functions import print_hello
does not work (expected behaviour).Conclusion
I think something must have changed to between poetry 1.2.2 and current version in how local dependencies are handled, that produces an unexpected behaviour and prevents VScode intellisense. Happy to help to fix this if given some guidance.
The text was updated successfully, but these errors were encountered: