Skip to content

Commit 308aa1d

Browse files
author
Max Dymond
authored
Merge pull request #7 from microsoft/md/poetry
Switch to using Poetry for dependency management
2 parents 4fae913 + c451df3 commit 308aa1d

File tree

10 files changed

+895
-21
lines changed

10 files changed

+895
-21
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@ jobs:
1616
python-version: ${{ matrix.python-version }}
1717
- name: Install dependencies
1818
run: |
19-
python -m pip install --upgrade pip
20-
pip install -r requirements.txt
21-
pip install -r dev-requirements.txt
19+
python -m pip install --upgrade pip poetry
20+
poetry install
2221
- name: Analysing the code with pylint
2322
run: |
24-
pylint $(git ls-files '*.py')
23+
poetry run pylint $(git ls-files '*.py')
2524
- name: Analysing the code with mypy
2625
run: |
27-
mypy $(git ls-files '*.py')
26+
poetry run mypy $(git ls-files '*.py')

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,7 @@ __blobstorage__
133133
__queuestorage__
134134
__azurite_db*__.json
135135
.python_packages
136+
137+
# Other artifacts
138+
function_app.zip
139+
requirements.txt

CHANGELOG.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
This file's format is based on [Keep a Changelog](http://keepachangelog.com/)
6+
and this project adheres to [Semantic Versioning](http://semver.org/). The
7+
version number is tracked in the file `pyproject.toml`.
8+
9+
Contact: See pyproject.toml authors
10+
Status: Available for use
11+
12+
## [Unreleased]
13+
14+
### Breaking Changes
15+
16+
### Added
17+
18+
### Fixed
19+
20+
## [0.1.0] - 2024-05-16
21+
22+
### Added
23+
- Initial release
24+
25+
### Changed
26+
27+
[unreleased]: https://github.com/microsoft/apt-package-function/compare/0.1.0...HEAD
28+
[0.1.0]: https://github.com/microsoft/apt-package-function/tree/0.1.0

create_resources.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ then
4646
exit 1
4747
fi
4848

49+
# Poetry is required to create the requirements.txt file
50+
if ! command -v poetry &> /dev/null
51+
then
52+
echo "poetry could not be found - please install it"
53+
exit 1
54+
fi
55+
4956
echo "Ensuring resource group ${RESOURCE_GROUP_NAME} exists"
5057
az group create --name "${RESOURCE_GROUP_NAME}" --location "${LOCATION}" --output none
5158

@@ -67,6 +74,9 @@ FUNCTION_APP_NAME=$(az deployment group show -n "${DEPLOYMENT_NAME}" -g "${RESOU
6774
STORAGE_ACCOUNT=$(az deployment group show -n "${DEPLOYMENT_NAME}" -g "${RESOURCE_GROUP_NAME}" --output tsv --query properties.outputs.storage_account.value)
6875
PACKAGE_CONTAINER=$(az deployment group show -n "${DEPLOYMENT_NAME}" -g "${RESOURCE_GROUP_NAME}" --output tsv --query properties.outputs.package_container.value)
6976

77+
# Create the requirements.txt file from the poetry configuration
78+
poetry export -f requirements.txt -o requirements.txt
79+
7080
# Zip up the functionapp code
7181
mkdir -p build/
7282
rm -f build/function_app.zip

create_resources_nosharedkey.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@ then
4848
exit 1
4949
fi
5050

51+
# Poetry is required to create the requirements.txt file
52+
if ! command -v poetry &> /dev/null
53+
then
54+
echo "poetry could not be found - please install it"
55+
exit 1
56+
fi
57+
58+
# Create the requirements.txt file from the poetry configuration
59+
poetry export -f requirements.txt -o requirements.txt
60+
5161
# Pack the application using the core-tools tooling
5262
# Should generate a file called function_app.zip
5363
docker run -it \

dev-requirements.txt

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

poetry.lock

Lines changed: 816 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[tool.poetry]
2+
name = "apt-package-function"
3+
version = "0.1.0"
4+
description = "Functionality to create a Debian package repository in Azure Blob Storage"
5+
authors = ["Max Dymond <max.dymond@microsoft.com>"]
6+
license = "MIT"
7+
readme = "README.md"
8+
9+
[tool.poetry.dependencies]
10+
python = "^3.8"
11+
azure-functions = "^1.19.0"
12+
azure-identity = "^1.16.0"
13+
azure-storage-blob = "^12.20.0"
14+
pydpkg = "^1.9.3"
15+
16+
[tool.poetry.group.dev.dependencies]
17+
pylint = "^3.2.0"
18+
mypy = "^1.10.0"
19+
20+
[build-system]
21+
requires = ["poetry-core"]
22+
build-backend = "poetry.core.masonry.api"

requirements.txt

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

rg.bicep

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ resource uami 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = {
3737
var common_storage_properties = {
3838
publicNetworkAccess: 'Enabled'
3939
allowBlobPublicAccess: false
40+
minimumTlsVersion: 'TLS1_2'
4041
}
4142
var storage_properties = use_shared_keys ? common_storage_properties : union(common_storage_properties, {
4243
allowSharedKeyAccess: false

0 commit comments

Comments
 (0)