From 6c7b63548c5e858672b40fd2f5e08347f888673e Mon Sep 17 00:00:00 2001 From: Martijn Remmen Date: Tue, 15 Jun 2021 19:37:03 +0200 Subject: [PATCH] Project scaffolding toegevoegd --- .funcignore | 5 ++ .gitignore | 130 ++++++++++++++++++++++++++++++++++++++++ .vscode/extensions.json | 6 ++ .vscode/launch.json | 12 ++++ .vscode/settings.json | 8 +++ .vscode/tasks.json | 26 ++++++++ Analyzer/__init__.py | 8 +++ Analyzer/function.json | 12 ++++ Analyzer/sample.dat | 1 + host.json | 15 +++++ proxies.json | 4 ++ requirements.txt | 5 ++ 12 files changed, 232 insertions(+) create mode 100644 .funcignore create mode 100644 .gitignore create mode 100644 .vscode/extensions.json create mode 100644 .vscode/launch.json create mode 100644 .vscode/settings.json create mode 100644 .vscode/tasks.json create mode 100644 Analyzer/__init__.py create mode 100644 Analyzer/function.json create mode 100644 Analyzer/sample.dat create mode 100644 host.json create mode 100644 proxies.json create mode 100644 requirements.txt diff --git a/.funcignore b/.funcignore new file mode 100644 index 0000000..0678ea2 --- /dev/null +++ b/.funcignore @@ -0,0 +1,5 @@ +.git* +.vscode +local.settings.json +test +.venv \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a10127b --- /dev/null +++ b/.gitignore @@ -0,0 +1,130 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +pip-wheel-metadata/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don’t work, or not +# install all needed dependencies. +#Pipfile.lock + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# Azure Functions artifacts +bin +obj +appsettings.json +local.settings.json +.python_packages \ No newline at end of file diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..cbbad0f --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,6 @@ +{ + "recommendations": [ + "ms-azuretools.vscode-azurefunctions", + "ms-python.python" + ] +} diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..4508b45 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,12 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Attach to Python Functions", + "type": "python", + "request": "attach", + "port": 9091, + "preLaunchTask": "func: host start" + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..8ab0a1e --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,8 @@ +{ + "azureFunctions.deploySubpath": ".", + "azureFunctions.scmDoBuildDuringDeployment": true, + "azureFunctions.pythonVenv": ".venv", + "azureFunctions.projectLanguage": "Python", + "azureFunctions.projectRuntime": "~3", + "debug.internalConsoleOptions": "neverOpen" +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..1bb7353 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,26 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "type": "func", + "command": "host start", + "problemMatcher": "$func-python-watch", + "isBackground": true, + "dependsOn": "pipInstall" + }, + { + "label": "pipInstall", + "type": "shell", + "osx": { + "command": "${config:azureFunctions.pythonVenv}/bin/python -m pip install -r requirements.txt" + }, + "windows": { + "command": "${config:azureFunctions.pythonVenv}/Scripts/python -m pip install -r requirements.txt" + }, + "linux": { + "command": "${config:azureFunctions.pythonVenv}/bin/python -m pip install -r requirements.txt" + }, + "problemMatcher": [] + } + ] +} \ No newline at end of file diff --git a/Analyzer/__init__.py b/Analyzer/__init__.py new file mode 100644 index 0000000..3a1ad19 --- /dev/null +++ b/Analyzer/__init__.py @@ -0,0 +1,8 @@ +import logging + +import azure.functions as func + + +def main(msg: func.ServiceBusMessage): + logging.info('Python ServiceBus queue trigger processed message: %s', + msg.get_body().decode('utf-8')) diff --git a/Analyzer/function.json b/Analyzer/function.json new file mode 100644 index 0000000..e1bf01b --- /dev/null +++ b/Analyzer/function.json @@ -0,0 +1,12 @@ +{ + "scriptFile": "__init__.py", + "bindings": [ + { + "name": "msg", + "type": "serviceBusTrigger", + "direction": "in", + "queueName": "tst", + "connection": "AzureWebJobsServiceBus" + } + ] +} diff --git a/Analyzer/sample.dat b/Analyzer/sample.dat new file mode 100644 index 0000000..d4dcf3d --- /dev/null +++ b/Analyzer/sample.dat @@ -0,0 +1 @@ +Service Bus Message \ No newline at end of file diff --git a/host.json b/host.json new file mode 100644 index 0000000..3f33af1 --- /dev/null +++ b/host.json @@ -0,0 +1,15 @@ +{ + "version": "2.0", + "logging": { + "applicationInsights": { + "samplingSettings": { + "isEnabled": true, + "excludedTypes": "Request" + } + } + }, + "extensionBundle": { + "id": "Microsoft.Azure.Functions.ExtensionBundle", + "version": "[2.*, 3.0.0)" + } +} diff --git a/proxies.json b/proxies.json new file mode 100644 index 0000000..b385252 --- /dev/null +++ b/proxies.json @@ -0,0 +1,4 @@ +{ + "$schema": "http://json.schemastore.org/proxies", + "proxies": {} +} diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..bdb8fc5 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,5 @@ +# DO NOT include azure-functions-worker in this file +# The Python Worker is managed by Azure Functions platform +# Manually managing azure-functions-worker may cause unexpected issues + +azure-functions