Skip to content

Commit c1c8871

Browse files
committed
Add Python Azure Developer CLI template
0 parents  commit c1c8871

36 files changed

Lines changed: 1513 additions & 0 deletions

‎.azdo/pipelines/azure-dev.yml‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
trigger:
2+
- main
3+
4+
pool:
5+
vmImage: ubuntu-latest
6+
7+
steps:
8+
- task: UsePythonVersion@0
9+
inputs:
10+
versionSpec: "3.14"
11+
- script: python -m pip install --upgrade pip==26.2.1 && pip install --requirement src/requirements.lock && pip install -e "./src[dev]"
12+
displayName: Install dependencies
13+
- script: ruff check src && ruff format --check src && pip-audit --requirement src/requirements.lock
14+
displayName: Validate application
15+
- task: setup-azd@0
16+
displayName: Install azd
17+
- pwsh: azd config set auth.useAzCliAuth "true"
18+
displayName: Configure Azure CLI authentication
19+
- task: AzureCLI@2
20+
displayName: Provision and deploy
21+
inputs:
22+
azureSubscription: azconnection
23+
scriptType: bash
24+
scriptLocation: inlineScript
25+
inlineScript: azd up --no-prompt
26+
env:
27+
AZURE_SUBSCRIPTION_ID: $(AZURE_SUBSCRIPTION_ID)
28+
AZURE_ENV_NAME: $(AZURE_ENV_NAME)
29+
AZURE_LOCATION: $(AZURE_LOCATION)
30+
AZD_INITIAL_ENVIRONMENT_CONFIG: $(secrets.AZD_INITIAL_ENVIRONMENT_CONFIG)

‎.devcontainer/devcontainer.json‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "Hello AZD Python",
3+
"image": "mcr.microsoft.com/devcontainers/python:3.14-bookworm",
4+
"features": {
5+
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
6+
"ghcr.io/azure/azure-dev/azd:latest": {}
7+
},
8+
"customizations": {
9+
"vscode": {
10+
"extensions": [
11+
"GitHub.vscode-github-actions",
12+
"ms-azuretools.azure-dev",
13+
"ms-azuretools.vscode-bicep",
14+
"ms-azuretools.vscode-docker",
15+
"ms-python.python",
16+
"ms-python.vscode-pylance"
17+
]
18+
}
19+
},
20+
"forwardPorts": [8000],
21+
"postCreateCommand": "pip install -e './src[dev]'",
22+
"remoteUser": "vscode"
23+
}

‎.github/CODE_OF_CONDUCT.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Microsoft Open Source Code of Conduct
2+
3+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
4+
5+
Resources:
6+
7+
- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
8+
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
9+
- Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns

‎.github/ISSUE_TEMPLATE.md‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Issue
2+
3+
## Issue type
4+
5+
- [ ] Bug report
6+
- [ ] Feature request
7+
- [ ] Documentation issue
8+
- [ ] Regression
9+
10+
### Description
11+
12+
Describe the issue and the behavior you expected.
13+
14+
### Steps to reproduce
15+
16+
List the minimal steps needed to reproduce the issue.
17+
18+
### Environment
19+
20+
Include your operating system, Python version, and Azure Developer CLI version.

‎.github/PULL_REQUEST_TEMPLATE.md‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Pull Request
2+
3+
## Purpose
4+
5+
Describe the problem this change solves.
6+
7+
## Change type
8+
9+
- [ ] Bug fix
10+
- [ ] Feature
11+
- [ ] Refactoring
12+
- [ ] Documentation
13+
- [ ] Infrastructure
14+
15+
## Validation
16+
17+
- [ ] `ruff check .`
18+
- [ ] `ruff format --check .`
19+
- [ ] `azd show`

‎.github/workflows/azure-dev.yml‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Deploy with azd
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
9+
permissions:
10+
id-token: write
11+
contents: read
12+
13+
jobs:
14+
validate:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-python@v6
19+
with:
20+
python-version: "3.14"
21+
cache: pip
22+
cache-dependency-path: src/pyproject.toml
23+
- run: python -m pip install --upgrade pip==26.2.1
24+
- run: pip install --requirement src/requirements.lock
25+
- run: pip install -e "./src[dev]"
26+
- run: ruff check src
27+
- run: ruff format --check src
28+
- run: pip-audit --requirement src/requirements.lock
29+
30+
deploy:
31+
needs: validate
32+
runs-on: ubuntu-latest
33+
env:
34+
AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }}
35+
AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}
36+
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
37+
AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }}
38+
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
39+
steps:
40+
- uses: actions/checkout@v4
41+
- uses: Azure/setup-azd@v2
42+
- name: Log in with federated credentials
43+
run: >-
44+
azd auth login
45+
--client-id "$AZURE_CLIENT_ID"
46+
--federated-credential-provider github
47+
--tenant-id "$AZURE_TENANT_ID"
48+
- run: azd provision --no-prompt
49+
- run: azd deploy --no-prompt

‎.gitignore‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.azure/
2+
.env
3+
.ruff_cache/
4+
.venv/
5+
__pycache__/
6+
*.py[cod]

‎CHANGELOG.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Changelog
2+
3+
Notable changes to this template are documented in this file.

‎CONTRIBUTING.md‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Contributing
2+
3+
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 grant us the rights to use your contribution. For details, visit <https://cla.opensource.microsoft.com>.
4+
5+
This project follows the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
6+
7+
## Development
8+
9+
Create and activate a virtual environment, then install the development dependencies:
10+
11+
```bash
12+
cd src
13+
python -m venv .venv
14+
pip install -e ".[dev]"
15+
```
16+
17+
Run the validation suite before opening a pull request:
18+
19+
```bash
20+
ruff check .
21+
ruff format --check .
22+
pip-audit --requirement requirements.lock
23+
```
24+
25+
Regenerate `requirements.lock` with `python -m piptools compile --strip-extras --no-emit-index-url --output-file=requirements.lock pyproject.toml` whenever runtime dependencies change.
26+
27+
Run `azd show` from the repository root and compile `infra/main.bicep` to validate template changes.

‎LICENSE.md‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# MIT License
2+
3+
Copyright (c) Microsoft Corporation.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)