Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
[flake8]
max-line-length = 88
extend-ignore = E203
exclude =
.python_packages
.venv
.git
__pycache__
.mypy_cache

ignore =
# Default ignores
E121,E123,E126,E226,E24,E704,W503,W504

# Auto-fmt compatibility
# Whitespace before ':' | NOT PEP8 COMPLIANT
E203,
# Allow long lines if needed | BLACK HANDLES CODE FORMATTING
E501,
# Multi-line docstring summary should start at the first line
D212,

# Allow looser flake8-docstrings / pydocstyle restrictions
# One-line docstring should fit on one line with quotes
D200,
# First line should end with a period
D400,
# First line should be in imperative mood
D401,

# Subprocess module imported. Warning to be careful only.
S404,
# Subprocess used without shell=True. Warning to be careful only.
S603,
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:
run: |
python -m pip install --upgrade pip poetry
poetry install
- name: Analysing the code with pylint
run: |
poetry run pylint $(git ls-files '*.py')
- name: Analysing the code with mypy
run: |
poetry run mypy $(git ls-files '*.py')
- name: Analysing the code with flake8
run: |
poetry run flake8 .
37 changes: 28 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,45 @@ an Azure Function App to keep it up to date. For use with

# Getting Started

## Required tools

- `poetry` and `poetry-plugin-export`: required for running the creation commands and exporting dependencies to requirements.txt format.
- Poetry installation instructions are available at https://python-poetry.org/docs/#installation
- Once poetry is installed, run
```bash
poetry self add poetry-plugin-export
```
to install `poetry-plugin-export`.
- Azure CLI
- Installation instructions available at https://learn.microsoft.com/en-us/cli/azure/install-azure-cli

- Docker (when not using shared key access from the function app to the storage container)
- Installation instructions available at https://docs.docker.com/engine/install/

## Basic usage

To create a new Debian package repository with an Azure Function App, run

```bash
./create_resources.sh <resource_group_name>
poetry run create-resources <resource_group_name>
```

with the name of the desired resource group. The scripting will autogenerate a
package repository name for you - `debianrepo` followed by a unique string to
differentiate it across Azure.

If you wish to control the suffix used, you can pass the `-s` parameter:
If you wish to control the suffix used, you can pass the `--suffix` parameter:

```bash
./create_resources.sh -s <suffix> <resource_group_name>
poetry run create-resources --suffix <suffix> <resource_group_name>
```
which will attempt to create a storage container named `debianrepo<suffix>`.

By default all resources are created in the `eastus` location - this can be
overridden by passing the `-l` parameter:
overridden by passing the `--location` parameter:

```bash
./create_resources.sh -l uksouth <resource_group_name>
poetry run create-resources --location uksouth <resource_group_name>
```

## No shared-key access / Managed Identities
Expand All @@ -42,7 +57,7 @@ compiled and packed appropriately).
To create a new Debian package repository which uses Managed Identities, run

```bash
./create_resources_nosharedkey.sh [-s <suffix>] [-l <location>] <resource_group_name>
poetry run create-resources --no-shared-key [--suffix <suffix>] [--location <location>] <resource_group_name>
```

This creates an additional blob container (`python`) in the storage account to
Expand All @@ -65,9 +80,13 @@ The function app works as follows:
single `Package` file, which is then uploaded. A `Packages.xz` file is also
created.

As the function app works on a Consumption plan it may take up to 10 minutes for
the function app to trigger and regenerate the package information. In practice,
the eventGridTrigger is triggered very quickly.
## Speed of repository update

The function app triggers at the speed of an Event Grid trigger running in Consumption
mode; in the worst case this means triggering from a Cold Start. In practice
the repository is updated within 1 minute.

# Project

## Contributing

Expand Down
125 changes: 0 additions & 125 deletions create_resources.sh

This file was deleted.

147 changes: 0 additions & 147 deletions create_resources_nosharedkey.sh

This file was deleted.

Loading