mattwelke commented on PR #128:
URL:
https://github.com/apache/openwhisk-runtime-python/pull/128#issuecomment-1188330486
Sure. I've done that now.
I think my approach here is adding a lot of repeated code, but I saw that
the current state of the repo already has code repeated this way (between 3.7
and 3.9) so I figured it wasn't a regression. In the future, maybe we could
look for opportunities to DRY it. I saw the Node.js runtime repo DRY'd pretty
well like this. Here, I'm sure there are opportunities like creating a base
Dockerfile to use, since the only thing changing is the version of the base
Python image used.
Maybe we could try to DRY the code during a 3.11 release. Or, if you'd
rather keep refactors separate from new features, it could be its own task.
Another thing I think could be improved in the runtime, also either during a
DRY refactor, or as its own new feature, is adding support for `async` main
functions. My testing so far showed it didn't work:
```
"2022-07-17T01:46:57.046916Z stderr: File
\"/usr/local/lib/python3.10/json/encoder.py\", line 179, in default",
"2022-07-17T01:46:57.046919Z stderr: raise TypeError(f'Object of type
{o.__class__.__name__} '",
"2022-07-17T01:46:57.046923Z stderr: TypeError: Object of type
coroutine is not JSON serializable",
"2022-07-17T01:46:57.049569Z stderr: sys:1: RuntimeWarning: coroutine
'main' was never awaited",
"2022-07-17T01:46:57.059Z stderr: The action did not initialize or
run as expected. Log data might be missing."
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]