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

cache:clear arguments are confusing #521

Closed
3 tasks done
epage opened this issue Oct 18, 2018 · 34 comments
Closed
3 tasks done

cache:clear arguments are confusing #521

epage opened this issue Oct 18, 2018 · 34 comments
Labels
area/docs Documentation issues/improvements

Comments

@epage
Copy link
Contributor

epage commented Oct 18, 2018

  • 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: 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>
@seansfkelley
Copy link

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

@Imaclean74
Copy link
Contributor

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

@dsevero
Copy link

dsevero commented Apr 30, 2019

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

@jasonkuhrt
Copy link

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

@seansfkelley
Copy link

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

@jasonkuhrt
Copy link

@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.

@blckfalcon
Copy link

blckfalcon commented May 18, 2019

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.

@spapanik
Copy link

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

@brycedrennan brycedrennan added the area/docs Documentation issues/improvements label Aug 20, 2019
@stale
Copy link

stale bot commented Nov 13, 2019

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.

@stale stale bot added the stale label Nov 13, 2019
@epage
Copy link
Contributor Author

epage commented Nov 13, 2019

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

@stale stale bot removed the stale label Nov 13, 2019
@pawamoy
Copy link

pawamoy commented Nov 29, 2019

@epage, you might find this comment interesting 🙂

@epage
Copy link
Contributor Author

epage commented Nov 29, 2019

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.

@pawamoy
Copy link

pawamoy commented Nov 29, 2019

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

@finswimmer
Copy link
Member

@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

@f0ff886f
Copy link

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?

@macedigital
Copy link

macedigital commented Feb 13, 2020

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

@AFAgarap
Copy link

AFAgarap commented Sep 1, 2020

Not working in Ubuntu 20.04

@Eugeny
Copy link

Eugeny commented Sep 7, 2020

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

@AntonOfTheWoods
Copy link

So there is a bug in the help text?

@pawamoy
Copy link

pawamoy commented Dec 18, 2020

It should be explained in the help text that the cache argument corresponds to the configured repositories (their aliases, not URLs). Then it 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 🙂

@sondrelg
Copy link

sondrelg commented Dec 22, 2020

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

@abn
Copy link
Member

abn commented Apr 30, 2021

Does the poetry cache list command help here?

@JackLeo
Copy link

JackLeo commented May 25, 2021

Not only the dot is mandatory for no reason (should be default), but also --no-interaction flag means that default to the question of - should it delete is no. And there is no option to pass yes via CLI when for example building docker containers...

@ondrejchmelar
Copy link

Looks like yes | poetry cache clear . --all is the way to go in docker. Documentation is poor on cache clearing thought.

@care1e55
Copy link

care1e55 commented Sep 7, 2021

Manually deleiting cache works for my case 🤷‍♂️
rm -rf ~/.cache/pypoetry/artifacts

@adriangb
Copy link
Contributor

Looks like yes | poetry cache clear . --all is the way to go in docker. Documentation is poor on cache clearing thought.

It would be nice to have a -y/-n option, which is more reliable than piping input

@laoshaw
Copy link

laoshaw commented Oct 4, 2021

Looks like yes | poetry cache clear . --all is the way to go in docker. Documentation is poor on cache clearing thought.

It would be nice to have a -y/-n option, which is more reliable than piping input

it this a documentation error or not? just started to use poetry, so far it's not as robust as the typical pip+venv approach, unsure about what the real benefit is if it keeps having 'basic' bugs :(

@davips
Copy link

davips commented Oct 19, 2021

How to clear cache for a specific package?
Is it always --all?

I am having to clear the cache almost every time to be able to update a dependence which I have just sent to pypi.
This would be no problem if poetry update/install didn't take minutes in my linux.

@sondrelg
Copy link

I think you can use poetry cache list to discover your caches @davips 🙂 But I think it's always just pypi.

@GussSoares
Copy link

GussSoares commented Nov 23, 2021

Manually deleiting cache works for my case man_shrugging rm -rf ~/.cache/pypoetry/artifacts

work for me too.

for windows the path is this: C:\Users\<user>\AppData\Local\pypoetry\Cache\artifacts

@mfulgo
Copy link

mfulgo commented May 12, 2022

After a bit of stumbling around, not wanting to delete the whole cache, perhaps a better help message for the clear command?

  clear
    Clears Poetry's cache.

    <cache>              The name of the cache to clear. If --all is not used, you must
                         specify a package and version as cache:package:version.

    --all                Clear all entries in the cache.

Or an updated USAGE section:

USAGE
      poetry cache
  or: poetry cache clear <cache>:<package>:<version>
  or: poetry cache clear --all <cache>
  or: poetry cache list

@abn
Copy link
Member

abn commented May 12, 2022

PRs are definitely welcome to improve the documentation and help messages.

Secrus added a commit to Secrus/poetry that referenced this issue May 20, 2022
…thon-poetry#3573, python-poetry#2211, python-poetry#521 and PR python-poetry#2414

- Added section about `extras` in `dependency-specification.md` (python-poetry#2414)
- Added note about VCS inclusion and exclusion in `include`/`exclude`
sections of `pyproject.toml` (python-poetry#4800)
- Added link to dependency specification in `add` command documentation
(python-poetry#3573)
- Added more info on default behaviour and cleaned up
`virtualenv.in-project` setting documentation (python-poetry#3709)
- Added missing configuration options to `configuration.md` (python-poetry#2211)
neersighted pushed a commit that referenced this issue May 23, 2022
…5656)

* Changes in docs for Issues #4800, #3709, #3573, #2211, #521 and PR #2414

- Added section about `extras` in `dependency-specification.md` (#2414)
- Added note about VCS inclusion and exclusion in `include`/`exclude`
sections of `pyproject.toml` (#4800)
- Added link to dependency specification in `add` command documentation
(#3573)
- Added more info on default behaviour and cleaned up
`virtualenv.in-project` setting documentation (#3709)
- Added missing configuration options to `configuration.md` (#2211)

Co-authored-by: Arun Babu Neelicattu <arun.neelicattu@gmail.com>
@finswimmer
Copy link
Member

Looks like the documentation is now clear about this: https://python-poetry.org/docs/cli/#cache-clear

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
area/docs Documentation issues/improvements
Projects
None yet
Development

No branches or pull requests