Skip to main content

Add your description here

Project description

Overview

A client-side library that wraps server-side functions to enable RPC-style frontend API calls without hiding HTTP implementation details.

How it works:

  • Import server functions decorated with FastAPI/Flask on the client side
  • Call them as regular functions; the library translates calls into HTTP requests
  • Handle the HTTP responses as per usual

A simple default HTTP implementation is included, but you can substitute your own with retry logic, caching, error handling, logging, etc.

# Simple GET request without parameters
greeting_message_http = wrap_backend_call(greeting_message)
response = greeting_message_http()
print(response)

# GET request with path and query parameters
get_item_http = wrap_backend_call(get_item)
response = get_item_http(item_id=42, query="test")
print(response)

# POST request with request body
create_item_http = wrap_backend_call(post_endpoint)
response = create_item_http(data=ItemData(id=1, name="A Box"))

# Example usage: POST request using a dictionary for the request body directly
response = create_item_http(data={"id": 1, "name": "Sample Item"})
print(response)

Why?

Working across HTTP boundaries introduces friction:

  1. Type information is lost — No type inference or validation for payloads and parameters sent from client to server
  2. Developers are forced to rely on out-of-band documentation — Type schema lives in OpenAPI/Swagger docs, not visible in your editor.

Benefits

  1. Type safety in the editor — Full type information available for IDE autocomplete and validation
  2. Endpoint schema visibility — Query params, path params, request body, headers, cookies are all immediately apparent in your code
  3. Docstring availability — Server function docstrings show up in the client IDE
  4. Code Generation not required — Additional tooling or auto-generated code Changes to server signatures are immediately caught on the client side.

Limitations

  1. Python-only — Works for Python clients and Python backends only (FFI support for other languages possible in future)
  2. Server code must be importable — Client needs access to server function definitions

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

http_clientlib-0.1.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

http_clientlib-0.1.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file http_clientlib-0.1.0.tar.gz.

File metadata

  • Download URL: http_clientlib-0.1.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.12

File hashes

Hashes for http_clientlib-0.1.0.tar.gz
Algorithm Hash digest
SHA256 796f2935d47d68b10896e2d5a7c9082eddd71f85ae93b7e19f771f7de9a26f29
MD5 d347ae5b8b1059ec177465615f3f3219
BLAKE2b-256 8a3e61e8b6fc518884f723b939b607f9c3ad71a51d512bee1c4168288ef19e6c

See more details on using hashes here.

File details

Details for the file http_clientlib-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for http_clientlib-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 831a5449dde5c3897bef70c32465767bdd1809eda0941f971fa3837886c475d6
MD5 b0922a8da23433e65e400c4d7fe5d239
BLAKE2b-256 8366a53db04f74f4ba3818fc17cdd2de5c6cc1e8895dcf52d60c87d3591eccbb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page