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

pip install of sdist with dev directory requirements #2174

Closed
3 tasks done
kapilt opened this issue Mar 11, 2020 · 3 comments
Closed
3 tasks done

pip install of sdist with dev directory requirements #2174

kapilt opened this issue Mar 11, 2020 · 3 comments
Labels
kind/bug Something isn't working as expected status/waiting-on-core Requires changes to poetry-core first

Comments

@kapilt
Copy link

kapilt commented Mar 11, 2020

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

@kapilt kapilt added the kind/bug Something isn't working as expected label Mar 11, 2020
@roxchkplusony
Copy link

I just ran into this. If you open the sdist tarball and remove the poetry.tool.dev-dependencies section, it'll work as expected. What's not expected is that there's no clear way to build these sdists without the dev dependencies getting in the way.

abn pushed a commit to python-poetry/poetry-core that referenced this issue Oct 22, 2020
This change allows for development dependencies to be ignored creating
`Poetry` instances. This is used when PEP 517 artifacts are built as 
they are not required in this scenario.

Relates-to: python-poetry/poetry#2174
@abn abn added the status/waiting-on-core Requires changes to poetry-core first label Oct 22, 2020
@neersighted
Copy link
Member

python-poetry/poetry-core#101 is released -- closing this.

Copy link

github-actions bot commented Mar 1, 2024

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected status/waiting-on-core Requires changes to poetry-core first
Projects
None yet
Development

No branches or pull requests

4 participants