Per-project API key caching
When using hatch publish with an API token, hatch attempts to use the same cached token for all projects, because the repository user is always _token_. Is there a way to cache API token per-project? If so, the documentation at https://hatch.pypa.io/latest/publish/should include how to do it.
i'm currently looking at the relevant code and afaict tokens are cached with both the repository's URL and username as key. could you elaborate more on the circumstances and the unexpected behaviour?
I have this issue as well. I have a repo with multiple packages and the caching breaks publishing for me. I can't figure out how to make hatch use different tokens or how to even override the token I originally set with one that is scoped to everything. Would love to tell hatch to use a specific project name (as recommended by PyPI) or fall back to the non-cached token.
[distutils]
index-servers =
pypi
PROJECT_NAME
[pypi]
username = __token__
password = # either a user-scoped token or a project-scoped token you want to set as the default
[PROJECT_NAME]
repository = https://upload.pypi.org/legacy/
username = __token__
password = # a project token