Skip to content

Python: Add FUNCTION LIST command.#1738

Merged
acarbonetto merged 36 commits intovalkey-io:mainfrom
Bit-Quill:python/integ_cole_function-list
Jul 2, 2024
Merged

Python: Add FUNCTION LIST command.#1738
acarbonetto merged 36 commits intovalkey-io:mainfrom
Bit-Quill:python/integ_cole_function-list

Conversation

@Cole-Greer
Copy link
Copy Markdown
Contributor

@Cole-Greer Cole-Greer commented Jul 1, 2024

Issue #, if available: N/A

Description of changes:
https://redis.io/docs/latest/commands/function-list/

This is based off of the Java implementation from #1452

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@Cole-Greer Cole-Greer changed the title FUNCTION LIST tracer code Python: Add FUNCTION LIST command. Jul 1, 2024
@Yury-Fridlyand Yury-Fridlyand added the python 🐍 Python wrapper label Jul 1, 2024
library_name: Optional[str] = None,
with_code: bool = False,
route: Optional[Route] = None,
) -> List[Mapping[bytes, Any]]:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

  1. I guess you can use str for now (and for simplicity)
  2. Replace Any with a real type (union of union of union ...)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Looks like the exact return type should be List[Mapping[bytes, List[Mapping[bytes, Union[bytes, List[Mapping[bytes, Union[bytes, Set[bytes]]]]]]]]]. Is this preferred over List[Mapping[bytes, Any]]?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No idea 🤷

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I introduced TFunctionListResponse to constants.py to ease usage of this return type.

@Cole-Greer Cole-Greer marked this pull request as ready for review July 2, 2024 01:28
@Cole-Greer Cole-Greer requested a review from a team as a code owner July 2, 2024 01:28
Cole-Greer and others added 2 commits July 1, 2024 19:28
Co-authored-by: Yury-Fridlyand <yury.fridlyand@improving.com>
Cole-Greer and others added 3 commits July 1, 2024 19:34
Co-authored-by: Aaron <69273634+aaron-congo@users.noreply.github.com>
@acarbonetto acarbonetto merged commit b46591d into valkey-io:main Jul 2, 2024
@acarbonetto acarbonetto deleted the python/integ_cole_function-list branch July 2, 2024 17:16
cyip10 pushed a commit to Bit-Quill/valkey-glide that referenced this pull request Jul 16, 2024
* FUNCTION LIST tracer code

* update defaults

* fix type hints

* add tests

* add client tests

* update client tests with FUNCTION LIST

* fix formatting

* fix typing

* update typing

* typing updates

* fix formatting

* Apply suggestions from code review

Co-authored-by: Aaron <69273634+aaron-congo@users.noreply.github.com>

* update response type to use bytes instead of str

* formatting

* add routing to function list tests

* fix routing tests

* update routing tests

* fix tests

* formatting

* rename args, add docstrings, update tests

* formatting

* updated docstrings and tests

* changelog

* fix tests

* update type definitions

* Apply suggestions from code review

Co-authored-by: Yury-Fridlyand <yury.fridlyand@improving.com>

* update docstrings

* Apply suggestions from code review

Co-authored-by: Aaron <69273634+aaron-congo@users.noreply.github.com>

* minor cleanup

* black fixes

* fix typing

* update to use TEncodable

* introduce TFunctionListResponse to abstract away complex return type

---------

Co-authored-by: Aaron <69273634+aaron-congo@users.noreply.github.com>
Co-authored-by: Yury-Fridlyand <yury.fridlyand@improving.com>
Yury-Fridlyand added a commit to Bit-Quill/valkey-glide that referenced this pull request Jun 6, 2025
* FUNCTION LIST tracer code

* update defaults

* fix type hints

* add tests

* add client tests

* update client tests with FUNCTION LIST

* fix formatting

* fix typing

* update typing

* typing updates

* fix formatting

* Apply suggestions from code review

Co-authored-by: Aaron <69273634+aaron-congo@users.noreply.github.com>

* update response type to use bytes instead of str

* formatting

* add routing to function list tests

* fix routing tests

* update routing tests

* fix tests

* formatting

* rename args, add docstrings, update tests

* formatting

* updated docstrings and tests

* changelog

* fix tests

* update type definitions

* Apply suggestions from code review

Co-authored-by: Yury-Fridlyand <yury.fridlyand@improving.com>

* update docstrings

* Apply suggestions from code review

Co-authored-by: Aaron <69273634+aaron-congo@users.noreply.github.com>

* minor cleanup

* black fixes

* fix typing

* update to use TEncodable

* introduce TFunctionListResponse to abstract away complex return type

---------

Co-authored-by: Aaron <69273634+aaron-congo@users.noreply.github.com>
Co-authored-by: Yury-Fridlyand <yury.fridlyand@improving.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python 🐍 Python wrapper

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

5 participants