python-cross-web
Port variant v13
Summary Library for working with web frameworks (3.13)
Package version 0.7.0
Homepage https://github.com/usecross/cross-web
Keywords python
Maintainer Python Automaton
License Not yet specified
Other variants v14
Ravenports Buildsheet | History
Ravensource Port Directory | History
Last modified 22 MAY 2026, 14:41:05 UTC
Port created 18 JAN 2026, 19:34:33 UTC
Subpackage Descriptions
single # Cross **Write once, run everywhere** - A universal web framework adapter for Python that lets you write code once and use it across multiple web frameworks. ## Installation ```bash uv add cross-web ` `python from cross_web import Response ``` ## Overview Cross provides a unified interface for common web framework operations, allowing you to write framework-agnostic code that can be easily adapted to work with FastAPI, Flask, Django, and other popular Python web frameworks. ## Testing This project is in early development! Cross also ships framework-specific test clients under `cross_web.testing.clients`. Import a concrete client from its module: ```python from cross_web.testing.clients.starlette import StarletteHttpClient from cross_web.testing.clients.flask import FlaskHttpClient from cross_web.testing.clients.django import DjangoHttpClient ``` Do not import client classes from `cross_web.testing.clients` directly. The package only exports the shared base types so importing it does not pull optional framework dependencies. The shared testing API lives in `cross_web.testing`: ```python from cross_web.testing import HttpClient, Response ``` Every concrete client exposes the same async interface: - `await client.request(url, method, headers=None, **kwargs)` - `await client.get(url, headers=None, **kwargs)` - `await client.post(url, data=None, json=None, files=None, headers=None, **kwargs)` `Response` exposes: - `response.status_code` - `response.headers` - `response.text` - `response.json` ### Example ```python import json import pytest from starlette.applications import Starlette from starlette.requests import Request from starlette.responses import JSONResponse from starlette.routing import Route from cross_web.request._starlette import StarletteRequestAdapter from cross_web.testing.clients.starlette import StarletteHttpClient async def echo(request: Request) -> JSONResponse: adapter = StarletteRequestAdapter(request) body = await adapter.get_body() return JSONResponse( { "method": adapter.method, "query": dict(adapter.query_params), "body": json.loads(body.decode()), } ) app = Starlette(routes=[Route("/echo", echo, methods=["POST"])]) @pytest.mark.asyncio async def test_echo() -> None: client = StarletteHttpClient(app) response = await client.post("/echo?debug=1", json={"hello": "world"}) assert response.status_code == 200 assert response.json == { "method": "POST", "query": {"debug": "1"}, "body": {"hello": "world"}, }
Configuration Switches (platform-specific settings discarded)
PY313 ON Build using Python 3.13 PY314 OFF Build using Python 3.14
Package Dependencies by Type
Build (only) python313:dev:std
python-pip:single:v13
autoselect-python:single:std
Build and Runtime python313:primary:std
Runtime (only) python-typing-extensions:single:v13
Download groups
main mirror://PYPIWHL/7a/4a/78b52ec2edcbd9b123638f4e0421fd8699ebe653ebf63ac5f82abd2665bc
Distribution File Information
ddea9be3c68b48eaf16561847a5831a559786949c544b3701432e00a4e8d19d9 25207 python-src/cross_web-0.7.0-py3-none-any.whl
Ports that require python-cross-web:v13
python-strawberry-graphql:v13 Library for creating GraphQL APIs (3.13)