Skip to content

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

Open
erichare wants to merge 4 commits into
mainfrom
feat-with-alias
Open

feat: Switch set_ to with_ and add deprecated alias#410
erichare wants to merge 4 commits into
mainfrom
feat-with-alias

Conversation

@erichare
Copy link
Copy Markdown
Collaborator

@erichare erichare commented Jun 3, 2026

Supersedes #400 — rebased onto the latest main and recreated from a branch in datastax/astrapy (previously opened from my fork).

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.

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