mlrpc [Experimental]
Host REST APIs via FastAPI in Databricks Serverless Model serving via this rpc abstraction.
MLRPC does not modify your FastAPI code! It acts as a build step/proxy layer and invokes your FastAPI code in a databricks serverless model serving environment and routes to the right endpoints properly without you having to know about custom python models.
This is currently experimental in nature. If interest increases, will work on hardening and ensure it has a stable build and tests.
"If you know fastapi, you can deploy models on databricks model serving!"
Why FastAPI?
It is a modern, fast (high-performance), web framework for building APIs with Python 3.7+ based on standard Python type hints and pydantic. It is a great way to build APIs and has a lot of features that make it easy to use.
https://pypistats.org/packages/fastapi
Key features
- FastAPI: Host your FastAPI code in databricks
- Generate OpenAPI client objects
- Swagger UI to explore your endpoint
- Hot reload your FastAPI code to the remote endpoint
- Hot reloads of code are encrypted
- No need to manage your own pyfunc model
- Full support for environments (dev, test, prod) and interactive development
Limitations
- Only supports FastAPI
- Requires mlrpc client or follow spec to query the endpoint
- Does not yet support FastAPI lifecycle events
- Does not support websockets (model serving does not support websockets)
- Does not support SSE (server side events)
Installation
Use the cli to install the package
pip install -U 'mlrpc[cli]'
Instructions
Keep in mind that the cli has a lot of options but all of them are also managable via the config file.
1. Make a config file
mlrpc init
2. Edit the config file
## The following lines are minimum required config
## You need to have the app section
# [app]
# name = <app name>
# uc_catalog = <catalog name>
# uc_schema = <schema name>
# endpoint_name = <endpoint name>
# data_dir=data # this is optional if you want to upload larger binaries like chroma, sqlite, faiss, lancedb, etc
# Cost controls
# size = Small # Small, Medium, Large
# scale_to_zero_enabled = true # true, false
## The following lines are optional and not required
# latest_alias_name = <alternative alias> uses "current" by default
# experiment_name = <experiment name> # optional specify your experiment name
## Define where your code is
# app_root_dir = <root of your directory>
## The following lines are optional if you need secrets
# secret_scope = <secret scope in databricks>
# secret_key = <secret key>
# env_file = <location of your env file relative to this file>
## use this setting if you want to delete old versions
# only_last_n_versions=10
3. Deploy the artifacts
mlrpc build -p <databricks profile>
4. [OPTIONAL] verify in valid model deployment server locally
This may not work for you if your models require gpus or other resources that wont exist on your laptop
mlrpc local -p <databricks profile>
5. Deploy to model serving infra
mlrpc serve -p <databricks profile>
6. Explore the deployed endpoint via swagger proxy and hot reloading
mlrpc connect -p <databricks profile>
Disclaimer
mlrpc is not developed, endorsed not supported by Databricks. It is provided as-is; no warranty is derived from using this package. For more details, please refer to the license.
Metadata
Release files for mlrpc 0.11.0
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 | |
|---|---|---|---|---|
| mlrpc-0.11.0.tar.gz | 38.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mlrpc-0.11.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 76.5 kB
Release files / mlrpc-0.11.0.tar.gz
| Download URL | mlrpc-0.11.0.tar.gz |
|---|---|
| Size | 38.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bbb8d026a6c2588d9824a8210aa342a73eb1d6c6790b45563456920548898a32
|
|
BLAKE2b-256 checksum How to use checksums |
3201a05d717885aab103e3ba08f5f39a04fba4b065cb08f1228296da7078c726
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.10.8
|
Release files / mlrpc-0.11.0-py3-none-any.whl
| Download URL | mlrpc-0.11.0-py3-none-any.whl |
|---|---|
| Size | 38.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b85da02d6e774e3d291edbe62fb13b0335946ee5e91e30d49f872ce923cc46c7
|
|
BLAKE2b-256 checksum How to use checksums |
de60fe57e91a4ac96537c95757de5f1a6e840550f3bb2fb85745cfcf4766d9cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.10.8
|
Security for mlrpc 0.11.0
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.