python-poetry / poetry

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

poetry does not remove all dependencies #2959

Closed ericorain closed 4 years ago

ericorain commented 4 years ago

Hi.

If I use poetry to add a python module and I remove it immediately then I can see some dependencies are still visible with "poetry show" command. I was expecting an empty list. In addition those dependencies are not removable. Below we can see 15 dependencies added and 4 removed.

There is probably something wrong. Or did I miss something?

d:\Prog\python\poetry>poetry new prj
Created package prj in prj

d:\Prog\python\poetry>cd prj

d:\Prog\python\poetry\prj>poetry shell

[skip content]

d:\Prog\python\poetry\prj>poetry show

d:\Prog\python\poetry\prj>poetry add pandas
Using version ^1.1.2 for pandas

Updating dependencies
Resolving dependencies...

Writing lock file

Package operations: 15 installs, 0 updates, 0 removals

  - Installing pyparsing (2.4.7)
  - Installing six (1.15.0)
  - Installing atomicwrites (1.4.0)
  - Installing attrs (20.2.0)
  - Installing colorama (0.4.3)
  - Installing more-itertools (8.5.0)
  - Installing numpy (1.19.2)
  - Installing packaging (20.4)
  - Installing pluggy (0.13.1)
  - Installing py (1.9.0)
  - Installing python-dateutil (2.8.1)
  - Installing pytz (2020.1)
  - Installing wcwidth (0.2.5)
  - Installing pandas (1.1.2)
  - Installing pytest (5.4.3)

d:\Prog\python\poetry\prj>poetry show
atomicwrites    1.4.0  Atomic file writes.
attrs           20.2.0 Classes Without Boilerplate
colorama        0.4.3  Cross-platform colored terminal text.
more-itertools  8.5.0  More routines for operating on iterables, beyond itertools
numpy           1.19.2 NumPy is the fundamental package for array computing with Python.
packaging       20.4   Core utilities for Python packages
pandas          1.1.2  Powerful data structures for data analysis, time series, and statistics
pluggy          0.13.1 plugin and hook calling mechanisms for python
py              1.9.0  library with cross-python path, ini-parsing, io, code, log facilities
pyparsing       2.4.7  Python parsing module
pytest          5.4.3  pytest: simple powerful testing with Python
python-dateutil 2.8.1  Extensions to the standard Python datetime module
pytz            2020.1 World timezone definitions, modern and historical
six             1.15.0 Python 2 and 3 compatibility utilities
wcwidth         0.2.5  Measures the displayed width of unicode strings in a terminal

d:\Prog\python\poetry\prj>poetry remove pandas
Updating dependencies
Resolving dependencies...

Writing lock file

Package operations: 0 installs, 0 updates, 4 removals

  - Removing numpy (1.19.2)
  - Removing pandas (1.1.2)
  - Removing python-dateutil (2.8.1)
  - Removing pytz (2020.1)

d:\Prog\python\poetry\prj>poetry show
atomicwrites   1.4.0  Atomic file writes.
attrs          20.2.0 Classes Without Boilerplate
colorama       0.4.3  Cross-platform colored terminal text.
more-itertools 8.5.0  More routines for operating on iterables, beyond itertools
packaging      20.4   Core utilities for Python packages
pluggy         0.13.1 plugin and hook calling mechanisms for python
py             1.9.0  library with cross-python path, ini-parsing, io, code, log facilities
pyparsing      2.4.7  Python parsing module
pytest         5.4.3  pytest: simple powerful testing with Python
six            1.15.0 Python 2 and 3 compatibility utilities
wcwidth        0.2.5  Measures the displayed width of unicode strings in a terminal

d:\Prog\python\poetry\prj>poetry --version
Poetry version 1.0.10

d:\Prog\python\poetry\prj>poetry remove atomicwrites

[ValueError]
Package atomicwrites not found

d:\Prog\python\poetry\prj>
finswimmer commented 4 years ago

Hello @ericorain,

how does you pyproject.toml looks like, before you do a poetry add pandas?

When I do this in fresh project there are only 5 packages that get installed and removed:

$ poetry add pandas      
Using version ^1.1.2 for pandas

Updating dependencies
Resolving dependencies... (0.3s)

Writing lock file

Package operations: 5 installs, 0 updates, 0 removals

  • Installing six (1.15.0)
  • Installing numpy (1.19.2)
  • Installing python-dateutil (2.8.1)
  • Installing pytz (2020.1)
  • Installing pandas (1.1.2)
$ poetry remove pandas
Updating dependencies
Resolving dependencies... (0.1s)

Writing lock file

Package operations: 0 installs, 0 updates, 5 removals

  • Removing numpy (1.19.2)
  • Removing pandas (1.1.2)
  • Removing python-dateutil (2.8.1)
  • Removing pytz (2020.1)
  • Removing six (1.15.0)
ericorain commented 4 years ago

Hello finswimmer.

I removed the prj folder then created a new project. This time not all the python modules are downloaded (just 4 of them) but they appear in the list shown by "poetry show".

Here is the content of this file:

d:\Prog\python\poetry>poetry new prj
Created package prj in prj

d:\Prog\python\poetry>cd prj

d:\Prog\python\poetry\prj>poetry shell

[skip content]

d:\Prog\python\poetry\prj>more pyproject.toml
[tool.poetry]
name = "prj"
version = "0.1.0"
description = ""
authors = ["ericorain <email>"]

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

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

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

d:\Prog\python\poetry\prj>
d:\Prog\python\poetry\prj>poetry add pandas
Using version ^1.1.2 for pandas

Updating dependencies
Resolving dependencies...

Writing lock file

Package operations: 4 installs, 0 updates, 0 removals

  - Installing numpy (1.19.2)
  - Installing python-dateutil (2.8.1)
  - Installing pytz (2020.1)
  - Installing pandas (1.1.2)

d:\Prog\python\poetry\prj>poetry show
atomicwrites    1.4.0  Atomic file writes.
attrs           20.2.0 Classes Without Boilerplate
colorama        0.4.3  Cross-platform colored terminal text.
more-itertools  8.5.0  More routines for operating on iterables, beyond itertools
numpy           1.19.2 NumPy is the fundamental package for array computing with Python.
packaging       20.4   Core utilities for Python packages
pandas          1.1.2  Powerful data structures for data analysis, time series, and statistics
pluggy          0.13.1 plugin and hook calling mechanisms for python
py              1.9.0  library with cross-python path, ini-parsing, io, code, log facilities
pyparsing       2.4.7  Python parsing module
pytest          5.4.3  pytest: simple powerful testing with Python
python-dateutil 2.8.1  Extensions to the standard Python datetime module
pytz            2020.1 World timezone definitions, modern and historical
six             1.15.0 Python 2 and 3 compatibility utilities
wcwidth         0.2.5  Measures the displayed width of unicode strings in a terminal

d:\Prog\python\poetry\prj>more pyproject.toml
[tool.poetry]
name = "prj"
version = "0.1.0"
description = ""
authors = ["ericorain <email>"]

[tool.poetry.dependencies]
python = "^3.8"
pandas = "^1.1.2"

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

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

d:\Prog\python\poetry\prj>
finswimmer commented 4 years ago

Hello @ericorain,

you have pytest in your dev dependency list. This is why there are packages left after removing pandas.

fin swimmer

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.