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

Is it possible to format the cache json when it's written to disk #1700

Open
zyxue opened this issue Oct 10, 2022 · 4 comments
Open

Is it possible to format the cache json when it's written to disk #1700

zyxue opened this issue Oct 10, 2022 · 4 comments
Labels
cache Related to dependency cache resolver Related to dependency resolver

Comments

@zyxue
Copy link

zyxue commented Oct 10, 2022

What's the problem this feature will solve?

I'm considering committing the cache json (e.g. depcache-cp3.8.json) via git in a monorepo environment, so that everyone has the same cache.

People may have diff legacy caches e.g. due to bug like #1511.

Formatted json instead of putting everything in a single line makes it easier to read the diff, is that possible currently?

@zyxue
Copy link
Author

zyxue commented Oct 11, 2022

given

pip-tools/piptools/cache.py

Lines 111 to 112 in 88daf21

with open(self._cache_file, "w", encoding="utf-8") as f:
json.dump(doc, f, sort_keys=True)
, probably not supported currently

@atugushev
Copy link
Member

atugushev commented Nov 3, 2022

The dependency cache used by the legacy resolver will be deprecated and removed soon. I'd suggest using pip-compile --backtracking resolver instead. See #1659.

@atugushev atugushev added resolver Related to dependency resolver cache Related to dependency cache labels Nov 3, 2022
@zyxue
Copy link
Author

zyxue commented Nov 7, 2022

@atugushev you mean --resolver backtracking right?

I tried it out, and appears to be significantly slower, and it doesn't update the cache, does it mean backtracking doesn't use cache anymore?

@atugushev
Copy link
Member

@zyxue

The dependency cache (piptools/cache.py) is the implementation details of the legacy resolver written in pip-tools. The backtracking resolver is a wrapper around pip's backtracking resolver so everything now works under the hood of pip (resolving/caching/etc).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cache Related to dependency cache resolver Related to dependency resolver
Projects
None yet
Development

No branches or pull requests

2 participants