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

Poetry ignores extras in dev-dependencies #759

Closed
3 tasks done
arxanas opened this issue Dec 23, 2018 · 3 comments
Closed
3 tasks done

Poetry ignores extras in dev-dependencies #759

arxanas opened this issue Dec 23, 2018 · 3 comments

Comments

@arxanas
Copy link

arxanas commented Dec 23, 2018

  • I am on the latest Poetry version.

    • Yes, Poetry 0.12.10
  • I have searched the issues of this repo and believe that this is not a duplicate.

    • I believe this is similar to dev-dependencies that are also extras #129 but not related. That one involves installing a package with different extras depending on the mode. This involves installing extras that only exist for dev-dependencies.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

    • No exception occurs.
  • OS: macOS 10.13.16 build 17G65

  • Poetry version: 0.12.10

  • Link of a Gist with the contents of your pyproject.toml file: same as below, see https://gist.github.com/arxanas/b18be992384c105b0163691c63549159

Issue

Expected behavior: having optional packages in dev-dependencies allows them to be installed with poetry install --extras.
Actual behavior: having optional packages in dev-dependencies does nothing when trying to invoke poetry install --extras.

I want to have extras that are installable as dev-dependencies. In particular, I would like to make it possible install the fuzzing system for my project. However, it depends on Cython, which is heavyweight, and not something I would like to be installed by default when setting up the development environment.

Therefore I created a pyproject.toml like this, with the optional dependencies cython and python-afl, and the fuzz extra that would install both:

[tool.poetry]
name = "poetrytest"
version = "0.1.0"
description = ""
authors = ["Waleed Khan <me@waleedkhan.name>"]

[tool.poetry.dependencies]
python = "^2.7"

[tool.poetry.dev-dependencies]
pytest = "^3.0"
python-afl = {version = "^0.7.1",optional = true}
cython = {version = "^0.29.2",optional = true}

[tool.poetry.extras]
fuzz = ["cython", "python-afl"]

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

But when I try to install the fuzz extra, no packages are installed:

$ poetry install --extras fuzz
Installing dependencies from lock file

Nothing to install or update

  - Installing poetrytest (0.1.0)

If I move the optional dependencies to dependencies instead of dev-dependencies like this:

[tool.poetry]
name = "poetrytest"
version = "0.1.0"
description = ""
authors = ["Waleed Khan <me@waleedkhan.name>"]

[tool.poetry.dependencies]
python = "^2.7"
python-afl = {version = "^0.7.1",optional = true}
cython = {version = "^0.29.2",optional = true}

[tool.poetry.dev-dependencies]
pytest = "^3.0"

[tool.poetry.extras]
fuzz = ["cython", "python-afl"]

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

Then it works:

$ poetry install --extras fuzz
Installing dependencies from lock file


Package operations: 2 installs, 0 updates, 0 removals

  - Installing cython (0.29.2)
  - Installing python-afl (0.7.1)
  - Installing poetrytest (0.1.0)

But this is a problem because my actual project does not have these dependencies, even as extras.

arxanas added a commit to arxanas/pytch that referenced this issue Dec 23, 2018
To install the dependencies for the fuzzer, run

    poetry install --extras fuzz

Then to run the fuzzer, run

    ./bin/fuzz.sh

Note that the fuzzer dependencies are currently extra dependencies for
the entire project, rather than just dev-dependencies. See
python-poetry/poetry#759.
@kepler
Copy link

kepler commented Jan 25, 2019

According to @sdispater, this is by design: #606 (comment). However, I have the same question as the subsequent comment there.

@rmorshea
Copy link
Contributor

rmorshea commented Apr 15, 2019

@sdispater should there be an extra section for [tool.poetry.dev-extras]?

A common use case for having dev-extras is bifurcated requirements for local development vs remote CI/CD pipelines. Given how slow dependency resolution is, being able to reduce the number of packages you install in your CI/CD pipeline can shave a lot of time off each build.

@nickpresta are you open to making a PR with this new section?

Copy link

github-actions bot commented Mar 3, 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 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants