diff --git a/.github/workflows/ci_e2e_workflow.yml b/.github/workflows/ci_e2e_workflow.yml index 006f8b466..5575f56b8 100644 --- a/.github/workflows/ci_e2e_workflow.yml +++ b/.github/workflows/ci_e2e_workflow.yml @@ -6,9 +6,9 @@ name: CI E2E tests on: workflow_dispatch: push: - branches: [ dev, master, main, release/* ] + branches: [ "*dev", master, main, release/* ] pull_request: - branches: [ dev, master, main, release/* ] + branches: [ "*dev", master, main, release/* ] schedule: # Monday to Thursday 1 AM PDT build # * is a special character in YAML so you have to quote this string diff --git a/.github/workflows/ut_ci_workflow.yml b/.github/workflows/ut_ci_workflow.yml index 6fc13a455..fb0a2c0a2 100644 --- a/.github/workflows/ut_ci_workflow.yml +++ b/.github/workflows/ut_ci_workflow.yml @@ -4,14 +4,14 @@ name: CI Unit tests on: + workflow_dispatch: schedule: # Monday to Thursday 1 AM PDT build # * is a special character in YAML so you have to quote this string - cron: "0 8 * * 1,2,3,4" push: - branches: [ dev, master, main, release/* ] pull_request: - branches: [ dev, master, main, release/* ] + branches: [ "*dev", master, main, release/* ] jobs: build: diff --git a/README.md b/README.md index ff526c582..3cf711d4b 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # Functions Header Image - Lightning Logo Azure Functions Python Worker -|Branch|Status|CodeCov|Unittests|E2E tests| -|---|---|---|---|---| -|master|[![Build Status](https://azfunc.visualstudio.com/Azure%20Functions/_apis/build/status/Azure.azure-functions-python-worker?branchName=master)](https://azfunc.visualstudio.com/Azure%20Functions/_build/latest?definitionId=57&branchName=master)|[![codecov](https://codecov.io/gh/Azure/azure-functions-python-worker/branch/master/graph/badge.svg)](https://codecov.io/gh/Azure/azure-functions-python-worker)|![CI Unit tests](https://github.com/Azure/azure-functions-python-worker/workflows/CI%20Unit%20tests/badge.svg?branch=master)|![CI E2E tests](https://github.com/Azure/azure-functions-python-worker/workflows/CI%20E2E%20tests/badge.svg?branch=master) -|dev|[![Build Status](https://azfunc.visualstudio.com/Azure%20Functions/_apis/build/status/Azure.azure-functions-python-worker?branchName=dev)](https://azfunc.visualstudio.com/Azure%20Functions/_build/latest?definitionId=57&branchName=dev)|[![codecov](https://codecov.io/gh/Azure/azure-functions-python-worker/branch/dev/graph/badge.svg)](https://codecov.io/gh/Azure/azure-functions-python-worker)|![CI Unit tests](https://github.com/Azure/azure-functions-python-worker/workflows/CI%20Unit%20tests/badge.svg?branch=dev)|![CI E2E tests](https://github.com/Azure/azure-functions-python-worker/workflows/CI%20E2E%20tests/badge.svg?branch=dev) +| Branch | Status | CodeCov | Unittests | E2E tests | +|--------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------| +| main | [![Build Status](https://azfunc.visualstudio.com/Azure%20Functions/_apis/build/status/Azure.azure-functions-python-worker?branchName=main)](https://azfunc.visualstudio.com/Azure%20Functions/_build/latest?definitionId=57&branchName=main) | [![codecov](https://codecov.io/gh/Azure/azure-functions-python-worker/branch/main/graph/badge.svg)](https://codecov.io/gh/Azure/azure-functions-python-worker) | ![CI Unit tests](https://github.com/Azure/azure-functions-python-worker/workflows/CI%20Unit%20tests/badge.svg?branch=main) | ![CI E2E tests](https://github.com/Azure/azure-functions-python-worker/workflows/CI%20E2E%20tests/badge.svg?branch=main) | +| dev | [![Build Status](https://azfunc.visualstudio.com/Azure%20Functions/_apis/build/status/Azure.azure-functions-python-worker?branchName=dev)](https://azfunc.visualstudio.com/Azure%20Functions/_build/latest?definitionId=57&branchName=dev) | [![codecov](https://codecov.io/gh/Azure/azure-functions-python-worker/branch/dev/graph/badge.svg)](https://codecov.io/gh/Azure/azure-functions-python-worker) | ![CI Unit tests](https://github.com/Azure/azure-functions-python-worker/workflows/CI%20Unit%20tests/badge.svg?branch=dev) | ![CI E2E tests](https://github.com/Azure/azure-functions-python-worker/workflows/CI%20E2E%20tests/badge.svg?branch=dev) | Python support for Azure Functions is based on Python 3.6, Python 3.7, and Python 3.8, serverless hosting on Linux and the Functions 2.0 and 3.0 runtime. @@ -11,10 +11,10 @@ Here is the current status of Python in Azure Functions: What are the supported Python versions? -|Azure Functions Runtime|Python 3.6|Python 3.7|Python 3.8|Python 3.9| -|---|---|---|---|---| -|Azure Functions 2.0|✔|✔|-|-| -|Azure Functions 3.0|✔|✔|✔|(preview)| +| Azure Functions Runtime | Python 3.6 | Python 3.7 | Python 3.8 | Python 3.9 | +|-------------------------|------------|------------|------------|------------| +| Azure Functions 2.0 | ✔ | ✔ | - | - | +| Azure Functions 3.0 | ✔ | ✔ | ✔ | (preview) | What's available? @@ -23,9 +23,6 @@ What's available? - Deploy Python Function project in a custom docker image onto dedicated, or elastic premium plan. - Triggers / Bindings : HTTP, Blob, Queue, Timer, Cosmos DB, Event Grid, Event Hubs and Service Bus - Triggers / Bindings : Custom binding support - -What's coming? - - [Durable Functions For Python](https://github.com/Azure/azure-functions-durable-python) # Get Started @@ -40,15 +37,15 @@ What's coming? Issues and feature requests are tracked in a variety of places. To report this feedback, please file an issue to the relevant repository below: -|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)| -| 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)| -| Templates | Code Issues with Creation Template |[File an Issue](https://github.com/Azure/azure-functions-templates/issues)| +| 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) | +| 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) | +| Templates | Code Issues with Creation Template | [File an Issue](https://github.com/Azure/azure-functions-templates/issues) | # Contribute diff --git a/setup.py b/setup.py index e4de0862c..fa5c89774 100644 --- a/setup.py +++ b/setup.py @@ -79,6 +79,64 @@ """ +CLASSIFIERS = [ + "Development Status :: 5 - Production/Stable", + 'Programming Language :: Python', + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Operating System :: Microsoft :: Windows", + "Operating System :: POSIX", + "Operating System :: MacOS :: MacOS X", + "Environment :: Web Environment", + "License :: OSI Approved :: MIT License", + "Intended Audience :: Developers", +] + + +PACKAGES = [ + "azure_functions_worker", + "azure_functions_worker.protos", + "azure_functions_worker.protos.identity", + "azure_functions_worker.protos.shared", + "azure_functions_worker.bindings", + "azure_functions_worker.bindings.shared_memory_data_transfer", + "azure_functions_worker.utils", + "azure_functions_worker._thirdparty" +] + + +INSTALL_REQUIRES = [ + "grpcio~=1.43.0", + "grpcio-tools~=1.43.0", + "protobuf~=3.19.3", + "azure-functions==1.9.0" +] + + +EXTRA_REQUIRES = { + "dev": [ + "azure-eventhub~=5.7.0", # Used for EventHub E2E tests + "python-dateutil~=2.8.2", + "pycryptodome~=3.10.1", + "flake8~=4.0.1", + "mypy", + "pytest", + "requests==2.*", + "coverage", + "pytest-sugar", + "pytest-cov", + "pytest-xdist", + "pytest-randomly", + "pytest-instafail", + "pytest-rerunfailures", + "ptvsd" + ] +} + + class BuildGRPC: """Generate gRPC bindings.""" def _gen_grpc(self): @@ -353,6 +411,12 @@ def run(self): with open("README.md") as readme: long_description = readme.read() +COMMAND_CLASS = { + 'develop': develop, + 'build': build, + 'webhost': webhost, + 'extension': extension +} setup( name='azure-functions-worker', @@ -364,59 +428,12 @@ def run(self): url="https://github.com/Azure/azure-functions-python-worker", long_description=long_description, long_description_content_type='text/markdown', - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'License :: OSI Approved :: MIT License', - 'Intended Audience :: Developers', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Operating System :: Microsoft :: Windows', - 'Operating System :: POSIX', - 'Operating System :: MacOS :: MacOS X', - 'Environment :: Web Environment', - ], + classifiers=CLASSIFIERS, license='MIT', - packages=['azure_functions_worker', - 'azure_functions_worker.protos', - 'azure_functions_worker.protos.identity', - 'azure_functions_worker.protos.shared', - 'azure_functions_worker.bindings', - 'azure_functions_worker.bindings.shared_memory_data_transfer', - 'azure_functions_worker.utils', - 'azure_functions_worker._thirdparty'], - install_requires=[ - 'grpcio~=1.33.2', - 'grpcio-tools~=1.33.2', - ], - extras_require={ - 'dev': [ - 'azure-functions==1.8.0', - 'azure-eventhub~=5.1.0', - 'python-dateutil~=2.8.1', - 'pycryptodome~=3.10.1', - 'flake8~=3.7.9', - 'mypy', - 'pytest', - 'requests==2.*', - 'coverage', - 'pytest-sugar', - 'pytest-cov', - 'pytest-xdist', - 'pytest-randomly', - 'pytest-instafail', - 'pytest-rerunfailures', - 'ptvsd' - ] - }, + packages=PACKAGES, + install_requires=INSTALL_REQUIRES, + extras_require=EXTRA_REQUIRES, include_package_data=True, - cmdclass={ - 'develop': develop, - 'build': build, - 'webhost': webhost, - 'extension': extension - }, + cmdclass=COMMAND_CLASS, test_suite='tests' ) diff --git a/tests/endtoend/eventhub_batch_functions/metadata_output_batch/__init__.py b/tests/endtoend/eventhub_batch_functions/metadata_output_batch/__init__.py index 0ceb782e6..88a50f3f3 100644 --- a/tests/endtoend/eventhub_batch_functions/metadata_output_batch/__init__.py +++ b/tests/endtoend/eventhub_batch_functions/metadata_output_batch/__init__.py @@ -33,4 +33,4 @@ def main(req: func.HttpRequest): with client: client.send_batch(event_data_batch) - return f'OK' + return 'OK' diff --git a/tests/endtoend/eventhub_functions/metadata_output/__init__.py b/tests/endtoend/eventhub_functions/metadata_output/__init__.py index 303d38d9e..5e7d32ebf 100644 --- a/tests/endtoend/eventhub_functions/metadata_output/__init__.py +++ b/tests/endtoend/eventhub_functions/metadata_output/__init__.py @@ -32,4 +32,4 @@ async def main(req: func.HttpRequest): finally: await client.close() - return f'OK' + return 'OK' diff --git a/tests/unittests/resources/customer_func_path/common_module/__init__.py b/tests/unittests/resources/customer_func_path/common_module/__init__.py index c001ad451..0b98f5fc7 100644 --- a/tests/unittests/resources/customer_func_path/common_module/__init__.py +++ b/tests/unittests/resources/customer_func_path/common_module/__init__.py @@ -1,7 +1,7 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. -__version__: str == 'function_app' +__version__: str = 'function_app' import os # This module should be shadowed from customer_deps_path/common_module diff --git a/tests/unittests/resources/customer_func_path/func_specific_module/__init__.py b/tests/unittests/resources/customer_func_path/func_specific_module/__init__.py index 7e8399fae..086e6349b 100644 --- a/tests/unittests/resources/customer_func_path/func_specific_module/__init__.py +++ b/tests/unittests/resources/customer_func_path/func_specific_module/__init__.py @@ -1,7 +1,7 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. -__version__: str == 'function_app' +__version__: str = 'function_app' import os # ./tests/unittests/resources/customer_func_path/func_specific_module diff --git a/tests/unittests/test_dispatcher.py b/tests/unittests/test_dispatcher.py index 2b6c3bfa0..40ac6f4f7 100644 --- a/tests/unittests/test_dispatcher.py +++ b/tests/unittests/test_dispatcher.py @@ -63,14 +63,14 @@ async def test_dispatcher_initialize_worker_logging(self): async with self._ctrl as host: r = await host.init_worker('3.0.12345') self.assertEqual( - len([l for l in r.logs if l.message.startswith( + len([log for log in r.logs if log.message.startswith( 'Received WorkerInitRequest' )]), 1 ) self.assertEqual( - len([l for l in r.logs if l.message.startswith( + len([log for log in r.logs if log.message.startswith( 'To enable debug level logging' )]), 1 @@ -86,14 +86,14 @@ async def test_dispatcher_environment_reload_logging(self): # Reload environment variable on specialization r = await host.reload_environment(environment={}) self.assertEqual( - len([l for l in r.logs if l.message.startswith( + len([log for log in r.logs if log.message.startswith( 'Received FunctionEnvironmentReloadRequest' )]), 1 ) self.assertEqual( - len([l for l in r.logs if l.message.startswith( + len([log for log in r.logs if log.message.startswith( 'To enable debug level logging' )]), 1