Skip to content

Commit

Permalink
feat: enable Paketo builders for Python functions (#979)
Browse files Browse the repository at this point in the history
This commit changes the Python functions to use the open source Paketo
builders. The Paketo builders allow the use of a Procfile to indicate
the desired default start process for the container, so this has been
added to invoke Parliament at startup.

Also, there were no README.md files for Python, so I added them too.

Signed-off-by: Lance Ball <lball@redhat.com>
  • Loading branch information
lance committed Apr 20, 2022
1 parent 67b43ee commit 5af934b
Show file tree
Hide file tree
Showing 7 changed files with 13,942 additions and 13,843 deletions.
1 change: 1 addition & 0 deletions buildpacks/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ var DefaultBuilderImages = map[string]string{
"node": "gcr.io/paketo-buildpacks/builder:base",
"typescript": "gcr.io/paketo-buildpacks/builder:base",
"go": "gcr.io/paketo-buildpacks/builder:base",
"python": "gcr.io/paketo-buildpacks/builder:base",
}

//Builder holds the configuration that will be passed to
Expand Down
1 change: 1 addition & 0 deletions templates/python/cloudevents/Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: python -m parliament .
29 changes: 29 additions & 0 deletions templates/python/cloudevents/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Python CloudEvents Function

Welcome to your new Python function project! The boilerplate function
code can be found in [`func.py`](./func.py). This function is meant
to respond to [Cloud Events](https://cloudevents.io/).

## Endpoints

Running this function will expose three endpoints.

* `/` The endpoint for your function.
* `/health/readiness` The endpoint for a readiness health check
* `/health/liveness` The endpoint for a liveness health check

The health checks can be accessed in your browser at
[http://localhost:8080/health/readiness]() and
[http://localhost:8080/health/liveness]().

You can use `func invoke` to send an event to the function endpoint.


## Testing

This function project includes a [unit test](./test_func.py). Update this
as you add business logic to your function in order to test its behavior.

```console
python test_func.py
```
1 change: 1 addition & 0 deletions templates/python/http/Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: python -m parliament .
29 changes: 29 additions & 0 deletions templates/python/http/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Python HTTP Function

Welcome to your new Python function project! The boilerplate function
code can be found in [`func.py`](./func.py). This function will respond
to incoming HTTP GET and POST requests.

## Endpoints

Running this function will expose three endpoints.

* `/` The endpoint for your function.
* `/health/readiness` The endpoint for a readiness health check
* `/health/liveness` The endpoint for a liveness health check

The health checks can be accessed in your browser at
[http://localhost:8080/health/readiness]() and
[http://localhost:8080/health/liveness]().

You can use `func invoke` to send an HTTP request to the function endpoint.


## Testing

This function project includes a [unit test](./test_func.py). Update this
as you add business logic to your function in order to test its behavior.

```console
python test_func.py
```
2 changes: 0 additions & 2 deletions templates/python/manifest.yaml

This file was deleted.

27,722 changes: 13,881 additions & 13,841 deletions zz_filesystem_generated.go

Large diffs are not rendered by default.

0 comments on commit 5af934b

Please sign in to comment.