Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept search attributes for dev server #562

Merged
merged 3 commits into from
Feb 7, 2025

Conversation

cretz
Copy link
Member

@cretz cretz commented Jun 26, 2024

What was changed

Checklist

  1. Closes [Feature Request] Accept search attributes in dev server startup #558

@cretz cretz requested a review from a team as a code owner June 26, 2024 14:38
@cretz
Copy link
Member Author

cretz commented Jun 26, 2024

There is an issue with the dev server using search attributes, currently blocked on temporalio/temporal#6195. Leaving as draft for now.

@cretz cretz marked this pull request as draft June 26, 2024 15:50
@cretz cretz force-pushed the dev-server-search-attributes branch from 985fff0 to e31a280 Compare July 3, 2024 19:06
@cretz
Copy link
Member Author

cretz commented Feb 3, 2025

Now that CLI has been released with newer server, this is now ready for review

@cretz cretz marked this pull request as ready for review February 3, 2025 20:38
Copy link
Contributor

@mjameswh mjameswh left a comment

Choose a reason for hiding this comment

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

Finally!

@@ -91,6 +91,7 @@ async def start_local(
download_dest_dir: Optional[str] = None,
ui: bool = False,
runtime: Optional[temporalio.runtime.Runtime] = None,
search_attributes: Sequence[temporalio.common.SearchAttributeKey] = [],
Copy link
Contributor

Choose a reason for hiding this comment

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

This and existing parameters are violating no-mutable-defaults.

Copy link
Member Author

@cretz cretz Feb 6, 2025

Choose a reason for hiding this comment

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

I am not aware of this rule on our codebase, is it new? We don't mutate this parameter but Python is not expressive enough to mark a list as immutable. It is an immutable default despite Python's lack of expressiveness. I wouldn't expect such a rule (even if it's not smart enough to know this isn't a mutable default) to affect whether the PR is approved.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's a standard rule in Python that default argument values shouldn't be mutable, e.g.

https://google.github.io/styleguide/pyguide.html#2124-decision
https://docs.astral.sh/ruff/rules/mutable-argument-default/

We can fix the existing examples in a separate PR, but let's not add more violations in this PR.

Copy link
Member Author

@cretz cretz Feb 6, 2025

Choose a reason for hiding this comment

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

I disagree, I think we should be consistent with what's there and not institute new rules after PRs are opened. We can change the consistency in one fell swoop, but don't need to hold up new PRs trying to be consistent I don't think. This is brand new news that we are now blocking PRs for these rules.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, I mean, you'd only have to change it from [] to () 😄 But I agree we don't want to confuse this PR with purging the codebase of all existing violations. I've never worked in a Python codebase that doesn't enforce that rule. Opened #762

Copy link
Member Author

@cretz cretz Feb 7, 2025

Choose a reason for hiding this comment

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

Ah, that is simple enough, I will make that change. I do wish the rule was to not mutate a parameter with a mutable default instead of just not having a mutable default, but unfortunately Python and its tooling can't really check that well.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

@cretz cretz merged commit acde42c into temporalio:main Feb 7, 2025
13 checks passed
@cretz cretz deleted the dev-server-search-attributes branch February 7, 2025 13:59
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.

[Feature Request] Accept search attributes in dev server startup
3 participants