-
Notifications
You must be signed in to change notification settings - Fork 2
Http V2 Extensions #1
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
Changes from all commits
13ed5b4
0efa7bc
98ec6f3
d614b44
841a42d
e3dff8f
4d0b07f
f684979
dccb68e
704a2be
c0313ec
178e4c8
2b3d281
b6e0a6e
9508d2e
68b7cc7
35f3515
51f414e
ef6b21e
4a39478
fd9bc0c
01461d2
a568273
038485e
c4122c5
eb531b5
7548798
af3c3d7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: UT CI Run for Python Extension Base | ||
|
||
on: | ||
push: | ||
branches: [ dev, master, main, release/* ] | ||
paths: | ||
- 'azure-functions-extension-base/**' | ||
pull_request: | ||
branches: [ dev, master, main, release/* ] | ||
paths: | ||
- 'azure-functions-extension-base/**' | ||
|
||
jobs: | ||
build: | ||
name: "Python Extension Base UT CI Run" | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: [ 3.8, 3.9, "3.10", "3.11" ] | ||
permissions: read-all | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
working-directory: azure-functions-extension-base | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install -U -e .[dev] | ||
|
||
- name: Run Unit Tests | ||
YunchuWang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
working-directory: azure-functions-extension-base | ||
env: | ||
AzureWebJobsStorage: ${{ secrets.AzureWebJobsStorage }} | ||
run: | | ||
python -m pytest -q --instafail --cov=. --cov-report xml --cov-branch tests | ||
|
||
- name: Upload Coverage to Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
file: ./azure-functions-extension-base/coverage.xml | ||
flags: unittests | ||
name: codecov | ||
fail_ci_if_error: false | ||
|
||
- name: Notify dedicated teams channel | ||
uses: jdcargile/[email protected] | ||
if: failure() | ||
with: | ||
github-token: ${{ github.token }} # this will use the runner's token. | ||
ms-teams-webhook-uri: ${{ secrets.MS_TEAMS_WEBHOOK_URI }} | ||
notification-summary: "Python Extension Base UT CI Failed for Python ${{ matrix.python-version }}" | ||
notification-color: 17a2b8 | ||
timezone: America/Denver | ||
verbose-logging: false |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: UT CI Run for Python Extension Blob | ||
|
||
on: | ||
push: | ||
branches: [ dev, master, main, release/* ] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comments as the base extension workflow There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto |
||
paths: | ||
- 'azure-functions-extension-base/**' | ||
- 'azure-functions-extension-blob/**' | ||
pull_request: | ||
branches: [ dev, master, main, release/* ] | ||
paths: | ||
- 'azure-functions-extension-base/**' | ||
- 'azure-functions-extension-blob/**' | ||
|
||
jobs: | ||
build: | ||
name: "Python Extension Blob UT CI Run" | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: [ 3.9, "3.10", "3.11" ] | ||
permissions: read-all | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
working-directory: azure-functions-extension-blob | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install -U -e .[dev] | ||
python -m pip install -e ../azure-functions-extension-base | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should test this with the published base. If there are base changes then we should publish the base then the extensions. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will remove |
||
|
||
- name: Run Unit Tests | ||
working-directory: azure-functions-extension-blob | ||
env: | ||
AzureWebJobsStorage: ${{ secrets.AzureWebJobsStorage }} | ||
run: | | ||
python -m pytest -q --instafail --cov=. --cov-report xml --cov-branch tests | ||
|
||
- name: Upload Coverage to Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
file: ./azure-functions-extension-blob/coverage.xml | ||
flags: unittests | ||
name: codecov | ||
fail_ci_if_error: false | ||
|
||
- name: Notify dedicated teams channel | ||
uses: jdcargile/[email protected] | ||
if: failure() | ||
with: | ||
github-token: ${{ github.token }} # this will use the runner's token. | ||
ms-teams-webhook-uri: ${{ secrets.MS_TEAMS_WEBHOOK_URI }} | ||
notification-summary: "Python Extension Blob UT CI Failed for Python ${{ matrix.python-version }}" | ||
notification-color: 17a2b8 | ||
timezone: America/Denver | ||
verbose-logging: false |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: UT CI Run for Python Extension FastApi | ||
|
||
on: | ||
push: | ||
branches: [ dev, master, main, release/* ] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto |
||
paths: | ||
- 'azure-functions-extension-fastapi/**' | ||
pull_request: | ||
branches: [ dev, master, main, release/* ] | ||
paths: | ||
- 'azure-functions-extension-fastapi/**' | ||
|
||
jobs: | ||
build: | ||
name: "Python Extension UT FastApi CI Run" | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: [ 3.8, 3.9, "3.10", "3.11" ] | ||
permissions: read-all | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
working-directory: azure-functions-extension-fastapi | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install -U -e .[dev] | ||
python -m pip install -e ../azure-functions-extension-base | ||
YunchuWang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- name: Run Unit Tests | ||
working-directory: azure-functions-extension-fastapi | ||
env: | ||
AzureWebJobsStorage: ${{ secrets.AzureWebJobsStorage }} | ||
run: | | ||
python -m pytest -q --instafail --cov=. --cov-report xml --cov-branch tests | ||
|
||
- name: Upload Coverage to Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
file: ./azure-functions-extension-fastapi/coverage.xml | ||
flags: unittests | ||
name: codecov | ||
fail_ci_if_error: false | ||
|
||
- name: Notify dedicated teams channel | ||
uses: jdcargile/[email protected] | ||
if: failure() | ||
with: | ||
github-token: ${{ github.token }} # this will use the runner's token. | ||
ms-teams-webhook-uri: ${{ secrets.MS_TEAMS_WEBHOOK_URI }} | ||
notification-summary: "Python Extension FastApi UT CI Failed for Python ${{ matrix.python-version }}" | ||
notification-color: 17a2b8 | ||
timezone: America/Denver | ||
verbose-logging: false |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,3 @@ | ||
# Azure Functions Extension Base library for Python | ||
This is the base library for allowing Python Function Apps to recognize and bind to SDk-types. It is not to be used directly. | ||
Instead, please reference one of the extending packages. | ||
|
||
Currently, the supported SDK-type bindings are: | ||
|
||
* Azure Storage Blob | ||
|
||
## Next steps | ||
|
||
### More sample code | ||
|
||
Get started with our [Blob samples](hhttps://github.com/Azure/azure-functions-python-extensions/tree/main/azure-functions-extension-blob/samples). | ||
|
||
Several samples are available in this GitHub repository. These samples provide example code for additional scenarios commonly encountered while working with Storage Blobs: | ||
|
||
* [blob_samples_blobclient](https://github.com/Azure/azure-functions-python-extensions/tree/main/azure-functions-extension-blob/samples/blob_samples_blobclient) - Examples for using the BlobClient type: | ||
* From BlobTrigger | ||
* From BlobInput | ||
|
||
* [blob_samples_containerclient](https://github.com/Azure/azure-functions-python-extensions/tree/main/azure-functions-extension-blob/samples/blob_samples_containerclient) - Examples for using the ContainerClient type: | ||
* From BlobTrigger | ||
* From BlobInput | ||
|
||
* [blob_samples_storagestreamdownloader](https://github.com/Azure/azure-functions-python-extensions/tree/main/azure-functions-extension-blob/samples/blob_samples_storagestreamdownloader) - Examples for using the StorageStreamDownloader type: | ||
* From BlobTrigger | ||
* From BlobInput | ||
|
||
### Additional documentation | ||
For more information on the Azure Storage Blob SDK, see the [Azure Blob storage documentation](https://docs.microsoft.com/azure/storage/blobs/) on docs.microsoft.com | ||
and the [Azure Storage Blobs README](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob). | ||
|
||
## Contributing | ||
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com. | ||
|
||
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA. | ||
|
||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments. | ||
This is the base library for allowing Python Function Apps to recognize and bind to SDk-types and HttpV2-types. It is not to be used directly. | ||
YunchuWang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Instead, please reference one of the extending packages. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,38 @@ | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. | ||
|
||
from .meta import (Datum, _ConverterMeta, _BaseConverter, | ||
InConverter, OutConverter, get_binding_registry) | ||
from .meta import ( | ||
Datum, | ||
_ConverterMeta, | ||
_BaseConverter, | ||
InConverter, | ||
OutConverter, | ||
get_binding_registry | ||
) | ||
from .sdkType import SdkType | ||
from .web import ( | ||
WebServer, | ||
WebApp, | ||
ModuleTrackerMeta, | ||
RequestTrackerMeta, | ||
ResponseTrackerMeta, | ||
http_v2_enabled, | ||
ResponseLabels | ||
) | ||
|
||
__all__ = ['Datum', '_ConverterMeta', '_BaseConverter', | ||
'InConverter', 'OutConverter', | ||
'SdkType', 'get_binding_registry'] | ||
__all__ = [ | ||
'Datum', | ||
'_ConverterMeta', | ||
'_BaseConverter', | ||
'InConverter', | ||
'OutConverter', | ||
'SdkType', | ||
'get_binding_registry', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is get_binding_registry exposed? same with http_v2_enabled There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. get_binding_registry is used in the worker. It returns the binding registry |
||
'ModuleTrackerMeta', | ||
'RequestTrackerMeta', | ||
'ResponseTrackerMeta', | ||
'http_v2_enabled', | ||
'ResponseLabels', | ||
'WebServer', | ||
'WebApp' | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,11 @@ | |
# Licensed under the MIT License. | ||
|
||
from abc import abstractmethod | ||
from typing import Any, Optional | ||
|
||
import sys | ||
from typing import Any, Dict, Optional | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. did flake8 succeed here? Any and Optional are not used |
||
|
||
class SdkType: | ||
def __init__(self, *, data: Optional[dict[str, Any]] = None): | ||
def __init__(self, *, data: dict = None): | ||
self._data = data or {} | ||
|
||
@abstractmethod | ||
|
Uh oh!
There was an error while loading. Please reload this page.