psf / psf/cachecontrol

Allow using a heuristic with the `doesitcache` tool

Open
#118 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
505
Forks
149
Avg merge
2d 13h
Merged PRs (30d)
7

Description

Often times CacheControl be confusing b/c something seems like it should be cached, but it is not. There is typically a good explanation for this and work around that comes in the form of heuristics. It would be helpful for the doesitcache tool to accept a heuristic.

Specificially:

  1. doesitcache --list-heuristics - list the available heuristics and print the docstring of the classes
  2. doesitcache --heuristic $NAME - Apply an heuristic. There might be options that need to be passed in, which seems to go above and beyond at the moment. Just making sure heuristics have defaults should be enough
  3. doesitcache --heuristic $PATH - Use the file to load a python object as the heuristic. The algorithm would be to import it and see what classes are instances of the heuristic base class, choosing the first one to apply.

Docs!

Thanks to @sigmavirus24 for the suggestion!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the doesitcache CLI entry point and the heuristic base classes. Review how heuristics are discovered and instantiated, then implement the requested listing, named heuristic, and Python-path modes with default options; done includes documenting the new options and behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.