Skip to content

Python 3.6 baggage code removal #1419

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

Merged
merged 9 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dockerfile": "Dockerfile",
"context": "..",
"args": {
// Update 'VARIANT' to pick a Python version: 3, 3.10, 3.9, 3.8, 3.7, 3.6
// Update 'VARIANT' to pick a Python version: 3, 3.10, 3.9, 3.8, 3.7
// Append -bullseye or -buster to pin to an OS version.
// Use -bullseye variants on local on arm64/Apple Silicon.
"VARIANT": "3.9",
Expand Down
87 changes: 0 additions & 87 deletions azure_functions_worker/_thirdparty/aio_compat.py

This file was deleted.

14 changes: 3 additions & 11 deletions azure_functions_worker/dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,6 @@

_TRUE = "true"

"""In Python 3.6, the current_task method was in the Task class, but got moved
out in 3.7+ and fully removed in 3.9. Thus, to support 3.6 and 3.9 together, we
need to switch the implementation of current_task for 3.6.
"""
_CURRENT_TASK = asyncio.Task.current_task \
if (sys.version_info[0] == 3 and sys.version_info[1] == 6) \
else asyncio.current_task


class DispatcherMeta(type):
__current_dispatcher__ = None
Expand Down Expand Up @@ -446,7 +438,7 @@ async def _handle__invocation_request(self, request):

# Set the current `invocation_id` to the current task so
# that our logging handler can find it.
current_task = _CURRENT_TASK(self._loop)
current_task = asyncio.current_task(self._loop)
assert isinstance(current_task, ContextEnabledTask)
current_task.set_azure_invocation_id(invocation_id)

Expand Down Expand Up @@ -860,7 +852,7 @@ class ContextEnabledTask(asyncio.Task):
def __init__(self, coro, loop):
super().__init__(coro, loop=loop)

current_task = _CURRENT_TASK(loop)
current_task = asyncio.current_task(loop)
if current_task is not None:
invocation_id = getattr(
current_task, self.AZURE_INVOCATION_ID, None)
Expand All @@ -874,7 +866,7 @@ def set_azure_invocation_id(self, invocation_id: str) -> None:
def get_current_invocation_id() -> Optional[str]:
loop = asyncio._get_running_loop()
if loop is not None:
current_task = _CURRENT_TASK(loop)
current_task = asyncio.current_task(loop)
if current_task is not None:
task_invocation_id = getattr(current_task,
ContextEnabledTask.AZURE_INVOCATION_ID,
Expand Down
4 changes: 2 additions & 2 deletions azure_functions_worker/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ def main():
DependencyManager.initialize()
DependencyManager.use_worker_dependencies()

import asyncio
from . import logging
from ._thirdparty import aio_compat
from .logging import error_logger, logger, format_exception

args = parse_args()
Expand All @@ -57,7 +57,7 @@ def main():
args.worker_id, args.request_id, args.host, args.port)

try:
return aio_compat.run(start_async(
return asyncio.run(start_async(
args.host, args.port, args.worker_id, args.request_id))
except Exception as ex:
error_logger.exception(
Expand Down
8 changes: 4 additions & 4 deletions azure_functions_worker/utils/dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,20 @@ class DependencyManager:
Linux Consumption sys.path: [
"/tmp/functions\\standby\\wwwroot", # Placeholder folder
"/home/site/wwwroot/.python_packages/lib/site-packages", # CX's deps
"/azure-functions-host/workers/python/3.6/LINUX/X64", # Worker's deps
"/azure-functions-host/workers/python/3.11/LINUX/X64", # Worker's deps
"/home/site/wwwroot" # CX's Working Directory
]

Linux Dedicated/Premium sys.path: [
"/home/site/wwwroot", # CX's Working Directory
"/home/site/wwwroot/.python_packages/lib/site-packages", # CX's deps
"/azure-functions-host/workers/python/3.6/LINUX/X64", # Worker's deps
"/azure-functions-host/workers/python/3.11/LINUX/X64", # Worker's deps
]

Core Tools sys.path: [
"%appdata%\\azure-functions-core-tools\\bin\\workers\\"
"python\\3.6\\WINDOWS\\X64", # Worker's deps
"C:\\Users\\user\\Project\\.venv38\\lib\\site-packages", # CX's deps
"python\\3.11\\WINDOWS\\X64", # Worker's deps
"C:\\Users\\user\\Project\\.venv311\\lib\\site-packages", # CX's deps
"C:\\Users\\user\\Project", # CX's Working Directory
]

Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Azure Functions for Python
Requirements
============

Azure Functions for Python support Python 3.6 or later.
Azure Functions for Python support Python 3.7 or later.


Programming Model
Expand Down
26 changes: 0 additions & 26 deletions pack/Microsoft.Azure.Functions.V2.PythonWorker.nuspec

This file was deleted.

34 changes: 0 additions & 34 deletions pack/Microsoft.Azure.Functions.V3.PythonWorker.nuspec

This file was deleted.

12 changes: 0 additions & 12 deletions python/prodV2/worker.config.json

This file was deleted.

86 changes: 0 additions & 86 deletions python/prodV2/worker.py

This file was deleted.

12 changes: 0 additions & 12 deletions python/prodV3/worker.config.json

This file was deleted.

Loading