Add public NULL_LABEL constant to Azure App Configuration Provider#45547
Add public NULL_LABEL constant to Azure App Configuration Provider#45547
NULL_LABEL constant to Azure App Configuration Provider#45547Conversation
Co-authored-by: mrm9084 <1054559+mrm9084@users.noreply.github.com>
NULL_LABEL constant to Azure App Configuration Provider
There was a problem hiding this comment.
Pull request overview
This PR improves the Azure App Configuration Provider public API and docs by introducing a named constant for the “null label” ("\0") so users don’t need to rely on an opaque string literal when configuring SettingSelector.
Changes:
- Added public
NULL_LABELconstant as an alias for the existing null-character label sentinel. - Exported
NULL_LABELfrom the package public surface (__init__.py) and updated README example usage. - Added changelog entry and a unit test validating
NULL_LABELbehavior withSettingSelector.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_constants.py | Adds NULL_LABEL alias intended for public use. |
| sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/init.py | Exposes NULL_LABEL via public imports and __all__. |
| sdk/appconfiguration/azure-appconfiguration-provider/README.md | Replaces "\0" literal in examples with NULL_LABEL. |
| sdk/appconfiguration/azure-appconfiguration-provider/CHANGELOG.md | Documents the new public constant in the unreleased section. |
| sdk/appconfiguration/azure-appconfiguration-provider/tests/test_setting_selector.py | Adds coverage asserting NULL_LABEL is exported and works with SettingSelector. |
| NULL_LABEL = NULL_CHAR | ||
| """Represents the null label (No Label) in Azure App Configuration. Use this constant | ||
| with :class:`~azure.appconfiguration.provider.SettingSelector` to select configuration | ||
| settings that have no label assigned.""" |
There was a problem hiding this comment.
The triple-quoted string after NULL_LABEL = NULL_CHAR is a standalone module string literal (it does not attach as documentation to NULL_LABEL). This likely won’t show up in generated docs and is effectively dead code. Convert it to a normal comment (or a #: doc comment if you want Sphinx to pick it up), or move the text into an appropriate module/doc location.
| NULL_LABEL = NULL_CHAR | |
| """Represents the null label (No Label) in Azure App Configuration. Use this constant | |
| with :class:`~azure.appconfiguration.provider.SettingSelector` to select configuration | |
| settings that have no label assigned.""" | |
| #: Represents the null label (No Label) in Azure App Configuration. | |
| #: Use this constant with :class:`~azure.appconfiguration.provider.SettingSelector` | |
| #: to select configuration settings that have no label assigned. | |
| NULL_LABEL = NULL_CHAR |
| from azure.identity import DefaultAzureCredential | ||
|
|
||
| selects = {SettingSelector(key_filter="*", label_filter="\0"), SettingSelector(key_filter="*", label_filter="dev")} | ||
| selects = {SettingSelector(key_filter="*", label_filter=NULL_LABEL), SettingSelector(key_filter="*", label_filter="dev")} |
There was a problem hiding this comment.
The example uses a set literal for selects, but the provider API is typed/documented as List[SettingSelector] and the paragraph below relies on selector order for precedence. Sets are unordered, so this example can produce non-deterministic precedence. Use a list (e.g., [...]) to preserve order, and keep the explanation consistent with that.
| selects = {SettingSelector(key_filter="*", label_filter=NULL_LABEL), SettingSelector(key_filter="*", label_filter="dev")} | |
| selects = [ | |
| SettingSelector(key_filter="*", label_filter=NULL_LABEL), | |
| SettingSelector(key_filter="*", label_filter="dev"), | |
| ] |
Users had no named constant for the null label (
"\0") when configuringSettingSelector, requiring them to use an opaque string literal.Changes
_constants.py: AddedNULL_LABEL = NULL_CHAR— a public alias for the existing internalNULL_CHARconstant representing "No Label"__init__.py: ExportedNULL_LABELin the public API (__all__)README.md: Updated example to useNULL_LABELinstead of"\0"CHANGELOG.md: Added feature entrytests/test_setting_selector.py: Addedtest_null_label_constantcovering equality withNULL_CHARand use inSettingSelectorUsage
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
pypi.org/home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/bin/python /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/bin/python /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/lib/python3.9/site-packages/pip/__pip-REDACTED__.py install --ignore-installed --no-user --prefix /tmp/pip-build-env-1scms1s3/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i REDACTED -- setuptools>=40.8.0(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.