Skip to content
Merged
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
26 changes: 10 additions & 16 deletions python/hello/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,20 @@

## Introduction

A Python HTTP function built with ASGI protocol support. The implementation
provides a simple HTTP endpoint that responds with "Hello World!" to incoming
A Python HTTP function built with ASGI protocol support. The implementation
provides a simple HTTP endpoint that responds with "Hello World!" to incoming
requests.

The function is structured as a class-based implementation with proper lifecycle
management, including configurable startup and shutdown hooks.

## Recommended Deployment
## Deployment

> [!NOTE]
> We recommend using the host builder.
> This feature is currently behind a flag because its not available for all the
> languages yet so you will need to enable it.
> We recommend using the host builder

```bash
# Enable the host builder
export FUNC_ENABLE_HOST_BUILDER=1

# Deploy your code to cluster
# Make sure to set the builder to use it
func deploy --builder=host

# Local development and testing
Expand All @@ -42,7 +36,7 @@ The function provides lifecycle hooks:

## Testing

The function includes unit tests that verify the HTTP handler behavior.
The function includes unit tests that verify the HTTP handler behavior.
Tests are located in the `tests/` directory and use pytest with asyncio support.

To run the tests:
Expand All @@ -60,14 +54,14 @@ pytest -v

### Test Structure

Tests are organized in the `tests/` directory with the current test file
Tests are organized in the `tests/` directory with the current test file
`test_func.py` verifying that the ASGI handler returns a proper 200 OK response.
The testing framework uses pytest with asyncio support, configured in `pyproject.toml`.

### Writing New Tests

To add new tests, create files named `test_*.py` in the `tests/` directory.
For async functions, use the `@pytest.mark.asyncio` decorator. Mock ASGI
components by creating mock `scope`, `receive`, and `send` functions as shown
in the existing test. You can also test lifecycle methods like `start()`,
To add new tests, create files named `test_*.py` in the `tests/` directory.
For async functions, use the `@pytest.mark.asyncio` decorator. Mock ASGI
components by creating mock `scope`, `receive`, and `send` functions as shown
in the existing test. You can also test lifecycle methods like `start()`,
`stop()`, `alive()`, and `ready()` by calling them directly on a function instance.
Loading