Muscles WSGI
muscles-wsgi is the WSGI runtime for Muscles. It provides page routing,
request/response handling, templates, static files, REST controllers and Swagger
UI on top of the shared muscles core.
Installation
pip install muscles-wsgi
Canonical ecosystem install matrix is documented in core: Muscles installation matrix.
Related Repositories
muscles- core contracts, routing, actions and canonical documentation.muscles-asgi- ASGI runtime with the same application model.muscles-cli- CLI projection and developer commands.muscles-mcp- MCP projection that can also expose WSGI/CLI adapters.muscles-benchmarks- WSGI regression and architecture checks.
Runtime
An app binds Context to WsgiStrategy:
from muscles import ApplicationMeta, Configurator, Context
from muscles.wsgi import WsgiStrategy
class App(metaclass=ApplicationMeta):
config = Configurator(obj={"main": {"HOST": "0.0.0.0", "PORT": "8080"}})
context = Context(WsgiStrategy, params={})
def run(self, *args):
return self.context.execute(*args, shutup=True)
WsgiStrategy now accepts explicit host and port keyword arguments and uses
standard WSGI environment keys such as PATH_INFO, QUERY_STRING and
wsgi.url_scheme.
Schema Ownership
WSGI does not ship its own muscles.wsgi.schema_ package. Framework schemas,
columns, fields, request/response bodies, security objects and value objects
belong to muscles.core.schema and should be imported from muscles:
from muscles import Column, JsonRequestBody, Model, String
ASGI/WSGI Parity
WSGI mirrors the ASGI developer-facing API. An application should be able to
switch from AsgiStrategy to WsgiStrategy without changing route groups,
OpenAPI metadata, guards, auth overrides, response helpers, file upload
handlers or typed handler arguments.
The WSGI package also exposes the same convenience layers:
from muscles.wsgi import MuscularWsgiApp, TestClient, wsgi_app
application = wsgi_app(MuscularWsgiApp())
client = TestClient(application).with_bearer("token")
response = client.post("/api/documents", json={"title": "Spec"})
Use auth=False on a route when a public endpoint such as /api/login lives
inside a protected API group.
REST API And Swagger
RestApi registers controllers and actions into the shared route structure.
Swagger is generated from those controller schemas, request bodies, parameters
and response bodies.
The generated OpenAPI paths include the mounted API prefix. If a controller
action is registered as /bookings under prefix /api/v1, the schema exposes
/api/v1/bookings.
More detail: docs/openapi-and-routing.md. Backend pipeline features are documented in docs/backend-pipeline.md. Russian documentation: docs/openapi-and-routing.ru.md and docs/backend-pipeline.ru.md.
Request Handling
The request parser supports standard WSGI input and does not require optional
system libraries to import. Multipart parsing uses the Python standard library;
python-magic is treated as optional.
WSGI strategy uses a persistent server lifecycle on strategy/app level, so
route cache is reused across requests while environ/start_response remain
strictly per-request state.
Development
Run tests with sibling packages on PYTHONPATH when working from source:
PYTHONPATH=../muscles/src:src python -m pytest -q
Production notes: docs/production.md.
Metadata
Release files for muscles-wsgi 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| muscles_wsgi-1.0.2.tar.gz | 191.4 kB | With provenance | Details for muscles_wsgi-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| muscles_wsgi-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for muscles_wsgi-1.0.2-py3-none-any.whl |
Total release size: 392.8 kB
Release files / muscles_wsgi-1.0.2.tar.gz
| Download URL | muscles_wsgi-1.0.2.tar.gz |
|---|---|
| Size | 191.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5536b3ff309d8e1c4d175c3473d67f4b40e851de55209ac5a436b612ad545d50
|
|
BLAKE2b-256 checksum How to use checksums |
5a479a8b10e866ceafd4709b5ca5520c3ee67f6e983195e6de60120d1e649eac
|
| 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 Aug 10, 2026.
Transparency logRelease files / muscles_wsgi-1.0.2-py3-none-any.whl
| Download URL | muscles_wsgi-1.0.2-py3-none-any.whl |
|---|---|
| Size | 201.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9665776a2878487a8280878330a1ed31903932dcea019c6089ea46dfc086a4da
|
|
BLAKE2b-256 checksum How to use checksums |
31ab8cc295c46655f0b620924dc972ad8f659427400e5d325dfe18349e181277
|
| 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 Aug 10, 2026.
Transparency logSecurity for muscles-wsgi 1.0.2
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 2 files in this release have been uploaded with provenance metadata.
Attestation for muscles_wsgi-1.0.2.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 Aug 10, 2026.
Transparency logA 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.