-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
command/add: introduce --editable option #3940
Conversation
This change allows for vcs/path dependencies to be installed with `develop=true` configured.
@abn This is going to be very helpful. Could you explain, after merging this PR - What is the command I would need to type so that Specific topic with details: #3962 |
@gc-ss as described in the doc (see changed files), poetry add --editable /path/to/package |
Can't wait to use this! I am assuming this would work for git repos too? TO clarify, if I want to add a python package directly from git in editable/development mode, all I need to do is:
|
@gc-ss I haven't tried this myself, but I think you can give this a whirl by pipx-installing poetry; pipx install --suffix=@3940 'poetry @ git+https://github.com/python-poetry/poetry.git@refs/pull/3940/head'
poetry@3940 add --editable /path/to/package |
@abn if you already have the package installed, can you somehow make it into an editable one by doing something like |
Unfortunately for that you have to first run |
@abn there's something strange going on here... First I install package $ poetry@3940 add ../b/ --editable
Updating dependencies
Resolving dependencies... (0.9s)
Writing lock file
Package operations: 5 installs, 1 update, 0 removals
• Installing certifi (2020.12.5): Installing...
• Installing chardet (4.0.0): Installing...
• Installing idna (2.10): Installing...
• Installing urllib3 (1.26.4): Installing...
• Installing requests (2.25.1): Installing...
• Updating b (2.1.3.dev0+g77bcc5e.d20210417090856 -> 0.0.0 /home/fredrik/code/repos/b) Then I remove it: $ poetry@3940 remove b
Updating dependencies
Resolving dependencies... (0.1s)
Writing lock file
Package operations: 0 installs, 0 updates, 6 removals
• Removing b (0.0.0 /home/fredrik/code/repos/b)
• Removing certifi (2020.12.5)
• Removing chardet (4.0.0)
• Removing idna (2.10)
• Removing requests (2.25.1)
• Removing urllib3 (1.26.4) And finally, I'm attempting to install it without it being editable: $ poetry@3940 add ../b/
TypeError
expected string or bytes-like object
at ~/.local/pipx/venvs/poetry@3940/lib/python3.9/site-packages/poetry/core/utils/helpers.py:27 in canonicalize_name
23│ _canonicalize_regex = re.compile(r"[-_]+")
24│
25│
26│ def canonicalize_name(name: str) -> str:
→ 27│ return _canonicalize_regex.sub("-", name).lower()
28│
29│
30│ def module_name(name: str) -> str:
31│ return canonicalize_name(name).replace(".", "_").replace("-", "_") Not sure what is going on here. When I add in a EDIT: Oh okay so there was a lingering dist-info folder in my site-packages for |
Shouldn't be anything that changed here. Might be good to see the full traceback. |
On my machine, the following sequence leaves folders behind in site-packages: Install $ poetry@3940 add ../b/
Updating dependencies
Resolving dependencies... (0.1s)
Writing lock file
Package operations: 1 install, 0 updates, 0 removals
• Installing b (0.0.0 /home/fredrik/code/repos/b): Building... Then I wanted to see what happens if I try to add it again but with the $ poetry@3940 add --editable ../b/
Updating dependencies
Resolving dependencies... (0.1s)
Writing lock file
Package operations: 0 installs, 1 update, 0 removals
• Updating b (2.1.3.dev0+g77bcc5e.d20210417114942 /home/fredrik/code/repos/b -> 0.0.0 /home/fredrik/code/repos/b) Finally uninstalling $ poetry@3940 remove b
Updating dependencies
Resolving dependencies... (0.1s)
Writing lock file
Package operations: 0 installs, 0 updates, 1 removal
• Removing b (0.0.0 /home/fredrik/code/repos/b) But unfortunately, And now it seems the .venv is b0rked, as there is suddenly a $ poetry@3940 show
TypeError
expected string or bytes-like object
at ~/.local/pipx/venvs/poetry@3940/lib/python3.9/site-packages/poetry/core/utils/helpers.py:27 in canonicalize_name
23│ _canonicalize_regex = re.compile(r"[-_]+")
24│
25│
26│ def canonicalize_name(name: str) -> str:
→ 27│ return _canonicalize_regex.sub("-", name).lower()
28│
29│
30│ def module_name(name: str) -> str:
31│ return canonicalize_name(name).replace(".", "_").replace("-", "_") |
This might be related to #3900. The direct_url files are not being added to metadata. So package file discovery does not see them. Will fix it. |
@stephsamson @abn Thank you! This was what was holding me back from using Poetry. I'll dive in now. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This change allows for vcs/path dependencies to be installed with
develop=true
configured.Relates-to: #3931