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.4

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.4
File Size Uploaded Provenance
veil_api-0.8.4.tar.gz 3.1 MB With provenance Details

Built distributions (wheels)

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

Total release size: 52.0 MB

Release files / veil_api-0.8.4.tar.gz

Download URL veil_api-0.8.4.tar.gz
Size 3.1 MB
Tags Source
SHA-256 checksum
How to use checksums
b03d061eb3b83725fa9abe2ea3a76242e475a2aa7131bba72f90afc175bf7270
BLAKE2b-256 checksum
How to use checksums
c42fb08d402ff7cf7d27e61b5cabac949b3aec35da44cc8f35f2cf87423f91d5
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 23, 2026.

Transparency log

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

Download URL veil_api-0.8.4-cp39-abi3-win_amd64.whl
Size 6.8 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
697eebd5f36967e1701973824e0698c82a6d256d05ea653083b3d8cd337e3985
BLAKE2b-256 checksum
How to use checksums
35d31cf91070ef43ec7e7952da4ce5e17f0635bad0597c560e885407a5efedbf
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 23, 2026.

Transparency log

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

Download URL veil_api-0.8.4-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
1538f157c0978093d1fd3b8bf2fc333620c319f155cbb1f7a59e9b4604b7ea81
BLAKE2b-256 checksum
How to use checksums
8730f7449a44c1c835b241ab605af6c6007396fcf8b77c1578ecfd0eacd097f7
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 23, 2026.

Transparency log

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

Download URL veil_api-0.8.4-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
5f436ab9918bc86d23d613dbe02a72183a713dc55b5ebb40179ec77a96592fd0
BLAKE2b-256 checksum
How to use checksums
c5327124917ba185a53b452f8ac3af34c7a01d3f07006075f399ffcd194414cb
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 23, 2026.

Transparency log

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

Download URL veil_api-0.8.4-cp39-abi3-manylinux_2_28_x86_64.whl
Size 7.1 MB
Tags CPython 3.9 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
10b29d26779c6781dcc7adcc1934286aa0b5eb5003960fdb4a50030ade9ca103
BLAKE2b-256 checksum
How to use checksums
848a12e3544ae2678883f29bc6d0f8df9b3cdf0c575e89a89b6e549390cb7b3e
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 23, 2026.

Transparency log

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

Download URL veil_api-0.8.4-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
e98350b79cab2b77442c2b725297def0151e420bddcfb193c4aa3f291770375f
BLAKE2b-256 checksum
How to use checksums
9230399b23a87de7bc92e264e465f7a728d36e6fb64b67717cc6a66ab296f794
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 23, 2026.

Transparency log

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

Download URL veil_api-0.8.4-cp39-abi3-macosx_11_0_arm64.whl
Size 6.7 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
bf3c04170ab8430ddd636d888ea5a56c352bc99c66b715bf38fd6cdba23bd048
BLAKE2b-256 checksum
How to use checksums
83e16dcc6689f2aa5817163a80bd1efb99087710984cd131592f3a7c2600b28b
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 23, 2026.

Transparency log

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

Download URL veil_api-0.8.4-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
19ad359653b1b7262df3f77b023c253b630e059f7b8f87dc6c9965555c1333fc
BLAKE2b-256 checksum
How to use checksums
ba28978f303970df7e8e013a33860679526dee78e3e841b520ccfc6d877fc725
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 23, 2026.

Transparency log

Security for veil-api 0.8.4

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.4.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 23, 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.

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