Skip to main content

Scaffolding CLI for Azure Functions Python v2 projects

Project description

Azure Functions Scaffold

PyPI Python Version CI Release Security Scans codecov pre-commit Docs License: MIT

Read this in: 한국어 | 日本語 | 简体中文

Scaffolding CLI for production-ready Azure Functions Python v2 projects.

Why Use It

Starting a new Azure Functions project means setting up boilerplate: host.json, function_app.py, directory structure, tooling config, and tests. azure-functions-scaffold generates a production-ready project layout in one command, so you can focus on business logic from the start.

flowchart LR
    Dev(["Developer"])
    CLI["afs new my-api"]
    T["Templates"]
    P["Generated Project"]
    VAL["azure-functions-validation"]

    Dev --> CLI
    CLI --> T
    T --> P
    CLI -- "--with-validation" --> VAL
    VAL --> P

Scope

  • Azure Functions Python v2 programming model
  • Decorator-based func.FunctionApp() applications
  • CLI-driven project generation and expansion
  • Templates for HTTP, Timer, Queue, Blob, and Service Bus triggers

This tool generates project scaffolds. It does not provide runtime libraries.

What this package does not do

This package does not own:

  • Runtime behavior — generated projects wire up optional packages (--with-openapi, --with-validation, --with-doctor), but runtime logic belongs to those packages
  • API documentation — use azure-functions-openapi for API documentation and spec generation
  • Request validation — use azure-functions-validation for request/response validation and serialization

Features

  • azure-functions-scaffold new command for project generation
  • Five built-in templates: HTTP, Timer, Queue, Blob, Service Bus
  • azure-functions-scaffold add command for expanding existing projects
  • Optional integrations: --with-openapi, --with-validation, --with-doctor
  • Preset tooling levels: --preset minimal|standard|strict
  • Interactive guided setup via --interactive
  • Short alias: afs works as a drop-in for azure-functions-scaffold

Installation

pip install azure-functions-scaffold

Quick Start

Use this 4-step flow to create and run a local HTTP function:

  1. Install the CLI.
  2. Generate a new project.
  3. Install project dependencies.
  4. Start the local Functions runtime.
azure-functions-scaffold new my-api
cd my-api
pip install -e .
func start

Open http://localhost:7071/api/hello in your browser.

Expected response:

Hello, World!

Project names must start with an alphanumeric character and use only letters, numbers, hyphens, or underscores.

What You Get

The generated layout separates trigger bindings, business logic, shared runtime concerns, and tests so teams can scale endpoints without coupling everything to function_app.py.

my-api/
|- function_app.py          # Azure Functions v2 entrypoint
|- host.json                # Runtime configuration
|- local.settings.json.example
|- pyproject.toml           # Dependencies and tooling config
|- app/
|  |- core/
|  |  `- logging.py         # Structured JSON logging
|  |- functions/
|  |  `- http.py            # HTTP trigger (Blueprint)
|  |- schemas/
|  |  `- request_models.py  # Request/response models
|  `- services/
|     `- hello_service.py   # Business logic
`- tests/
   `- test_http.py          # Pytest tests

Why this layout works:

  • Keep trigger-specific code in app/functions.
  • Keep reusable business rules in app/services.
  • Keep model contracts in app/schemas.
  • Keep observability and runtime helpers in app/core.
  • Keep integration checks in tests.

Templates

Template Command Use Case
http azure-functions-scaffold new my-api REST APIs, webhooks
timer azure-functions-scaffold new my-job --template timer Scheduled tasks, cron
queue azure-functions-scaffold new my-worker --template queue Message processing (Azurite)
blob azure-functions-scaffold new my-blob --template blob File processing (Azurite)
servicebus azure-functions-scaffold new my-bus --template servicebus Enterprise messaging

Note: afs is short for azure-functions-scaffold. Both work.

Template defaults:

  • http: public HTTP endpoint and service module.
  • timer: scheduled trigger using NCRONTAB expression settings.
  • queue: Storage Queue trigger ready for local Azurite development.
  • blob: Blob trigger scaffold for file-ingestion pipelines.
  • servicebus: Service Bus trigger scaffold with development placeholders.

Optional Features

  • --with-openapi - Swagger UI + OpenAPI spec endpoints
  • --with-validation - Pydantic request/response validation
  • --with-doctor - Health check diagnostics
  • --preset minimal|standard|strict - Tooling level
  • --interactive - Guided project setup

Example combinations:

azure-functions-scaffold new my-api --preset strict --with-validation
azure-functions-scaffold new my-api --with-openapi --with-validation
azure-functions-scaffold new my-api --template timer --preset minimal

Expand Your Project

Add functions to an existing scaffolded project:

azure-functions-scaffold add http get-user --project-root ./my-api
azure-functions-scaffold add timer cleanup --project-root ./my-api
azure-functions-scaffold add queue sync-jobs --project-root ./my-api
azure-functions-scaffold add blob ingest-reports --project-root ./my-api
azure-functions-scaffold add servicebus process-events --project-root ./my-api

Preview additions before writing files:

azure-functions-scaffold add servicebus process-events --project-root ./my-api --dry-run

Common expansion flow:

  1. Add a trigger with azure-functions-scaffold add <trigger> <name>.
  2. Implement business logic under app/services.
  3. Update contracts in app/schemas if needed.
  4. Add or update tests in tests.

Deploy

func azure functionapp publish <APP_NAME>

Before publishing:

  • Set required app settings for production connections.
  • Review host.json and function auth levels.
  • Run your project checks (pytest, lint, and formatting).
  • Verify startup locally with func start.

Documentation

Development

Use Makefile commands as the canonical entry points:

make install
make check-all
make docs
make build

Ecosystem

This package is part of the Azure Functions Python DX Toolkit.

Design principle: azure-functions-scaffold owns project generation and template expansion. It does not provide runtime libraries — runtime behavior belongs to azure-functions-openapi (API documentation and spec generation), azure-functions-validation (request/response validation), and azure-functions-langgraph (LangGraph runtime exposure).

Package Role
azure-functions-scaffold Project scaffolding CLI
azure-functions-validation Request/response validation and serialization
azure-functions-openapi OpenAPI spec generation and Swagger UI
azure-functions-langgraph LangGraph deployment adapter for Azure Functions
azure-functions-logging Structured logging and observability
azure-functions-doctor Pre-deploy diagnostic CLI
azure-functions-durable-graph Manifest-first graph runtime with Durable Functions (planned)
azure-functions-python-cookbook Recipes and examples

For AI Coding Assistants

This package includes llms.txt and llms-full.txt files in the repository root designed specifically for LLM-assisted development:

  • llms.txt — Concise overview of the CLI, commands, templates, and quick start
  • llms-full.txt — Complete CLI reference with all options, patterns, and workflows

Use these files to provide context to AI coding assistants when working with Azure Functions scaffolding.

Reference:

Disclaimer

This project is an independent community project and is not affiliated with, endorsed by, or maintained by Microsoft.

Azure and Azure Functions are trademarks of Microsoft Corporation.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

azure_functions_scaffold-0.4.0.tar.gz (79.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

azure_functions_scaffold-0.4.0-py3-none-any.whl (86.5 kB view details)

Uploaded Python 3

File details

Details for the file azure_functions_scaffold-0.4.0.tar.gz.

File metadata

  • Download URL: azure_functions_scaffold-0.4.0.tar.gz
  • Upload date:
  • Size: 79.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for azure_functions_scaffold-0.4.0.tar.gz
Algorithm Hash digest
SHA256 23ea139458a859807beac3818f7000a181e5f9dd8d23a5af98c26e85240b9329
MD5 cfb228a1d9aad3bbca48e14cd8cc53a7
BLAKE2b-256 05911bd4033c0dc288c8062e153bf54d0b47ea120619f0f40e7fcf42c9bb4b0d

See more details on using hashes here.

Provenance

The following attestation bundles were made for azure_functions_scaffold-0.4.0.tar.gz:

Publisher: publish-pypi.yml on yeongseon/azure-functions-scaffold

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file azure_functions_scaffold-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for azure_functions_scaffold-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6552209f902f4bbc8d6eb48bffa92e26bc90cb6257124c5636dc109c0df83664
MD5 03d62faef08db2b6bf6ee61803d1e170
BLAKE2b-256 e50764b7906bfc6939f1d61c1677474d6dc4db0626c893b89e99725183bbb02b

See more details on using hashes here.

Provenance

The following attestation bundles were made for azure_functions_scaffold-0.4.0-py3-none-any.whl:

Publisher: publish-pypi.yml on yeongseon/azure-functions-scaffold

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page