Poetry: cache:clear arguments are confusing

Created on 18 Oct 2018  ·  21Comments  ·  Source: python-poetry/poetry

  • [x] I am on the latest Poetry version.
  • [x] I have searched the issues of this repo and believe that this is not a duplicate.
  • [x] If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: Windows 10
  • Poetry version: 0.12.2

Issue

poetry cache:clear --help
Usage:
  cache:clear [options] [--] <cache>

Arguments:
  cache                           The name of the cache to clear.

Options:
      --all                       Clear all caches.
  -h, --help                      Display this help message
  -q, --quiet                     Do not output any message
  -V, --version                   Display this application version
      --ansi                      Force ANSI output
      --no-ansi                   Disable ANSI output
  -n, --no-interaction            Do not ask any interactive question
  -v|vv|vvv, --verbose[=VERBOSE]  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Help:
 Clears poetry's cache.

It reads as if --all and cache name are mutually exclusive (instead of clearing the named cache, I clear all caches) but when I do poetry cache:clear --all

poetry cache:clear --all -vvv

[MissingArguments]
Not enough arguments

Exception trace:
 C:\Users\epage.AMER\AppData\Roaming\.poetry\lib\poetry\_vendor\py2.7\cleo\application.py in run() at line 94
   status_code = self.do_run(input_, output_)
 C:\Users\epage.AMER\AppData\Roaming\.poetry\lib\poetry\console\application.py in do_run() at line 88
   return super(Application, self).do_run(i, o)
 C:\Users\epage.AMER\AppData\Roaming\.poetry\lib\poetry\_vendor\py2.7\cleo\application.py in do_run() at line 197
   status_code = command.run(input_, output_)
 C:\Users\epage.AMER\AppData\Roaming\.poetry\lib\poetry\console\commands\command.py in run() at line 77
   return super(BaseCommand, self).run(i, o)
 C:\Users\epage.AMER\AppData\Roaming\.poetry\lib\poetry\_vendor\py2.7\cleo\commands\base_command.py in run() at line 141
   input_.validate()
 C:\Users\epage.AMER\AppData\Roaming\.poetry\lib\poetry\_vendor\py2.7\cleo\inputs\input.py in validate() at line 68
   raise MissingArguments('Not enough arguments')

cache:clear [--all] [--] <cache>
Documentation

Most helpful comment

Just for completeness, this issue is not resolved, nor just a documentation issue.

OS: Ubuntu 18.04.4 LTS
Poetry: 1.0.3

$ poetry --version 
Poetry version 1.0.3

$ poetry cache clear -- --all 
[RuntimeError]
Add the --all option if you want to clear all --all caches

$ poetry cache clear --all 
Not enough arguments (missing: "cache").

"Accepted" solution:

$ poetry cache:clear --all 
The command "cache:clear" is not defined.

$ poetry cache clear pypi --all
Delete 791 entries? (yes/no) [no] yes

All 21 comments

Has anyone come up with a workaround that will permit one to cache:clear --all?

also - how can you list up the "named" caches ?

Still can't figure out how to clear the cache. I'm basically deleting dirs in ~/.cache/pypoetry/virtualenvs/ for now.

~/Library/Caches/pypoetry/virtualenvs on macOS.

Those are the virtual environments, which are not the same as the cache, right? Or is that what cache:clear is actually referring to?

@seansfkelley I had an issue where after changing virtualenv's to be project local existing projects in this directory had to be deleted before projects worked with the new setting.

I found out that the command is supposed to be:
poetry cache:clear repository --all
So in reference to packages coming from pypi ( pip ):
poetry cache:clear pypi --all
That worked for me.

What is the purpose of --all? Is there an option of adding something else than --all? Because it seems a bit redundant.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

As a user, this is a bit frustrating for issues to be automatically closed when the problem is unresponsiveness from the maintainers.

@epage, you might find this comment interesting 🙂

I can understand the use of a stale bot, the messaging is the important part.

Somehow I got

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

while the linked issue got

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

There is a big difference between the two in terms of how the community is being treated.

I see, good point on the messaging part. It's weird because both messages were posted 16 days ago 🙂

@epage thank's for pointing to this. I never realized that there are any difference between the message and the linked post and indeed in this case the message sounds to rough.

I will ping @sdispater to take a look at this.

fin swimmer

This still seems confusing with 1.0:

❯ poetry cache
USAGE
      poetry cache
  or: poetry cache clear [--all] <cache>

COMMANDS
  clear
    Clears Poetry's cache.

    <cache>              The name of the cache to clear.

    --all                Clear all entries in the cache.

GLOBAL OPTIONS
  -h (--help)            Display this help message
  -q (--quiet)           Do not output any message
  -v (--verbose)         Increase the verbosity of messages: "-v" for normal output, "-vv" for more verbose output and                           "-vvv" for debug
  -V (--version)         Display this application version
  --ansi                 Force ANSI output
  --no-ansi              Disable ANSI output
  -n (--no-interaction)  Do not ask any interactive question

<cache> The name of the cache to clear.

How is a user supposed to know what name is valid?

Just for completeness, this issue is not resolved, nor just a documentation issue.

OS: Ubuntu 18.04.4 LTS
Poetry: 1.0.3

$ poetry --version 
Poetry version 1.0.3

$ poetry cache clear -- --all 
[RuntimeError]
Add the --all option if you want to clear all --all caches

$ poetry cache clear --all 
Not enough arguments (missing: "cache").

"Accepted" solution:

$ poetry cache:clear --all 
The command "cache:clear" is not defined.

$ poetry cache clear pypi --all
Delete 791 entries? (yes/no) [no] yes

Not working in Ubuntu 20.04

Also, -n actually automatically cancels the command instead of clearing the cache.

So there is a bug in the help text?

It should be explained in the help text that the cache argument corresponds to the configured repositories (their aliases, not URLs). Then if would help even more to get autocompletion for this command.

$ poetry config --list | grep repositories | cut -d. -f2
custom-pypi1
custom-pypi2
custom-pypi3

$ ls ~/.cache/pypoetry/cache/repositories
custom-pypi1 custom-pypi2 custom-pypi3 pypi

In this case, the command would complete the cache positional argument with these custom repositories plus pypi.

Still, it seems the command is a bit broken, because you must use the --all arg in any case. Instead, the command should accept one or several package names, or --all 🙂

I just successfully ran poetry cache clear . --all with success if it helps anyone

Was this page helpful?
0 / 5 - 0 ratings