Skip to content

Commit 3dd54af

Browse files
authored
Python 3.6 baggage code removal (#1419)
* removing refs to 3.6 * flake * feedback * removed aio_compat * setup cfg * venv311
1 parent 5f352af commit 3dd54af

19 files changed

+29
-403
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"dockerfile": "Dockerfile",
77
"context": "..",
88
"args": {
9-
// Update 'VARIANT' to pick a Python version: 3, 3.10, 3.9, 3.8, 3.7, 3.6
9+
// Update 'VARIANT' to pick a Python version: 3, 3.10, 3.9, 3.8, 3.7
1010
// Append -bullseye or -buster to pin to an OS version.
1111
// Use -bullseye variants on local on arm64/Apple Silicon.
1212
"VARIANT": "3.9",

azure_functions_worker/_thirdparty/aio_compat.py

Lines changed: 0 additions & 87 deletions
This file was deleted.

azure_functions_worker/dispatcher.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,6 @@
4545

4646
_TRUE = "true"
4747

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

5749
class DispatcherMeta(type):
5850
__current_dispatcher__ = None
@@ -446,7 +438,7 @@ async def _handle__invocation_request(self, request):
446438

447439
# Set the current `invocation_id` to the current task so
448440
# that our logging handler can find it.
449-
current_task = _CURRENT_TASK(self._loop)
441+
current_task = asyncio.current_task(self._loop)
450442
assert isinstance(current_task, ContextEnabledTask)
451443
current_task.set_azure_invocation_id(invocation_id)
452444

@@ -860,7 +852,7 @@ class ContextEnabledTask(asyncio.Task):
860852
def __init__(self, coro, loop):
861853
super().__init__(coro, loop=loop)
862854

863-
current_task = _CURRENT_TASK(loop)
855+
current_task = asyncio.current_task(loop)
864856
if current_task is not None:
865857
invocation_id = getattr(
866858
current_task, self.AZURE_INVOCATION_ID, None)
@@ -874,7 +866,7 @@ def set_azure_invocation_id(self, invocation_id: str) -> None:
874866
def get_current_invocation_id() -> Optional[str]:
875867
loop = asyncio._get_running_loop()
876868
if loop is not None:
877-
current_task = _CURRENT_TASK(loop)
869+
current_task = asyncio.current_task(loop)
878870
if current_task is not None:
879871
task_invocation_id = getattr(current_task,
880872
ContextEnabledTask.AZURE_INVOCATION_ID,

azure_functions_worker/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ def main():
4545
DependencyManager.initialize()
4646
DependencyManager.use_worker_dependencies()
4747

48+
import asyncio
4849
from . import logging
49-
from ._thirdparty import aio_compat
5050
from .logging import error_logger, logger, format_exception
5151

5252
args = parse_args()
@@ -57,7 +57,7 @@ def main():
5757
args.worker_id, args.request_id, args.host, args.port)
5858

5959
try:
60-
return aio_compat.run(start_async(
60+
return asyncio.run(start_async(
6161
args.host, args.port, args.worker_id, args.request_id))
6262
except Exception as ex:
6363
error_logger.exception(

azure_functions_worker/utils/dependency.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,20 @@ class DependencyManager:
3535
Linux Consumption sys.path: [
3636
"/tmp/functions\\standby\\wwwroot", # Placeholder folder
3737
"/home/site/wwwroot/.python_packages/lib/site-packages", # CX's deps
38-
"/azure-functions-host/workers/python/3.6/LINUX/X64", # Worker's deps
38+
"/azure-functions-host/workers/python/3.11/LINUX/X64", # Worker's deps
3939
"/home/site/wwwroot" # CX's Working Directory
4040
]
4141
4242
Linux Dedicated/Premium sys.path: [
4343
"/home/site/wwwroot", # CX's Working Directory
4444
"/home/site/wwwroot/.python_packages/lib/site-packages", # CX's deps
45-
"/azure-functions-host/workers/python/3.6/LINUX/X64", # Worker's deps
45+
"/azure-functions-host/workers/python/3.11/LINUX/X64", # Worker's deps
4646
]
4747
4848
Core Tools sys.path: [
4949
"%appdata%\\azure-functions-core-tools\\bin\\workers\\"
50-
"python\\3.6\\WINDOWS\\X64", # Worker's deps
51-
"C:\\Users\\user\\Project\\.venv38\\lib\\site-packages", # CX's deps
50+
"python\\3.11\\WINDOWS\\X64", # Worker's deps
51+
"C:\\Users\\user\\Project\\.venv311\\lib\\site-packages", # CX's deps
5252
"C:\\Users\\user\\Project", # CX's Working Directory
5353
]
5454

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Azure Functions for Python
99
Requirements
1010
============
1111

12-
Azure Functions for Python support Python 3.6 or later.
12+
Azure Functions for Python support Python 3.7 or later.
1313

1414

1515
Programming Model

pack/Microsoft.Azure.Functions.V2.PythonWorker.nuspec

Lines changed: 0 additions & 26 deletions
This file was deleted.

pack/Microsoft.Azure.Functions.V3.PythonWorker.nuspec

Lines changed: 0 additions & 34 deletions
This file was deleted.

python/prodV2/worker.config.json

Lines changed: 0 additions & 12 deletions
This file was deleted.

python/prodV2/worker.py

Lines changed: 0 additions & 86 deletions
This file was deleted.

0 commit comments

Comments
 (0)