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

Fix Environment Variable Parsing #40303

Merged
merged 7 commits into from
Apr 3, 2025
Merged

Conversation

tvaron3
Copy link
Member

@tvaron3 tvaron3 commented Mar 31, 2025

Description

Environment variables were not being parsed correctly and would cause type errors or unexpected behavior. Refactored the environment variables to be part of the constants file to be easily accessible.

@tvaron3
Copy link
Member Author

tvaron3 commented Mar 31, 2025

/azp run python - cosmos - tests

@Azure Azure deleted a comment from azure-pipelines bot Mar 31, 2025
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@tvaron3 tvaron3 marked this pull request as ready for review March 31, 2025 23:36
@Copilot Copilot bot review requested due to automatic review settings March 31, 2025 23:36
@tvaron3 tvaron3 requested review from annatisch and a team as code owners March 31, 2025 23:36
Copy link
Contributor

@Copilot 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 fixes environment variable parsing issues by refactoring how environment variable values are accessed and converted, leveraging a new constants file for configuration. Key changes include:

  • Updating test files to set and validate environment variables for vector and hybrid search queries.
  • Refactoring client connection and execution context files to use constant definitions for environment variable keys and defaults.
  • Adding new constants in _constants.py for improved configuration management.

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
sdk/cosmos/azure-cosmos/tests/test_query_vector_similarity_async.py Added tests for vector search with environment variable overrides.
sdk/cosmos/azure-cosmos/tests/test_query_vector_similarity.py Added similar vector search tests for synchronous queries.
sdk/cosmos/azure-cosmos/tests/test_query_hybrid_search_async.py Introduced hybrid search tests with environment variable configurations.
sdk/cosmos/azure-cosmos/tests/test_query_hybrid_search.py Added synchronous hybrid search tests using environment variable settings.
sdk/cosmos/azure-cosmos/azure/cosmos/aio/_cosmos_client_connection_async.py Updated environment variable usage to retrieve non-streaming order by flag using constants.
sdk/cosmos/azure-cosmos/azure/cosmos/_execution_context/execution_dispatcher.py Refactored hybrid and vector search environment variable parsing via constants with int conversion.
sdk/cosmos/azure-cosmos/azure/cosmos/_execution_context/aio/execution_dispatcher.py Updated vector search environment variable handling to use constants and int conversion.
sdk/cosmos/azure-cosmos/azure/cosmos/_cosmos_client_connection.py Refactored non-streaming order by environment variable check to use constants.
sdk/cosmos/azure-cosmos/azure/cosmos/_constants.py Added new constants for environment variable keys and their defaults.
sdk/cosmos/azure-cosmos/CHANGELOG.md Updated changelog to document the environment variable parsing fix.

Copy link
Member

@kushagraThapar kushagraThapar left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this @tvaron3

@azure-sdk
Copy link
Collaborator

API change check

API changes are not detected in this pull request.

Copy link
Member

@FabianMeiswinkel FabianMeiswinkel left a comment

Choose a reason for hiding this comment

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

LGTM

@tvaron3
Copy link
Member Author

tvaron3 commented Apr 1, 2025

/azp run python - cosmos - tests

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@tvaron3
Copy link
Member Author

tvaron3 commented Apr 1, 2025

/azp run python - cosmos - tests

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@tvaron3 tvaron3 merged commit 741181a into Azure:main Apr 3, 2025
19 checks passed
nik1097 pushed a commit to nik1097/azure-sdk-for-python that referenced this pull request Apr 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants