Skip to content

Commit

Permalink
Switch to poetry for requirements management.
Browse files Browse the repository at this point in the history
Poetry allows for much finer control of requirements over
stock requirements.txt.
  • Loading branch information
maxdymond committed May 16, 2024
1 parent d0bcff6 commit c451df3
Show file tree
Hide file tree
Showing 9 changed files with 894 additions and 21 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r dev-requirements.txt
python -m pip install --upgrade pip poetry
poetry install
- name: Analysing the code with pylint
run: |
pylint $(git ls-files '*.py')
poetry run pylint $(git ls-files '*.py')
- name: Analysing the code with mypy
run: |
mypy $(git ls-files '*.py')
poetry run mypy $(git ls-files '*.py')
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,7 @@ __blobstorage__
__queuestorage__
__azurite_db*__.json
.python_packages

# Other artifacts
function_app.zip
requirements.txt
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Changelog

All notable changes to this project will be documented in this file.

This file's format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/). The
version number is tracked in the file `pyproject.toml`.

Contact: See pyproject.toml authors
Status: Available for use

## [Unreleased]

### Breaking Changes

### Added

### Fixed

## [0.1.0] - 2024-05-16

### Added
- Initial release

### Changed

[unreleased]: https://github.com/microsoft/apt-package-function/compare/0.1.0...HEAD
[0.1.0]: https://github.com/microsoft/apt-package-function/tree/0.1.0
10 changes: 10 additions & 0 deletions create_resources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ then
exit 1
fi

# Poetry is required to create the requirements.txt file
if ! command -v poetry &> /dev/null
then
echo "poetry could not be found - please install it"
exit 1
fi

echo "Ensuring resource group ${RESOURCE_GROUP_NAME} exists"
az group create --name "${RESOURCE_GROUP_NAME}" --location "${LOCATION}" --output none

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

# Create the requirements.txt file from the poetry configuration
poetry export -f requirements.txt -o requirements.txt

# Zip up the functionapp code
mkdir -p build/
rm -f build/function_app.zip
Expand Down
10 changes: 10 additions & 0 deletions create_resources_nosharedkey.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ then
exit 1
fi

# Poetry is required to create the requirements.txt file
if ! command -v poetry &> /dev/null
then
echo "poetry could not be found - please install it"
exit 1
fi

# Create the requirements.txt file from the poetry configuration
poetry export -f requirements.txt -o requirements.txt

# Pack the application using the core-tools tooling
# Should generate a file called function_app.zip
docker run -it \
Expand Down
5 changes: 0 additions & 5 deletions dev-requirements.txt

This file was deleted.

816 changes: 816 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[tool.poetry]
name = "apt-package-function"
version = "0.1.0"
description = "Functionality to create a Debian package repository in Azure Blob Storage"
authors = ["Max Dymond <[email protected]>"]
license = "MIT"
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.8"
azure-functions = "^1.19.0"
azure-identity = "^1.16.0"
azure-storage-blob = "^12.20.0"
pydpkg = "^1.9.3"

[tool.poetry.group.dev.dependencies]
pylint = "^3.2.0"
mypy = "^1.10.0"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
11 changes: 0 additions & 11 deletions requirements.txt

This file was deleted.

0 comments on commit c451df3

Please sign in to comment.