Relative path imports are resolved relative to CWD instead of pyproject.toml
See original GitHub issue- I am on the latest Poetry version.
- I have searched the issues of this repo and believe that this is not a duplicate.
- If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option).
- OS version and name: circleci/python3.7.4-stretch, osx
- Poetry version:1.0.0
- Link of a Gist with the contents of your pyproject.toml file: https://gist.github.com/swist/89660bf70dbed6d0622bba7db381ae9c
Issue
I have 3 projects in a monorepo situation
One has a pyproject.toml
in kafkaesque/pyproject.toml
It depends on another poetry package defined in config/pyproject.toml
Then there’s another project that installs from kafkaesque and config into pyproject.toml
like so:
config/pyproject.toml
kafkaesque/pyproject.toml
pyproject.toml
I get the following error:
[EnvCommandError]
Command ['/Users/swistak/Library/Caches/pypoetry/virtualenvs/marmot-api-SV6HPF22-py3.7/bin/pip', 'install', '--no-deps', '-U', '/Users/swistak/code/marmot/api/kafkaesque'] errored with the following return code 1, and output:
Processing ./kafkaesque
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'error'
Complete output from command /Users/swistak/Library/Caches/pypoetry/virtualenvs/marmot-api-SV6HPF22-py3.7/bin/python /Users/swistak/Library/Caches/pypoetry/virtualenvs/marmot-api-SV6HPF22-py3.7/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /var/folders/93/78_vw68j75j3xf_z25p29_b80000gn/T/tmpmcyd92s5:
Traceback (most recent call last):
File "/Users/swistak/Library/Caches/pypoetry/virtualenvs/marmot-api-SV6HPF22-py3.7/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 207, in <module>
main()
File "/Users/swistak/Library/Caches/pypoetry/virtualenvs/marmot-api-SV6HPF22-py3.7/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 197, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/Users/swistak/Library/Caches/pypoetry/virtualenvs/marmot-api-SV6HPF22-py3.7/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 54, in get_requires_for_build_wheel
return hook(config_settings)
File "/private/var/folders/93/78_vw68j75j3xf_z25p29_b80000gn/T/pip-build-env-go6yfl9w/overlay/lib/python3.7/site-packages/poetry/masonry/api.py", line 25, in get_requires_for_build_wheel
poetry = Factory().create_poetry(Path("."))
File "/private/var/folders/93/78_vw68j75j3xf_z25p29_b80000gn/T/pip-build-env-go6yfl9w/overlay/lib/python3.7/site-packages/poetry/factory.py", line 99, in create_poetry
package.add_dependency(name, constraint)
File "/private/var/folders/93/78_vw68j75j3xf_z25p29_b80000gn/T/pip-build-env-go6yfl9w/overlay/lib/python3.7/site-packages/poetry/packages/package.py", line 331, in add_dependency
develop=constraint.get("develop", True),
File "/private/var/folders/93/78_vw68j75j3xf_z25p29_b80000gn/T/pip-build-env-go6yfl9w/overlay/lib/python3.7/site-packages/poetry/packages/directory_dependency.py", line 36, in __init__
raise ValueError("Directory {} does not exist".format(self._path))
ValueError: Directory ../config does not exist
Note that both kafkaesque/pyproject.toml
and pyproject.toml
both depend on config/pyproject.toml
albeit with a different path in their respective project files
Issue Analytics
- State:
- Created 4 years ago
- Reactions:6
- Comments:17 (7 by maintainers)
Top Results From Across the Web
How to refer to relative paths of resources when working with ...
In Python, paths are relative to the current working directory, which in most cases is the directory from which you run your program....
Read more >Configuration - Sphinx documentation
Relative paths are taken as relative to the configuration directory. They are copied to the output directory. They will overwrite any existing file...
Read more >Code - Hatch
path (required), A relative path to a Python file or extension module that will be loaded ; expression, A Python expression that when...
Read more >PEP 517 Backend bootstrapping - Discussions on Python.org
I propose that we add some mechanism in pyproject.toml for a project to specify that it wants to use a pre-built PEP 517...
Read more >Flit Documentation
Flit looks for the source of the package by its import name. ... Must be relative paths from the directory containing pyproject.toml.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Even though this issue is closed, this is still a bug in poetry 1.1.5.
If you have a monorepo with 3 projects where
pyproject.toml
of project A hasB = { path = "../B" }
pyproject.toml
of project B hasC = { path = "../C" }
Then running
poetry update
on project A causes:ValueError: Directory ../C does not exist
Hello @yanbussieres,
since poetry 1.1 path dependencies are no longer installed in editable mode by default. You will need to add a
develop=true
to your dependency definitions in thepyproject.toml
, e.g.dep1 = {path = "../dep1", develop=true}
.fin swimmer