fix: add CLOUDSMITH_KEYRING_* env var aliases to avoid global impact - #356
Open
cloudsmith-iduffy wants to merge 1 commit into
Open
fix: add CLOUDSMITH_KEYRING_* env var aliases to avoid global impact#356cloudsmith-iduffy wants to merge 1 commit into
cloudsmith-iduffy wants to merge 1 commit into
Conversation
…bal impact Setting PYTHON_KEYRING_BACKEND/KEYRING_PROPERTY_KEYRING_KEY globally so the CLI picks up cloudsmith-keyring also gets picked up by unrelated Python tooling (e.g. uv sync), breaking it. CLOUDSMITH_KEYRING_BACKEND and CLOUDSMITH_KEYRING_KEY let these be set for the CLI alone; they only apply when the native keyring env var isn't already set. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Cloudsmith-specific environment variable aliases for configuring keyring behavior in the CLI process, avoiding the need to set global PYTHON_KEYRING_BACKEND / KEYRING_PROPERTY_* variables that can impact unrelated Python tooling.
Changes:
- Introduces
CLOUDSMITH_KEYRING_BACKEND→PYTHON_KEYRING_BACKENDaliasing andCLOUDSMITH_KEYRING_KEY→KEYRING_PROPERTY_KEYRING_KEYaliasing incloudsmith_cli/core/keyring.py. - Ensures the resolved keyring backend has
set_properties_from_env()applied from the keyring entry points (_get_value,_set_value,_delete_value). - Adds unit tests and a changelog entry documenting the new env var behavior and precedence rules.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
cloudsmith_cli/core/keyring.py |
Adds env var alias syncing and backend preparation to apply keyring properties consistently. |
cloudsmith_cli/core/tests/test_keyring.py |
Adds tests covering alias precedence/no-op behavior and verifying backend property application. |
CHANGELOG.md |
Documents the new env var aliases and intended usage/precedence. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+50
to
+53
| @pytest.fixture | ||
| def mock_get_keyring(): | ||
| with patch.object(keyring, "get_keyring") as get_keyring_mock: | ||
| yield get_keyring_mock |
Contributor
Author
|
@claude review once |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CLOUDSMITH_KEYRING_BACKENDas an alias forPYTHON_KEYRING_BACKEND, andCLOUDSMITH_KEYRING_KEYas an alias forKEYRING_PROPERTY_KEYRING_KEYPYTHON_KEYRING_BACKEND/KEYRING_PROPERTY_KEYRING_KEYusage is unaffected_get_value,_set_value,_delete_value)Motivation
Ran into this trying to use cloudsmith-keyring in an existing project via the standalone CLI binary. Setting
PYTHON_KEYRING_BACKENDin the environment so the CLI would pick it up also got picked up by unrelated Python tooling in the same environment —uv syncstarted failing because of it. These aliases let the backend/key be configured for the CLI specifically, without a global env var affecting every other Python process.Test plan
set_properties_from_env()pytest cloudsmith_cli/core/tests/test_keyring.py— 42 passed🤖 Generated with Claude Code