Skip to content

feat: Switch set_ to with_ and add deprecated alias#400

Closed
erichare wants to merge 5 commits into
datastax:mainfrom
erichare:feat-with-alias
Closed

feat: Switch set_ to with_ and add deprecated alias#400
erichare wants to merge 5 commits into
datastax:mainfrom
erichare:feat-with-alias

Conversation

@erichare

Copy link
Copy Markdown
Collaborator

Fixes #345

This pull request refactors the CollectionDefinition fluent interface to improve clarity and convey its immutable builder pattern. All set_* methods have been renamed to with_* (e.g., set_vector_dimensionwith_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:

  • Renamed all set_* methods in CollectionDefinition to with_*, including with_indexing, with_default_id, with_vector_dimension, with_vector_metric, with_vector_source_model, with_vector_service, with_rerank, and with_lexical. Deprecated the old set_* 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:

Deprecation mechanism:

  • Introduced the @deprecated_method decorator to mark old set_* 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.

@erichare erichare marked this pull request as ready for review March 10, 2026 18:19
@erichare erichare requested a review from sl-at-ibm March 10, 2026 18:19
@erichare

erichare commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator Author

Superseded by #410 — rebased onto the latest main (resolved the CHANGES conflict) and moved to a branch in datastax/astrapy (instead of my fork). Closing in favor of that PR.

@erichare erichare closed this Jun 3, 2026
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.

Alias set to with in fluent interfaces

1 participant