func
func copied to clipboard
Python SDK / Runtime: Suggestion for improving Environments, non-cloudevent types
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)?mland create an env for it - Or, if only
requirements.txtand an optionalpip.confis there, it could use an environment variable likeBP_PYTHON_VERSIONto specify the Python to use and build the environment from requirements.txtenvironment.ymlsupports using pip by specifying apipsection: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.ymlfromrequirements.txtand 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-packbut 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
Thank you for these suggestions. An update to the Python middleware is currently in progress, so thank you for your helpful suggestions.
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.