Skip to content
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

[WIP] Python Middleware v2 Scaffolding #2685

Open
wants to merge 34 commits into
base: main
Choose a base branch
from

Conversation

lkingland
Copy link
Member

@lkingland lkingland commented Feb 4, 2025

Changes

  • 🎁 Host builder now supports Python Functions

  • 🎁 Can now func run Python Functions locally outside of a container (no container runtime required)

  • 🎁 Python Functions now suppport instanced method signatures

  • 🎁 Python Functions now support lifecycle events (start, stop, readiness, liveness)

  • 🎁 Updates Python Template Tests to use pytest

  • 🎁 Python Functions now use the ASGI Spec and run using an ASGI optimized server

  • 🎁 adds support for base images to the OCI builder

  • 🧹 Cleans up .gitignore

  • 🧹 Cleans up and simplifies the OCI builder

  • 🧹 Cleans up and simplifies the repository management code

  • 🧹 removes broken interactive prompts from the run command pending forthcoming UX update

/kind enhancement

Fixes #

Release Note

Python Functions now use the ASGI specification for method signature.
Python Functions now support instances and lifecycle events.  See the new templates for details.
The Host builder now can build and run Python functions locally without a container.

Docs


Copy link

knative-prow bot commented Feb 4, 2025

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@knative-prow knative-prow bot added kind/enhancement do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Feb 4, 2025
Copy link

knative-prow bot commented Feb 4, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lkingland

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow bot requested review from jrangelramos and rhuss February 4, 2025 13:39
@knative-prow knative-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 4, 2025
@knative-prow-robot knative-prow-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 4, 2025
@knative-prow knative-prow bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Feb 4, 2025
@matzew
Copy link
Member

matzew commented Feb 7, 2025

nice for getting this started

@lkingland lkingland force-pushed the scaffolding-python branch from ec91040 to 182c74c Compare March 4, 2025 07:00
@lkingland lkingland force-pushed the scaffolding-python branch from b813d8c to 269a8b2 Compare March 6, 2025 09:57
@knative-prow-robot knative-prow-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 6, 2025
Copy link

codecov bot commented Mar 6, 2025

Codecov Report

Attention: Patch coverage is 9.14761% with 874 lines in your changes missing coverage. Please review.

Project coverage is 44.64%. Comparing base (90624a8) to head (12aeace).
Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
pkg/oci/builder.go 0.47% 632 Missing ⚠️
pkg/oci/python_builder.go 0.00% 132 Missing ⚠️
pkg/functions/runner.go 0.00% 58 Missing ⚠️
pkg/oci/go_builder.go 0.00% 25 Missing ⚠️
pkg/scaffolding/detectors.go 0.00% 8 Missing ⚠️
pkg/functions/repository.go 89.06% 5 Missing and 2 partials ⚠️
pkg/builders/s2i/assemblers.go 50.00% 4 Missing ⚠️
pkg/scaffolding/scaffold.go 25.00% 2 Missing and 1 partial ⚠️
cmd/run.go 87.50% 1 Missing and 1 partial ⚠️
pkg/oci/pusher.go 0.00% 2 Missing ⚠️
... and 1 more

❗ There is a different number of reports uploaded between BASE (90624a8) and HEAD (12aeace). Click for more details.

HEAD has 5 uploads less than BASE
Flag BASE (90624a8) HEAD (12aeace)
1 0
unit-tests-macos-latest 1 0
unit-tests-ubuntu-latest 1 0
integration-tests 1 0
unit-tests-windows-latest 1 0
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2685       +/-   ##
===========================================
- Coverage   62.58%   44.64%   -17.94%     
===========================================
  Files         131      110       -21     
  Lines       15598    15114      -484     
===========================================
- Hits         9762     6748     -3014     
- Misses       4908     7530     +2622     
+ Partials      928      836       -92     
Flag Coverage Δ
e2e-test 34.98% <8.41%> (-0.95%) ⬇️
e2e-test-oncluster 33.35% <7.90%> (+0.57%) ⬆️
e2e-test-oncluster-runtime 27.96% <7.69%> (?)
e2e-test-runtime-go 25.92% <8.41%> (?)
e2e-test-runtime-node 25.34% <8.00%> (?)
e2e-test-runtime-quarkus 25.46% <8.00%> (?)
e2e-test-runtime-rust 24.43% <7.69%> (?)
e2e-test-runtime-springboot 24.45% <7.69%> (?)
e2e-test-runtime-typescript 25.42% <8.00%> (?)
integration-tests ?
unit-tests-macos-latest ?
unit-tests-ubuntu-latest ?
unit-tests-windows-latest ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@knative-prow-robot knative-prow-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 6, 2025
@lkingland lkingland force-pushed the scaffolding-python branch from 7f8f2a8 to 7cd0cc6 Compare March 7, 2025 04:05
@lkingland lkingland marked this pull request as ready for review March 13, 2025 14:01
@knative-prow-robot knative-prow-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 17, 2025
Copy link

knative-prow bot commented Mar 17, 2025

@lkingland: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
unit-tests_func_main 12aeace link true /test unit-tests

Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.


client := fn.New(fn.WithVerbose(true))

f, err := client.Init(fn.Function{Root: root, Runtime: "python"})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the unit test is failing on this

--- FAIL: TestBuilder_BuildPython (0.72s)
    builder_test.go:68: exec: "python": executable file not found in $PATH

I guess the CI server does need updates?

@knative-prow-robot
Copy link

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@knative-prow-robot knative-prow-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/enhancement needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants