python-poetry / poetry

Python packaging and dependency management made easy
https://python-poetry.org
MIT License
31.23k stars 2.26k forks source link

dev-dependencies extras doesn't get recognised for project #128

Closed digitalresistor closed 6 years ago

digitalresistor commented 6 years ago
[tool.poetry]
name = "pyramidtesting"
version = "0.1.0"
description = ""
authors = ["Your Name <you@example.com>"]

[tool.poetry.dependencies]
python = "*"
pyramid = "^1.9"

[tool.poetry.dev-dependencies]
pyramid = {version = "^1.9", extras = ["testing"]}

Will install the following:

Riley:pyramidtesting2 xistence$ poetry show
hupper              1.3   Integrated process monitor for developing and reloading daemons.
pastedeploy         1.5.2 Load, configure, and compose WSGI applications and servers
plaster             1.0   A loader interface around multiple config file formats.
plaster-pastedeploy 0.5   A loader implementing the PasteDeploy syntax to be used by plaster.
pyramid             1.9.2 The Pyramid Web Framework, a Pylons project
repoze.lru          0.7   A tiny LRU cache implementation and decorator
translationstring   1.3   Utility library for i18n relied on by various Repoze and Pyramid packages
venusian            1.1.0 A library for deferring decorator actions
webob               1.8.1 WSGI request and response object
zope.deprecation    4.3.0 Zope Deprecation Infrastructure
zope.interface      4.5.0 Interfaces for Python

But not any of the extras defined for testing in Pyramid.

sdispater commented 6 years ago

@bertjwregeer Thanks for reporting this. You might want to try the current prerelease (0.10.0a2).

With the new resolver, a lot of problems have been resolved. And this one is fixed, I just tested it and you get:

  - beautifulsoup4 (4.6.0)
  - coverage (4.5.1)
  - hupper (1.3)
  - nose (1.3.7)
  - pastedeploy (1.5.2)
  - plaster (1.0)
  - plaster-pastedeploy (0.5)
  - repoze.lru (0.7)
  - six (1.11.0)
  - translationstring (1.3)
  - venusian (1.1.0)
  - virtualenv (16.0.0)
  - waitress (1.1.0)
  - webob (1.8.1)
  - webtest (2.0.29)
  - zope.component (4.4.1)
  - zope.deprecation (4.3.0)
  - zope.event (4.3.0)
  - zope.interface (4.5.0)
  - pyramid (1.9.2)
digitalresistor commented 6 years ago

Using the latest poetry version (saw you push to develop):

Riley:pyramidtesting2 xistence$ poetry --version
Poetry 0.10.0-alpha.2
Riley:pyramidtesting2 xistence$ poetry install --no-dev
Creating virtualenv pyramidtesting2-py3.6 in /Users/xistence/Library/Caches/pypoetry/virtualenvs
Updating dependencies
Resolving dependencies... (0.4s)

Nothing to install or update

Writing lock file

Then, remove the lock file:

Riley:pyramidtesting2 xistence$ poetry install
Creating virtualenv pyramidtesting2-py3.6 in /Users/xistence/Library/Caches/pypoetry/virtualenvs
Updating dependencies
Resolving dependencies... (0.3s)

Package operations: 20 installs, 0 updates, 0 removals

Writing lock file

  - Installing beautifulsoup4 (4.6.0)
  - Installing coverage (4.5.1)
  - Installing hupper (1.3)
  - Installing nose (1.3.7)
  - Installing pastedeploy (1.5.2)
  - Installing plaster (1.0)
  - Installing plaster-pastedeploy (0.5)
  - Installing repoze.lru (0.7)
  - Installing six (1.11.0)
  - Installing translationstring (1.3)
  - Installing venusian (1.1.0)
  - Installing virtualenv (16.0.0)
  - Installing waitress (1.1.0)
  - Installing webob (1.8.1)
  - Installing webtest (2.0.29)
  - Installing zope.component (4.4.1)
  - Installing zope.deprecation (4.3.0)
  - Installing zope.event (4.3.0)
  - Installing zope.interface (4.5.0)
  - Installing pyramid (1.9.2)

If you then try to remove the dev dependencies:

Riley:pyramidtesting2 xistence$ poetry install --no-dev
Installing dependencies from lock file

Package operations: 0 installs, 0 updates, 20 removals

  - Removing beautifulsoup4 (4.6.0)
  - Removing coverage (4.5.1)
  - Removing hupper (1.3)
  - Removing nose (1.3.7)
  - Removing pastedeploy (1.5.2)
  - Removing plaster (1.0)
  - Removing plaster-pastedeploy (0.5)
  - Removing pyramid (1.9.2)
  - Removing repoze.lru (0.7)
  - Removing six (1.11.0)
  - Removing translationstring (1.3)
  - Removing venusian (1.1.0)
  - Removing virtualenv (16.0.0)
  - Removing waitress (1.1.0)
  - Removing webob (1.8.1)
  - Removing webtest (2.0.29)
  - Removing zope.component (4.4.1)
  - Removing zope.deprecation (4.3.0)
  - Removing zope.event (4.3.0)
  - Removing zope.interface (4.5.0)

You are back to 0 with no pyramid installed.

sdispater commented 6 years ago

That last case is definitely a bug, since it should still keep pyramid and its runtime dependencies.

I will try to fix it.

sdispater commented 6 years ago

And thanks for you detailed bug reports!

digitalresistor commented 6 years ago

Even worse, let's add something that depends on pyramid:

So now we have a pyproject.toml file that looks like this:

[tool.poetry]
name = "pyramidtesting2"
version = "0.1.0"
description = ""
authors = ["Your Name <you@example.com>"]

[tool.poetry.dependencies]
python = "*"
pyramid = "^1.9"
pyramid_services = "^1.1"

[tool.poetry.dev-dependencies]
pyramid = {version = "^1.9", extras = ["testing"]}

and run:

Riley:pyramidtesting2 xistence$ poetry install --no-dev
Creating virtualenv pyramidtesting2-py3.6 in /Users/xistence/Library/Caches/pypoetry/virtualenvs
Updating dependencies
Resolving dependencies... (1.0s)

Package operations: 21 installs, 0 updates, 0 removals

Writing lock file

  - Installing beautifulsoup4 (4.6.0)
  - Installing coverage (4.5.1)
  - Installing hupper (1.3)
  - Installing nose (1.3.7)
  - Installing pastedeploy (1.5.2)
  - Installing plaster (1.0)
  - Installing plaster-pastedeploy (0.5)
  - Installing repoze.lru (0.7)
  - Installing six (1.11.0)
  - Installing translationstring (1.3)
  - Installing venusian (1.1.0)
  - Installing virtualenv (16.0.0)
  - Installing waitress (1.1.0)
  - Installing webob (1.8.1)
  - Installing webtest (2.0.29)
  - Installing zope.component (4.4.1)
  - Installing zope.deprecation (4.3.0)
  - Installing zope.event (4.3.0)
  - Installing zope.interface (4.5.0)
  - Installing pyramid (1.9.2)
  - Installing pyramid-services (1.1)

It picks up the testing extra from dev-dependencies and installs those extras even-though I asked for no --no-dev.

digitalresistor commented 6 years ago

@sdispater As an open source maintainer myself, I understand good test cases/reproducible examples are key to helping solve the problem and understanding it.

Thank you for all your hard work, I really appreciate it!

sdispater commented 6 years ago

@bertjwregeer Commit 58e3cc2 on the develop branch should fix this.

I will try to make a new prerelease soon.

digitalresistor commented 6 years ago

Can confirm:

Riley:pyramidtesting2 xistence$ poetry install --no-dev
Creating virtualenv pyramidtesting2-py3.6 in /Users/xistence/Library/Caches/pypoetry/virtualenvs
Installing dependencies from lock file

Package operations: 12 installs, 0 updates, 0 removals

  - Installing hupper (1.3)
  - Installing pastedeploy (1.5.2)
  - Installing plaster (1.0)
  - Installing plaster-pastedeploy (0.5)
  - Installing pyramid (1.9.2)
  - Installing pyramid-services (1.1)
  - Installing repoze.lru (0.7)
  - Installing translationstring (1.3)
  - Installing venusian (1.1.0)
  - Installing webob (1.8.1)
  - Installing zope.deprecation (4.3.0)
  - Installing zope.interface (4.5.0)
Riley:pyramidtesting2 xistence$ poetry install
Installing dependencies from lock file

Package operations: 9 installs, 0 updates, 0 removals

  - Installing beautifulsoup4 (4.6.0)
  - Installing coverage (4.5.1)
  - Installing nose (1.3.7)
  - Installing six (1.11.0)
  - Installing virtualenv (16.0.0)
  - Installing waitress (1.1.0)
  - Installing webtest (2.0.29)
  - Installing zope.component (4.4.1)
  - Installing zope.event (4.3.0)
Riley:pyramidtesting2 xistence$ poetry install --no-dev
Installing dependencies from lock file

Package operations: 0 installs, 0 updates, 9 removals

  - Removing beautifulsoup4 (4.6.0)
  - Removing coverage (4.5.1)
  - Removing nose (1.3.7)
  - Removing six (1.11.0)
  - Removing virtualenv (16.0.0)
  - Removing waitress (1.1.0)
  - Removing webtest (2.0.29)
  - Removing zope.component (4.4.1)
  - Removing zope.event (4.3.0)

And removing the pyramid_services as a dependency:

Riley:pyramidtesting2 xistence$ poetry install --no-dev
Creating virtualenv pyramidtesting2-py3.6 in /Users/xistence/Library/Caches/pypoetry/virtualenvs
Updating dependencies
Resolving dependencies... (0.3s)

Package operations: 11 installs, 0 updates, 0 removals

Writing lock file

  - Installing hupper (1.3)
  - Installing pastedeploy (1.5.2)
  - Installing plaster (1.0)
  - Installing plaster-pastedeploy (0.5)
  - Installing repoze.lru (0.7)
  - Installing translationstring (1.3)
  - Installing venusian (1.1.0)
  - Installing webob (1.8.1)
  - Installing zope.deprecation (4.3.0)
  - Installing zope.interface (4.5.0)
  - Installing pyramid (1.9.2)
Riley:pyramidtesting2 xistence$ poetry install
Installing dependencies from lock file

Package operations: 9 installs, 0 updates, 0 removals

  - Installing beautifulsoup4 (4.6.0)
  - Installing coverage (4.5.1)
  - Installing nose (1.3.7)
  - Installing six (1.11.0)
  - Installing virtualenv (16.0.0)
  - Installing waitress (1.1.0)
  - Installing webtest (2.0.29)
  - Installing zope.component (4.4.1)
  - Installing zope.event (4.3.0)
Riley:pyramidtesting2 xistence$ poetry install --no-dev
Installing dependencies from lock file

Package operations: 0 installs, 0 updates, 9 removals

  - Removing beautifulsoup4 (4.6.0)
  - Removing coverage (4.5.1)
  - Removing nose (1.3.7)
  - Removing six (1.11.0)
  - Removing virtualenv (16.0.0)
  - Removing waitress (1.1.0)
  - Removing webtest (2.0.29)
  - Removing zope.component (4.4.1)
  - Removing zope.event (4.3.0)

Thanks! Would you like me to close this ticket, or will you when you cut a new pre-release?

sdispater commented 6 years ago

I will close it when the stable 0.10.0 relase is published.

sdispater commented 6 years ago

Release 0.10.0 is out!

cipriantarta commented 5 years ago

Not sure if this is a good place, but instead of creating a new issue I though I'll put this here since it's related.

This is how my pyproject.toml file looks like

...
[tool.poetry.dependencies]
private_package = {version = "^2.0",extras = ["api", "etl"]}

[tool.poetry.dev-dependencies]
private_package = {path = "../private_package",extras = ["api", "etl"]}

The package comes from a private repo, but that's not important. What matters is that in development mode, I want that package to use a path since I'm the author of bot the private_package and the one that the file above is for.

The problem is that the extras packages in the dev dependencies are being ignored. Shouldn't dev-dependencies take highest priority when installing without --no-dev?

github-actions[bot] commented 7 months ago

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.