Skip to content

feat(dev): add local Function App server - #3188

Draft
trygveu wants to merge 2 commits into
mainfrom
cdf-dev-function-serve-cli
Draft

feat(dev): add local Function App server#3188
trygveu wants to merge 2 commits into
mainfrom
cdf-dev-function-serve-cli

Conversation

@trygveu

@trygveu trygveu commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Description

Adds cdf dev function serve for local Cognite Function App development. The command starts the Function Apps ASGI development server with Toolkit authentication in either default reload or --no-reload mode.

The command is protected by the hidden FUNCTION_APPS alpha flag. Enable it in cdf.toml:

[alpha_flags]
function_apps = true

Install its optional dependencies with:

uv sync --extra serve

Safety and behavior

  • Refuses to start against CDF_BUILD_TYPE=prod.
  • Validates that the target is a Function App handler.
  • Keeps reload imports scoped to the handler directory and cleans temporary state on all tested failure paths.
  • Uses Toolkit environment authentication for local requests.

Validation

  • uv run pytest tests/test_unit -n8 — 3260 passed, 32 skipped
  • Focused command and feature-flag tests — 11 passed
  • uv run ruff check ... and uv run mypy ...
  • uv run pre-commit run --show-diff-on-failure --color=always --all-files
  • Real sibling Function App smoke with --no-reload: /internal/health and /docs return 200
  • Real sibling Function App smoke with reload: /internal/health and /docs return 200
  • Editing a disposable handler.py copy triggers reload and serves health successfully afterward

Coverage note

Coverage cannot currently collect any Toolkit tests in this environment: pytest-cov fails before collection while the existing Pandas/NumPy import chain initializes (numpy: cannot load module more than once per process). The ordinary full test suite is unaffected.

Bump

  • Patch
  • Skip

Register a feature-gated development server for Function Apps with reload support and Toolkit authentication.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@trygveu
trygveu requested review from a team as code owners September 2, 2026 10:49
@gemini-code-assist

Copy link
Copy Markdown
Contributor
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

@trygveu
trygveu marked this pull request as draft September 7, 2026 12:46
CI runners force ANSI color, which makes Rich split option names like
--host across style codes, breaking substring assertions on rendered
help text. Also fixes an import-order lint flagged by CI's pinned
Ruff version.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant