Skip to content

Add public NULL_LABEL constant to Azure App Configuration Provider#45547

Open
Copilot wants to merge 2 commits intomainfrom
copilot/add-constant-for-null-label
Open

Add public NULL_LABEL constant to Azure App Configuration Provider#45547
Copilot wants to merge 2 commits intomainfrom
copilot/add-constant-for-null-label

Conversation

Copy link
Contributor

Copilot AI commented Mar 6, 2026

Users had no named constant for the null label ("\0") when configuring SettingSelector, requiring them to use an opaque string literal.

Changes

  • _constants.py: Added NULL_LABEL = NULL_CHAR — a public alias for the existing internal NULL_CHAR constant representing "No Label"
  • __init__.py: Exported NULL_LABEL in the public API (__all__)
  • README.md: Updated example to use NULL_LABEL instead of "\0"
  • CHANGELOG.md: Added feature entry
  • tests/test_setting_selector.py: Added test_null_label_constant covering equality with NULL_CHAR and use in SettingSelector

Usage

from azure.appconfiguration.provider import load, SettingSelector, NULL_LABEL
from azure.identity import DefaultAzureCredential

selects = [
    SettingSelector(key_filter="*", label_filter=NULL_LABEL),
    SettingSelector(key_filter="*", label_filter="dev"),
]
config = load(endpoint=endpoint, credential=DefaultAzureCredential(), selects=selects)

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
    • Triggering command: /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

This section details on the original issue you should resolve

<issue_title>Azure App Configuration Provider - Null Label</issue_title>
<issue_description>A constant for \0 should be added for the setting selector.
</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: mrm9084 <1054559+mrm9084@users.noreply.github.com>
Copilot AI changed the title [WIP] Add constant for null label in setting selector Add public NULL_LABEL constant to Azure App Configuration Provider Mar 6, 2026
@mrm9084 mrm9084 marked this pull request as ready for review March 6, 2026 17:32
Copilot AI review requested due to automatic review settings March 6, 2026 17:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_LABEL constant as an alias for the existing null-character label sentinel.
  • Exported NULL_LABEL from the package public surface (__init__.py) and updated README example usage.
  • Added changelog entry and a unit test validating NULL_LABEL behavior with SettingSelector.

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.

Comment on lines +76 to +79
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."""
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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

Copilot uses AI. Check for mistakes.
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")}
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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"),
]

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Azure App Configuration Provider - Null Label

3 participants