Skip to main content

pyBearings

Bearings, the Free Pascal HTTP/1.1 server, as a WSGI server for Python. Linux only (x86_64 and ARM64); free-threaded Python works.

from bearings import serve

serve(app, port=8000)  # until SIGINT or SIGTERM

The event loops are Bearings' own threads and never run Python. Every request runs the WSGI app on a thread of the worker pool, so the app may block.

Server(app, **options) starts and stops a server from code (tests, a process that does other things): start(), port, stop(grace), wait(), metrics(), or with Server(app) as server:. Its docstring lists the options: the address, a Unix socket or an inherited socket, the number of event loops and workers, a queue limit answered with 503, a connection limit, the access log and the metrics.

With websocket=, a WebSocketHandler, the server also accepts WebSockets on ws_path: its opened, received and closed run on the worker pool, one event at a time per connection, and ws_send, ws_close, subscribe, unsubscribe and publish reach the connections by id, from any thread. A publish goes to every subscriber of a topic, encoded once.

The package loads libbearings.so (src/capi/ in this repository) with cffi in ABI mode, so it needs no C compiler: building the wheel needs Free Pascal 3.2.2 (fpc), which hatch_build.py runs.

Development

uv sync --python 3.14t     # compiles libbearings.so into src/bearings/
uv run pytest

Wheels

uv build --wheel builds the wheel for this machine's CPU (manylinux_2_34_x86_64 here). For ARM64, give it the cross compiler of tools/get-cross-aarch64.sh; the wheel is tagged for the CPU that compiler targets:

PYBEARINGS_FPC=../build/tools/bin/fpc-aarch64 uv build --wheel   # manylinux_2_34_aarch64

./test-aarch64.sh does that, installs the wheel in a free-threaded CPython for ARM64 run under qemu-user, and runs the tests against it. qemu-user runs on the host's memory model, which is stronger than ARM's: it shows that the wheel builds, loads and works, not races that only ARM hardware has.

Metadata

Release files for pybearings 0.1.0

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

Built distributions (wheels)

Table of built distributions (wheels) for pybearings 0.1.0
File Interpreter ABI Platform
pybearings-0.1.0-py3-none-manylinux_2_34_x86_64.whl Python 3 none Linux glibc 2.34+ x86-64 Details
pybearings-0.1.0-py3-none-manylinux_2_34_aarch64.whl Python 3 none Linux glibc 2.34+ ARM64 Details

Total release size: 1.2 MB

Release files / pybearings-0.1.0-py3-none-manylinux_2_34_x86_64.whl

Download URL pybearings-0.1.0-py3-none-manylinux_2_34_x86_64.whl
Size 607.5 kB
Tags Linux glibc 2.34+ x86-64 Python 3
SHA-256 checksum
How to use checksums
4a1b43c705cba3ee48b2292b888abb3315012feed1eeba115fb2cf6d5df105ad
BLAKE2b-256 checksum
How to use checksums
d96c3511d7c64190e24990510693f5f2efbb97a09b83814019a657d0ed0eda8e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / pybearings-0.1.0-py3-none-manylinux_2_34_aarch64.whl

Download URL pybearings-0.1.0-py3-none-manylinux_2_34_aarch64.whl
Size 603.6 kB
Tags Linux glibc 2.34+ ARM64 Python 3
SHA-256 checksum
How to use checksums
56329cd469bdf475b5a8ab0ef5bc684f71517f99610273d648265bb6e4b34b15
BLAKE2b-256 checksum
How to use checksums
c9054bd8538465252261abce46634b7237e56a70c13d106a7da03f2bb6954f9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

0.2.0

3 release files

This release

0.1.0 This release

2 release files

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