Skip to content

feat: V2 library worker #1706

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

Open
wants to merge 11 commits into
base: dev
Choose a base branch
from
Open

feat: V2 library worker #1706

wants to merge 11 commits into from

Conversation

hallvictoria
Copy link
Contributor

@hallvictoria hallvictoria commented Jun 30, 2025

Description

Adds V2 library worker code.

Sample official build: https://dev.azure.com/azfunc/internal/_build/results?buildId=226215&view=results

Fixes #


Pull Request Checklist

Host-Worker Contract

  • Does this PR impact the host-worker contract (e.g., gRPC messages, shared interfaces)?
    • If yes, have the changes been applied to:
      • azure_functions_worker (Python <= 3.12)
      • proxy_worker (Python >= 3.13)
    • If no, please explain why:

Worker Execution Logic

  • Does this PR affect worker execution logic (e.g., function invocation, bindings, lifecycle)?
    If yes, please answer the following:

Python Version Coverage

  • Does this change apply to both Python <=3.12 and 3.13+?
  • If yes, have the changes been made to:
    • azure_functions_worker (Python <= 3.12)
    • azure_functions_worker_v1 / azure_functions_worker_v2 (Python >= 3.13)
  • If no, please explain why:

Programming Model Compatibility (for Python 3.13+)

  • Does this change apply to both:
    • V1 programming model (azure_functions_worker_v1)?
    • V2 programming model (azure_functions_worker_v2)?
  • Explanation (if limited to one model):

@hallvictoria hallvictoria marked this pull request as ready for review July 2, 2025 19:06
"grpcio~=1.70.0",
"grpcio-tools~=1.70.0",
"pytest-sugar",
"opentelemetry-api", # Used for OpenTelemetry unit tests
Copy link
Contributor

Choose a reason for hiding this comment

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

check if azure-monitor-opentelemetry installs opentelemetry-api. If it does then this can be removed

]

[project.urls]
Documentation = "https://github.com/Azure/azure-functions-python-worker/blob/hallvictoria/library-worker/README.md"
Copy link
Contributor

Choose a reason for hiding this comment

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

This is pointing to your branch

| Runtime | Script Host & Language Extensibility | [File an Issue](https://github.com/Azure/azure-functions-host/issues) |
| VSCode | VSCode Extension for Azure Functions | [File an Issue](https://github.com/microsoft/vscode-azurefunctions/issues) |
| Core Tools | Command Line Interface for Local Development | [File an Issue](https://github.com/Azure/azure-functions-core-tools/issues) |
| Portal | User Interface or Experience Issue | [File an Issue](https://github.com/azure/azure-functions-ux/issues) |
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove the portal item. The repo does not exist

| Item | Description | Link |
|---------------|----------------------------------------------|--------------------------------------------------------------------------------|
| Python Worker | Programming Model, Triggers & Bindings | [File an Issue](https://github.com/Azure/azure-functions-python-worker/issues) |
| Linux | Base Docker Images | [File an Issue](https://github.com/Azure/azure-functions-docker/issues) |
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be removed

from .utils.tracing import serialize_exception
from .utils.validators import validate_script_file_name

metadata_result: Optional[List] = None
Copy link
Contributor

Choose a reason for hiding this comment

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

add the _ for all variables.

return is_false_like(os.environ[env_key])


def get_app_setting(
Copy link
Contributor

Choose a reason for hiding this comment

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

We have an app setting manager. Can we move this there?

Copy link
Contributor

Choose a reason for hiding this comment

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

Or somehow combine both?

@@ -0,0 +1,295 @@
# type: ignore
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add this as a dependency?



@attach_message_to_exception(
expt_type=ImportError,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this needs to be fixed. It does not catch ModuleNotFound errors

@@ -0,0 +1,2 @@
# Required dependencies listed in pyproject.toml
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this file?

jobs:
- template: /eng/templates/jobs/build.yml@self
parameters:
PYTHON_VERSION: '3.11'
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you use 3.13?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants