Skip to content

Order return of collections.list_all() alphabetically by key#1636

Merged
tsmith023 merged 5 commits into
weaviate:mainfrom
saireddythfc:codegen-bot/sort-collections-list-all
Apr 24, 2025
Merged

Order return of collections.list_all() alphabetically by key#1636
tsmith023 merged 5 commits into
weaviate:mainfrom
saireddythfc:codegen-bot/sort-collections-list-all

Conversation

@saireddythfc
Copy link
Copy Markdown
Contributor

@saireddythfc saireddythfc commented Apr 12, 2025

  1. Modified the _collection_configs_from_json and _collection_configs_simple_from_json functions in weaviate/collections/classes/config_methods.py to sort the dictionaries by key before returning them.

  2. Added unit tests in test/collection/test_collections_sorting.py to verify the sorting functionality.

  3. Added integration tests in integration/test_collections_sorting.py to verify the sorting in a real environment.

Copy link
Copy Markdown

@orca-security-eu orca-security-eu Bot left a comment

Choose a reason for hiding this comment

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

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

@saireddythfc
Copy link
Copy Markdown
Contributor Author

  1. Modified the _collection_configs_from_json and _collection_configs_simple_from_json functions in weaviate/collections/classes/config_methods.py to sort the dictionaries by key before returning them.

  2. Added unit tests in test/collection/test_collections_sorting.py to verify the sorting functionality.

  3. Added integration tests in integration/test_collections_sorting.py to verify the sorting in a real environment.

@weaviate-git-bot
Copy link
Copy Markdown

To avoid any confusion in the future about your contribution to Weaviate, we work with a Contributor License Agreement. If you agree, you can simply add a comment to this PR that you agree with the CLA so that we can merge.

beep boop - the Weaviate bot 👋🤖

PS:
Are you already a member of the Weaviate Slack channel?

@tsmith023
Copy link
Copy Markdown
Collaborator

Hi @saireddythfc, thanks for the contribution! Looks like the linter needs to be ran on your code, we use black and flake8, plus the test you've introduced is not scoped for pytest appropriately. Otherwise, the changes look good! Once you fix the tests, I'll give the PR a formal review 😁

@saireddythfc
Copy link
Copy Markdown
Contributor Author

Update:

  1. Fixed name collision occurring in integration test (client -> sorting_test_client).
  2. Changed pytest fixture from module to function.
  3. Manually ran black linter before pre-commit did its task on commit.

@saireddythfc
Copy link
Copy Markdown
Contributor Author

saireddythfc commented Apr 15, 2025

Update:

  1. Fixed unused pytest import

@tsmith023 any chance of a formal review?

Copy link
Copy Markdown
Collaborator

@tsmith023 tsmith023 left a comment

Choose a reason for hiding this comment

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

Implementation LGTM, just the test needs fixing imo!

Comment thread integration/test_collections_sorting.py Outdated
@saireddythfc saireddythfc requested a review from tsmith023 April 19, 2025 19:37
Copy link
Copy Markdown
Collaborator

@tsmith023 tsmith023 left a comment

Choose a reason for hiding this comment

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

LGTM now 😁 The only thing left is the linter complaining about a docstring!

integration/test_collections_sorting.py:15:1: D202 No blank lines allowed after function docstring

Once fixed, I'll merge

Fixed extra spacing after docstring
@saireddythfc
Copy link
Copy Markdown
Contributor Author

I agree to the CLA shown by @weaviate-git-bot

@tsmith023 tsmith023 merged commit b1395c5 into weaviate:main Apr 24, 2025
55 of 56 checks passed
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.

3 participants