dploy-kickstart
Expose your Python functions via an HTTP API. dploy-kickstart is designed with a focus of making deployment of machine learning models as easy as possible with as clean of a contract as possible. This means that you will find configurations options that are less relevant outside of this domain.
Installation
pip install dploy_kickstart
When installed it provides a kickstart executable. Have a look at the help functionality: kickstart --help.
Usage
dploy_kickstart is a helper utility that can expose your Python functions as HTTP endpoints. Based on comment annotations it wraps your chosen functions to be served as API endpoints. It is meant to be used via the kickstart CLI, hence, it would generally not be used programmatically.
Let's say you have a script.py with @dploy comment annotations:
# @dploy endpoint echo
def echo_func(payload):
return payload
Serve this function with:
kickstart serve -e script.py
Let's try to call the endpoint via curl.
$ curl -d '{"foo":"bar"}' -H "Content-Type: application/json" -X POST http://localhost:8080/echo/
{"foo":"bar"}
Annotations
Following annotation options are currently available.
# @dploy endpoint {endpoint_path}
Will expose the annotated function on path {endpoint_path} with trailing slash (and redirect without trailing slash).# @dploy request_method {method}
Specify allowed request method.
default:post
available: any method supported by Flask# @dploy json_to_kwargs
Will map json payload's keys to function kwargs if supplied.
Endpoint utilities
Following paths are generated automatically:
GET /healthz: that always returns a 200GET /openapi.yaml: autogenerated OpenAPI Spec (WIP)
Current dependency tree
Aim is to keep this as small as possible to not clutter the user space.
$ poetry show --no-dev --tree
apispec 3.3.0 A pluggable API specification generator. Currently supports the OpenAPI Specification (f.k.a. the Swagger specification).
click 7.1.2 Composable command line interface toolkit
flask 1.1.2 A simple framework for building complex web applications.
├── click >=5.1
├── itsdangerous >=0.24
├── jinja2 >=2.10.1
│ └── markupsafe >=0.23
└── werkzeug >=0.15
paste 3.4.0 Tools for using a Web Server Gateway Interface stack
└── six >=1.4.0
waitress 1.4.3 Waitress WSGI server
Package naming
Isn't using underscores in package names discouraged? The reasoning behind the dploy_kickstart naming is that this utility is not meant to be used programmatically. Its meant to be used as a sidecar to user code that should be unaware of its existence, therefore, a longer name has a lower chance of clashing with user code. Yes, this is quite subjective.
Contributing
Questions, ideas, suggestions? Feel free to create issue or PR.
Metadata
Release files for dploy-kickstart 0.1.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dploy-kickstart-0.1.9.tar.gz | 11.0 kB | Without provenance | Details for dploy-kickstart-0.1.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dploy_kickstart-0.1.9-py3-none-any.whl | Python 3 | none | any | Details for dploy_kickstart-0.1.9-py3-none-any.whl |
Total release size: 22.7 kB
Release files / dploy-kickstart-0.1.9.tar.gz
| Download URL | dploy-kickstart-0.1.9.tar.gz |
|---|---|
| Size | 11.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
da9ad242d34913110fa8e9f6fa78391c0cbdde6c35632a9acd2f41b204620b02
|
|
BLAKE2b-256 checksum How to use checksums |
4987c4ef6cac68cbae213eadeaf5cf2bd4a3de270da94b271f6fbe6f01063b3c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.4 CPython/3.7.9 Linux/5.4.0-1031-azure
|
Release files / dploy_kickstart-0.1.9-py3-none-any.whl
| Download URL | dploy_kickstart-0.1.9-py3-none-any.whl |
|---|---|
| Size | 11.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4f074528b6b09874c1eea81a5a1129c781b1570532d6854a5768901c55b2f194
|
|
BLAKE2b-256 checksum How to use checksums |
a79b06fee4bc7b7416ef1cffe1980cfea5463b20a4d6475930b4f3d1c5555d62
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.4 CPython/3.7.9 Linux/5.4.0-1031-azure
|
Security for dploy-kickstart 0.1.9
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.