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

Adds Ruff + makes corresponding fixes #263

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

hatchet-temporary
Copy link
Contributor

Adding ruff (super fast Python linter) and making corresponding fixes. Most of the fixes are just removing unused imports and variables, getting rid of assignments that don't get used, etc.

@@ -31,7 +31,6 @@
DEFAULT_ACTION_TIMEOUT = 600 # seconds


DEFAULT_ACTION_LISTENER_RETRY_INTERVAL = 5 # seconds
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is imported above, so either we should remove the import or remove this line

Copy link
Contributor

Choose a reason for hiding this comment

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

lets remove the import

@hatchet-temporary hatchet-temporary marked this pull request as ready for review November 22, 2024 17:36
Comment on lines -453 to +451
elif klass == object:
elif klass is object:
return self.__deserialize_object(data)
elif klass == datetime.date:
elif klass is datetime.date:
return self.__deserialize_date(data)
elif klass == datetime.datetime:
elif klass is datetime.datetime:
return self.__deserialize_datetime(data)
elif klass == decimal.Decimal:
elif klass is decimal.Decimal:
Copy link
Contributor Author

@hatchet-temporary hatchet-temporary Nov 22, 2024

Choose a reason for hiding this comment

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

I'm not sure about this one - the linter flagged it, but would like eyes on this!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

update: will probably revert this just to be safe


from dotenv import load_dotenv

from hatchet_sdk import Context, Hatchet
from hatchet_sdk.clients.admin import DedupeViolationErr
from hatchet_sdk.loader import ClientConfig

load_dotenv()
Copy link
Contributor

Choose a reason for hiding this comment

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

note for future: i personally dont like this here... i like how npm runs this in the process before running the example

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, you mean the load_dotenv? I think we'd benefit from using Pydantic Settings (Pydantic everywhere!) in the examples: https://docs.pydantic.dev/latest/concepts/pydantic_settings/#dotenv-env-support

@@ -31,7 +31,6 @@
DEFAULT_ACTION_TIMEOUT = 600 # seconds


DEFAULT_ACTION_LISTENER_RETRY_INTERVAL = 5 # seconds
Copy link
Contributor

Choose a reason for hiding this comment

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

lets remove the import

Copy link
Contributor

Choose a reason for hiding this comment

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

im not sure myself, but should we expose these if the user hits this case?

@@ -1 +1 @@
from .context import Context
from .context import Context as Context
Copy link
Contributor

Choose a reason for hiding this comment

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

whats thsi?

@@ -188,7 +188,6 @@ def cleanup_subscription(self, subscription_id: int):
del self.events[subscription_id]

async def subscribe(self, workflow_run_id: str):
init_producer: asyncio.Task = None
Copy link
Contributor

Choose a reason for hiding this comment

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

assuming this removed because its unused, but double check

@@ -11,10 +11,6 @@
from hatchet_sdk.clients.workflow_listener import PooledWorkflowRunListener
from hatchet_sdk.context.worker_context import WorkerContext
from hatchet_sdk.contracts.dispatcher_pb2 import OverridesData
from hatchet_sdk.contracts.workflows_pb2 import (
Copy link
Contributor

Choose a reason for hiding this comment

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

i think where exposing these here for folks to import in a convenient way ... should be type hinted below

@@ -39,7 +39,7 @@ def __post_init__(self):
self.start()

def start(self, retry_count=1):
k = self.loop.create_task(self.async_start(retry_count))
self.loop.create_task(self.async_start(retry_count))
Copy link
Contributor

Choose a reason for hiding this comment

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

i think we had some issues with "no ref to future" without the k and this at least silenced it... not sure what the right way of doing this is/if its not an issue

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.

2 participants