Python SDK / Runtime: Suggestion for improving Environments, non-cloudevent types
rabejens opened this issue · 2 comments
rabejens commented
The current Python SDK has a number of shortcomings. It uses an outdated version of Python and it is cumbersome to add your own environment. Not many people use bare-bones Python today.
I suggest the following enhancements:
- Specify Python version and packages to use with Conda or requirements.txt
- The buildpack should detect presence of an
environment.y(a)?ml
and create an env for it - Or, if only
requirements.txt
and an optionalpip.conf
is there, it could use an environment variable likeBP_PYTHON_VERSION
to specify the Python to use and build the environment from requirements.txtenvironment.yml
supports using pip by specifying apip
section:dependencies: - pip - pip: - --some-pip-option - --some-other-pip-option - some-package - some-other-package>41.0,<43.0
- With this, the builder could create a temporary
environment.yml
fromrequirements.txt
and also use conda / mamba (which is faster) to build the env
- The env can then either be compressed and uncompressed to the same location on the target container, or one could use
conda-pack
but that might cause some problems. - The builder should also implicitly add dependencies to additional libraries needed when running the func (i.e., HTTP server, CloudEvents library)
- The buildpack should detect presence of an
- Ease the use of plain JSON (non-cloudevents)
- Python has a concept called dataclasses that can easily be serialized to/from JSON
lkingland commented
Thank you for these suggestions. An update to the Python middleware is currently in progress, so thank you for your helpful suggestions.
github-actions commented
This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with /reopen
. Mark the issue as
fresh by adding the comment /remove-lifecycle stale
.