Skip to main content

veil-api

FastAPI-like Python bindings for the veil API server.

Accepting connections, TLS, HTTP/1.1, HTTP/2, HTTP/3, gRPC and OpenAPI serving are handled by the Rust data plane (io_uring on Linux), so Python only contains your handler functions, written with FastAPI-style decorators. The package is installed as veil-api and imported as veil.

Install

pip install veil-api
pip install "veil-api[grpc]"      # adds grpcio, for veil.grpc.Server (generated grpc_tools.protoc code)
pip install pydantic              # optional: body validation and schema generation with models

Pre-built wheels are published for:

  • Linux: manylinux and musllinux, x86_64 and aarch64
  • macOS: arm64 and x86_64
  • Windows: x86_64

All wheels are abi3, so one wheel works on every Python 3.9 or newer. Linux uses io_uring; the other platforms use the platform's native readiness API (kqueue, WSAPoll).

Quick start

import veil

@veil.get("/ping", offload=False)
def ping():
    return "pong"

@veil.get("/hello/{name}")
def hello(name: str, greeting: str = "Hello"):   # name: path parameter, greeting: query parameter
    return {"message": f"{greeting}, {name}"}

@veil.post("/users", status_code=201,
           body_constraints={"name": {"type": "string", "minLength": 1, "maxLength": 50, "required": True},
                             "age": {"type": "integer", "minimum": 0, "maximum": 120, "required": True}})
def create_user(body: dict):
    return body

veil.run(listen_cleartext="127.0.0.1:8000")      # stops gracefully on Ctrl-C / SIGTERM

You can also create an application object, as in FastAPI:

app = veil.App(title="Demo", version="1.0")

@app.get("/")
def index():
    return {"ok": True}

app.run(listen_cleartext="127.0.0.1:8000")

The server also serves /openapi.json and Swagger UI at /docs (disable with run(openapi=False)).

Handlers at a glance

  • Arguments are bound from the signature: a parameter named req/request (or annotated veil.Request) receives the request; a name that appears in the path is a path parameter (converted by its int/float/bool/str annotation); a pydantic BaseModel, dict/list annotation or the name body receives the JSON body; anything else is a query parameter. Missing or invalid values produce a FastAPI-style 422 response.
  • Return values: dict/list/numbers become JSON, str is text/plain, bytes is application/octet-stream, None is 204; veil.Response, veil.JSONResponse, (body, status) and pydantic models are also accepted. raise veil.HTTPException(404, "not found") produces {"detail": "not found"}. An unhandled exception is printed to stderr and answered with 500.
  • Streaming: generators (sync or async), veil.StreamingResponse, veil.EventSourceResponse (Server-Sent Events) and @veil.post(..., stream_body=True) for streamed request bodies.
  • gRPC: veil.grpc.unary_unary and friends (no dependencies), or veil.grpc.Server with grpcio-generated code.
  • WebSocket: Python handlers cannot terminate WebSocket connections; use Server-Sent Events or streaming responses for server push.
  • L4: @veil.l4_tcp and @veil.l4_udp for raw TCP and UDP listeners.
  • Configuration: veil.run(config_path=None, *, listen_cleartext=None, listen=None, tls_cert=None, tls_key=None, threads=None, overrides=None, openapi=True). overrides maps config keys to Python values, for example {"server.threads": 4}. Use listen with tls_cert and tls_key for TLS (HTTP/2 and HTTP/3).
  • Access log: one line per request is written to standard output by default ([access_log] enabled = true, format = "text"). Turn it off with overrides={"access_log.enabled": False}.

Threads and the GIL

Python handlers run while holding the GIL.

  • By default (offload=True) a handler runs on veil's handler thread pool ([api] handler_threads), so the I/O worker threads never wait for the GIL and keep serving connections. async def handlers run on one event loop per pool thread.
  • With offload=False the handler runs directly on the I/O worker thread. Use it only for trivially cheap handlers: blocking I/O or long GIL holds stall every connection that worker owns.
  • Pure Python handlers are limited by the GIL; for CPU-bound work consider a multi-process deployment.
  • Streaming responses are iterated on a handler pool thread. On an offload=False route the whole body is built before it is sent.

Documentation

Full documentation (quick start, routing, requests and responses, dependency injection, long-lived connections, gRPC, configuration and the API reference) is on Read the Docs: https://veil-api.readthedocs.io.

Source code, examples and issue tracker: https://github.com/aofusa/veil-proxy.

License

Apache-2.0 OR MIT

Metadata

Release files for veil-api 0.8.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for veil-api 0.8.3
File Size Uploaded Provenance
veil_api-0.8.3.tar.gz 3.0 MB With provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for veil-api 0.8.3
File
veil_api-0.8.3-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
veil_api-0.8.3-cp39-abi3-musllinux_1_2_x86_64.whl CPython 3.9 abi3 Linux musl 1.2+ x86-64 Details
veil_api-0.8.3-cp39-abi3-musllinux_1_2_aarch64.whl CPython 3.9 abi3 Linux musl 1.2+ ARM64 Details
veil_api-0.8.3-cp39-abi3-manylinux_2_28_x86_64.whl CPython 3.9 abi3 Linux glibc 2.28+ x86-64 Details
veil_api-0.8.3-cp39-abi3-manylinux_2_28_aarch64.whl CPython 3.9 abi3 Linux glibc 2.28+ ARM64 Details
veil_api-0.8.3-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details
veil_api-0.8.3-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details

Total release size: 51.8 MB

Release files / veil_api-0.8.3.tar.gz

Download URL veil_api-0.8.3.tar.gz
Size 3.0 MB
Tags Source
SHA-256 checksum
How to use checksums
4f8f1b1c01efee8eba07bd0ab069c796c7ce8a5785f3b72773ce09b2cd9e5f98
BLAKE2b-256 checksum
How to use checksums
20802dff88dc2de490bb50107ad768e5d631ef45bbc896fdace8b93d0088e437
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / veil_api-0.8.3-cp39-abi3-win_amd64.whl

Download URL veil_api-0.8.3-cp39-abi3-win_amd64.whl
Size 6.8 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
7bc01aefbe310fbe3825c9675f7f686ba36e5b6590093d402f10d2750deae4c0
BLAKE2b-256 checksum
How to use checksums
06972dbce02d58864118c2597d2048346d59db87121b5856f867aa46d90ed4f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / veil_api-0.8.3-cp39-abi3-musllinux_1_2_x86_64.whl

Download URL veil_api-0.8.3-cp39-abi3-musllinux_1_2_x86_64.whl
Size 7.3 MB
Tags CPython 3.9 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
3f547e7d8f31630cfc03fb725290cd411fa4993b193215eeaf8450db26540499
BLAKE2b-256 checksum
How to use checksums
7944fb41b87ad582f4f15efa0e4fb53d70be4366bf2338d71b82669e8cad7f88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / veil_api-0.8.3-cp39-abi3-musllinux_1_2_aarch64.whl

Download URL veil_api-0.8.3-cp39-abi3-musllinux_1_2_aarch64.whl
Size 7.1 MB
Tags CPython 3.9 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
8b3649048960d05b568d17574b3bd42261a0112f6214211d7d8cb4f4771f55f4
BLAKE2b-256 checksum
How to use checksums
2acff5a42c25a77ddf69bb06c04756615b2e31872a1630ded74100479676e666
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / veil_api-0.8.3-cp39-abi3-manylinux_2_28_x86_64.whl

Download URL veil_api-0.8.3-cp39-abi3-manylinux_2_28_x86_64.whl
Size 7.0 MB
Tags CPython 3.9 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
8aeb10dd8e93d2b5fdbe0d07adf00de21e8a5da9a741127a933933d38f60a098
BLAKE2b-256 checksum
How to use checksums
be19e9a5c012ef2d405a10e1b4423d115e2f969306317d865eefcca6b9fd40aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / veil_api-0.8.3-cp39-abi3-manylinux_2_28_aarch64.whl

Download URL veil_api-0.8.3-cp39-abi3-manylinux_2_28_aarch64.whl
Size 6.9 MB
Tags CPython 3.9 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
66e545ad39ca7f00c20e55d9372fd87adf7828e1047ff78eef1ff851813eebd0
BLAKE2b-256 checksum
How to use checksums
e3ef071c97f665c1fb03c41293ead6ac37ae1fd70722149e89b0e68750a6d28c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / veil_api-0.8.3-cp39-abi3-macosx_11_0_arm64.whl

Download URL veil_api-0.8.3-cp39-abi3-macosx_11_0_arm64.whl
Size 6.6 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
aad0d67ac2e8439e13569ed66392f2ac1c6e8e3b33308a74cf9f4cca1b3d709a
BLAKE2b-256 checksum
How to use checksums
843aeb3a6d1483385b19b37d425c230e8655f03855e8d5889589f2428a5e7277
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / veil_api-0.8.3-cp39-abi3-macosx_10_12_x86_64.whl

Download URL veil_api-0.8.3-cp39-abi3-macosx_10_12_x86_64.whl
Size 7.0 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
ccba119997d282a0c4dc3be91945ddae0664e057f1f8ff4ffb46a060dbb10ea3
BLAKE2b-256 checksum
How to use checksums
c5ea3f6e7e44df50c42df7517d9469c71777968a2ea1141db655cbd9e6e55407
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Security for veil-api 0.8.3

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.

Full provenance

All 8 files in this release have been uploaded with provenance metadata.

Select from 8 files

Attestation for veil_api-0.8.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page