tilie_server.app#
Compose the server’s routes, static editor, and security middleware.
- tilie_server.app.API_METHODS = ['GET', 'HEAD', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS']#
The methods for which a public server answers an unserved
/api/path 404.
- tilie_server.app.load_arrow()[source]#
Import pyarrow, where it is installed, on the thread that calls this.
The routes that compute with timetoalign import it, and pyarrow with it, when a request needs them: on a worker thread, which ends once it is idle. A process in which pyarrow was first imported on a thread that has since ended is ended by a segmentation fault when another thread allocates Arrow memory (seen with pyarrow 25.0.0 and its mimalloc pool). So the thread that builds the application, which lives as long as the server, imports pyarrow first. A server without pyarrow still starts; its routes say what they cannot do.
- Return type:
None
- tilie_server.app.create_app(settings, *, musicbrainz=None)[source]#
Build the application for one run, local or public.
A local run answers to its loopback origin with the run’s bearer token and serves the file routes. A public run answers as its public hosts, checks no token, serves no file routes, bounds every request body and every posted table, and runs a limited number of computations at once; every
/api/path no route serves then answers 404 for each method ofAPI_METHODS(any other method 405), so no request to the API reaches the editor’s files.- Parameters:
settings (ServerSettings) – The run’s hosts, token, editor files, root folder, file access, body limit, table bounds and limit of computations.
musicbrainz (MusicBrainz | None) – The one client of MusicBrainz for the run’s lookups; a new
MusicBrainzwhen not given.
- Return type:
FastAPI