Skip to content

pip install of sdist with dev directory requirements #2174

@kapilt

Description

@kapilt
  • 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).

Issue

When installing a source distro tarball via pip, poetry will be invoked per its specification in pyproject.toml as the project's build system, however it will also attempt to install/resolve dev dependencies as part of the local wheel build process, this is unexpected. ideally when called via masonry api from pip, it would skip dev dependencies entirely, unless their being explicitly requested say as per an optional.

Its problematic for our particular usage of poetry as we're using dev depedencies to specify source/directory dependencies within a monorepo, which we resolve to normal deps when publishing.

$ pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple c7n_azure                               
Looking in indexes: https://test.pypi.org/simple/, https://pypi.org/simple                                                                                                                     
Collecting c7n_azure                                                                                                                                                                           
  Downloading https://test-files.pythonhosted.org/packages/9d/5f/e8f30b02559450ac5e8c2493fd2505b01918d46de3ac6aa40569da964dd4/c7n-azure-0.6.4.tar.gz (100 kB)                             
     |████████████████████████████████| 100 kB 3.0 MB/s                                                                                                        
  Installing build dependencies ... done                                                                                                                                             
  Getting requirements to build wheel ... done                                                                                                                                                
    Preparing wheel metadata ... error                                                                                                                                                         
    ERROR: Command errored out with exit status 1:                                                                                                                                        
     command: /Users/kapilt/.pyenv/versions/3.8.0/envs/c7n-test-pypi/bin/python3.8 /Users/kapilt/.pyenv/versions/3.8.0/envs/c7n-test-pypi/lib/python3.8/site-packages/pip/_vendor/pep517/_in_pr
ocess.py prepare_metadata_for_build_wheel /var/folders/m0/9m4c62yx3sd12290vsfcc14m0000gn/T/tmpdiip_ma7                                                                                      
         cwd: /private/var/folders/m0/9m4c62yx3sd12290vsfcc14m0000gn/T/pip-install-2c09tud7/c7n-azure                                                                     
    Complete output (16 lines):                                                                                                                                                                
    Traceback (most recent call last):                                                                                                                                                         
      File "/Users/kapilt/.pyenv/versions/3.8.0/envs/c7n-test-pypi/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 257, in <module>                                       
        main()                                                                                                                                                                                 
      File "/Users/kapilt/.pyenv/versions/3.8.0/envs/c7n-test-pypi/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 240, in main                                           
        json_out['return_val'] = hook(**hook_input['kwargs'])                                                                                                                                  
      File "/Users/kapilt/.pyenv/versions/3.8.0/envs/c7n-test-pypi/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 110, in prepare_metadata_for_build_wheel               
        return hook(metadata_directory, config_settings)                                                                                                                                       
      File "/private/var/folders/m0/9m4c62yx3sd12290vsfcc14m0000gn/T/pip-build-env-dflq0sxz/overlay/lib/python3.8/site-packages/poetry/masonry/api.py", line 38, in prepare_metadata_for_build_
wheel
        poetry = Factory().create_poetry(Path("."))
      File "/private/var/folders/m0/9m4c62yx3sd12290vsfcc14m0000gn/T/pip-build-env-dflq0sxz/overlay/lib/python3.8/site-packages/poetry/factory.py", line 109, in create_poetry
        package.add_dependency(name, constraint, category="dev")
      File "/private/var/folders/m0/9m4c62yx3sd12290vsfcc14m0000gn/T/pip-build-env-dflq0sxz/overlay/lib/python3.8/site-packages/poetry/packages/package.py", line 327, in add_dependency
        dependency = DirectoryDependency(
      File "/private/var/folders/m0/9m4c62yx3sd12290vsfcc14m0000gn/T/pip-build-env-dflq0sxz/overlay/lib/python3.8/site-packages/poetry/packages/directory_dependency.py", line 51, in __init__
        raise ValueError(
    ValueError: Directory ../.. does not seem to be a Python package
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/kapilt/.pyenv/versions/3.8.0/envs/c7n-test-pypi/bin/python3.8 /Users/kapilt/.pyenv/versions/3.8.0/envs/c7n-test-pypi/lib/python3.8/site-p
ackages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /var/folders/m0/9m4c62yx3sd12290vsfcc14m0000gn/T/tmpdiip_ma7 Check the logs for full command output.

we're looking to currently work around by publishing wheel only artifacts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working as expectedstatus/waiting-on-coreRequires changes to poetry-core first

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions