Проблема: ghcr.io/fission/python-env v3 вызывает userfunc() без аргументов. Пользователи пишут def main(event, context) (AWS Lambda стиль) — получают: TypeError: main() missing 2 required positional arguments: 'event' and 'context' Это НЕ ошибка пользователя. Fission просто не реализует Lambda-конвенцию. demo.py: временно исправлен на event=None, context=None. План: собрать naeel/console-python-env с патчем inspect.signature чтобы любая сигнатура main() работала автоматически. Подробнее: doc/plans/console-python-env-fix-2026-05-04.md
1.5 KiB
1.5 KiB
Plan: console-python-env — fix function call signature
Date: 2026-05-04
Problem
Fission Python env v3 calls user function as userfunc() with no arguments
(Flask URL path params only, empty for parameterless routes).
Users writing def main(event, context) (AWS Lambda style) get:
TypeError: main() missing 2 required positional arguments: 'event' and 'context'
This is a real limitation of ghcr.io/fission/python-env — it never supported
Lambda-style signatures. The user code is valid Python, the env is inflexible.
Solution
Build custom naeel/console-python-env based on ghcr.io/fission/python-env.
Patch server.py: before calling userfunc, use inspect.signature to count
required positional args, fill them with None if Fission passes fewer.
Supported signatures after fix:
def main()— standard Fissiondef main(event, context)— AWS Lambda style (event=None, context=None)def main(request)— single-arg style (request=None)def main(*args, **kwargs)— variadic, works as before
Steps
- Get
server.pyfrom running pod - Apply inspect patch to
userfunc_call - Write Dockerfile:
FROM ghcr.io/fission/python-env, COPY patched server.py - Build
naeel/console-python-env:v1.0 - Push to Docker Hub
- Update Environment CRD
console-python-envin k8s → new runtime image - Restart poolmgr pod for that env
- Test
aa1withdef main(event, context)from archive
Documentation (after fix)
Add to user docs: supported function signatures for Fission Python env.