-
Notifications
You must be signed in to change notification settings - Fork 23
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
Unified task runner scripts #1086
Conversation
40e3009
to
693fc25
Compare
hmm, given that we don't treat the examples as modules but rather self-contained scripts, I'm unsure why we'd need |
examples/http_proxy/http_proxy.py
Outdated
@@ -3,10 +3,10 @@ | |||
a simple http proxy example |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the purpose of this name change?
@@ -1,10 +1,10 @@ | |||
#!/usr/bin/env python3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here... these are not modules... the name changes here are neither required nor in any way beneficial... and we risk breaking any links pointing to those examples from any external locations... please, let's not rename them unless we have a very good reason
from yapapi.log import enable_default_logger | ||
from yapapi.payload import vm | ||
from yapapi.rest.activity import BatchTimeoutError | ||
from yapapi import windows_event_loop_fix # noqa: E402 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can probably remove windows_event_loop_fix
once we drop support for Python < 3.8
@@ -262,14 +258,15 @@ async def _request_handler(self, request: web.Request) -> web.Response: | |||
return await instance.handle_request(request) | |||
|
|||
async def run(self): | |||
"""Run a local HTTP server. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, it's not just any HTTP server...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Run a local HTTP proxy server.
@@ -199,14 +199,14 @@ def __repr__(self): | |||
|
|||
@property | |||
def app_key(self): | |||
"""The application key used to authorize access to `yagna`'s REST API.""" | |||
"""Return the application key used to authorize access to `yagna`'s REST API.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, it's not a function ... it's a property... I believe it should be a noun-like not an action-like...
return ( | ||
self.service.cluster.service_runner._job.engine._api_config.app_key # type: ignore[union-attr] # noqa | ||
) | ||
|
||
@property | ||
def instance_ws(self): | ||
"""The websocket URI for the specific remote port of the Service.""" | ||
"""Return the websocket URI for the specific remote port of the Service.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here...
@@ -181,39 +172,39 @@ async def __aexit__(self, *exc_info) -> None: | |||
|
|||
@property | |||
def owner_ip(self) -> str: | |||
"""The IP address of the requestor node within the network.""" | |||
"""Return the IP address of the requestor node within the network.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again, these are properties, not methods... their docstrings should reflect that...
@@ -44,27 +42,27 @@ def app_key(self) -> str: | |||
|
|||
@property | |||
def market_url(self) -> str: | |||
"""The URL of the Market REST API""" | |||
"""Return URL of the Market REST API.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and again, in case of properties, I believe the docstrings should be formed just as they would be for attributes rather than functions...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert the directory name changes in the examples
part... unless there's a critical reason to do that
Otherwise, I strongly believe the properties' docstrings should be phrased just as they would be in case of regular attributes rather than functions -> especially that once you receive them, they behave so -> you cannot call them for them to perform their function, you get what the docstring says you'd get, so, e.g.
Regarding Regarding property docs - change was made to satisfy pydocstyle - should we fight with this? |
8196772
to
40c43e8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay, let's say it looks good...
I'd still strongly prefer the properties' docs to be specified using noun-like constructs and not action-like ones but I don't feel this is worth arguing about...
Co-authored-by: shadeofblue <blue@wave460.net>
8d7661a
to
4b68e01
Compare
Bucke up folks, massive diff is comming!
What I've done:
mypy
version to be able to install other dependenciespyproject-autoflake
because for some reason at current setupautoflake
was not picking up config frompyproject.toml
flake8
errors and fewmypy
paths, this should be done as separate work__init__.py
files into examples and tests to satisfymypy
.mypy
(as they are now python packages).Changes are mostly related to formatting or small fixes such as specifying exception types in
except
blocks, changing==
tois
forNone
values, etc.