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

Extras in dev dependencies never installs? #6177

Closed
3 tasks done
adam2392 opened this issue Aug 16, 2022 · 8 comments
Closed
3 tasks done

Extras in dev dependencies never installs? #6177

adam2392 opened this issue Aug 16, 2022 · 8 comments
Labels
kind/bug Something isn't working as expected

Comments

@adam2392
Copy link

adam2392 commented Aug 16, 2022

  • 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: Mac OS 12.5 Monterey
  • Poetry version: 1.1.14
  • Link of a Gist with the contents of your pyproject.toml file:

Issue

I am trying to install different sets of dev dependencies to limit the stuff our CI needs to install. E.g. there is a testing job, building documentation job, and checking style job. Right now, I have an "extras" dependency for "docs", as done in https://python-poetry.org/docs/pyproject/#extras. However, no matter what I run, for example, matplotlib is never installed.

I run

poetry install --extras docs
poetry install --extras "docs"

When I show the versions: poetry show, matplotlib and the "docs" dependencies are always "red". Not sure what the color coding means either, but I presume this means its not installed. So I'm not sure what's going on here. When I run the following:

poetry run python -c "import matplotlib.pyplot as plt; plt.figure()"

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'matplotlib'

Here is the contents of my pyproject.toml.

[tool.poetry.dependencies]
python = ">=3.8,<3.11"
beartype = "^0.10.4"
numpy = "^1.23.0"
scipy = "^1.9.0"
networkx = "^2.8.3"
scikit-learn = "^1.1.0"
importlib-resources = { version = "*", python = "<3.9" }

[tool.poetry.dev-dependencies]
pytest = "^7.1.2"
pytest-cov = "^3.0.0"
mypy = "^0.971"
poethepoet = "^0.16.0"
black = "^22.6.0"
isort = "^5.10.1"
pylint = "^2.14.5"
flake8 = "^5.0.4"
bandit = "^1.7.4"
portray = "^1.7.0"
semversioner = "^1.1.0"
pydocstyle = "^6.1.1"
codespell = "^2.1.0"
matplotlib = {version = "^3.5",  optional = true }
memory_profiler = { version = "^0.60.0", optional = true }
numpydoc = { version = "^1.4", optional = true }
pydata-sphinx-theme = { version = "^0.9.0", optional = true }
sphinx = { version = "^5.1.1", optional = true }
sphinxcontrib-bibtex = { version = "^2.4.2", optional = true }
sphinx-issues = { version = "^3.0.1", optional = true }
sphinx-copybutton = { version = "^0.5.0", optional = true }
sphinx-gallery = { version = "^0.11.0", optional = true }
sphinx_rtd_theme = { version = "^1.0.0", optional = true }
pandas = { version = "^1.1", optional = true }
graphviz = { version = "^0.20.1", optional = true }
dowhy = { version = "^0.8", optional = true }
mysqlclient = { version = "^1.3", optional = true }

[tool.poetry.extras]
mysql = ["mysqlclient"]
docs = [
    "sphinx",
    "memory_profiler",
    "pydata-sphinx-theme",
    "sphinxcontrib-bibtex",
    "sphinx-issues",
    "sphinx-copybutton",
    "sphinx-gallery",
    "sphinx_rtd_theme",
    "numpydoc",
    "pandas",
    "matplotlib",
    "graphviz",
    "dowhy",
]
@adam2392 adam2392 added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Aug 16, 2022
@dimbleby
Copy link
Contributor

just make it not a dev dependency?

@adam2392
Copy link
Author

adam2392 commented Aug 16, 2022

But matplotlib is a dev dependency in this setting. It is only required in the building the documentation (via sphinx)

@dimbleby
Copy link
Contributor

and it being both optional and in the "docs" extra is sufficient to express that, you don't also need to make it a dev dependency.

poetry 1.2's groups offer a different way to arrange such things which you might find more intuitive, meantime just make this not a dev dependency.

@adam2392
Copy link
Author

Hmm okay that is somewhat confusing, but it might be my inexperience w/ poetry. Few questions if you're able to answer:

  1. Is 1.2 going to be released soon?
  2. Also just to confirm, are you referring to this new feature here: https://python-poetry.org/docs/master/pyproject/#dependencies-and-dependency-groups?

@dimbleby
Copy link
Contributor

  1. I don't know, but release: bump to version 1.2.0rc1 #6175 looks like progress
  2. yes

@adam2392
Copy link
Author

Thanks!

@dimbleby
Copy link
Contributor

please close the issue then, thanks

@mkniewallner mkniewallner removed the status/triage This issue needs to be triaged label Aug 19, 2022
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
Projects
None yet
Development

No branches or pull requests

3 participants