feat: Switch set_ to with_ and add deprecated alias#400
Draft
erichare wants to merge 2 commits intodatastax:mainfrom
Draft
feat: Switch set_ to with_ and add deprecated alias#400erichare wants to merge 2 commits intodatastax:mainfrom
erichare wants to merge 2 commits intodatastax:mainfrom
Conversation
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.
Fixes #345
This pull request refactors the
CollectionDefinitionfluent interface to improve clarity and convey its immutable builder pattern. Allset_*methods have been renamed towith_*(e.g.,set_vector_dimension→with_vector_dimension) and deprecated aliases are provided for backward compatibility. Documentation and code examples throughout the codebase have been updated to match the new interface. These changes make the API more intuitive and signal that builder methods return new objects instead of mutating in place.Refactoring of the fluent interface:
set_*methods inCollectionDefinitiontowith_*, includingwith_indexing,with_default_id,with_vector_dimension,with_vector_metric,with_vector_source_model,with_vector_service,with_rerank, andwith_lexical. Deprecated the oldset_*methods, which will be removed in version 3.0.0. (astrapy/data/info/collection_descriptor.py, [1] [2] [3] [4] [5]Documentation and example updates:
README.md,astrapy/data/collection.py,astrapy/data/database.py,astrapy/client.py,astrapy/admin/admin.py, andastrapy/authentication.pyto use the newwith_*methods instead ofset_*. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25]Deprecation mechanism:
@deprecated_methoddecorator to mark oldset_*methods as deprecated, providing guidance on their replacement and versioning information. (astrapy/data/info/collection_descriptor.py, [1] [2] [3] [4] [5]These changes collectively modernize the builder API, improve code clarity, and ensure smooth migration for users.