Skip to content
This repository was archived by the owner on Sep 18, 2023. It is now read-only.

DM-37921: Experimental client-server mono repo layout #193

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

jonathansick
Copy link
Member

No description provided.

Move the FastAPI application into a server directory; allowing us to add
a "client" library package directory off the repo root in the future.

I've chosen to keep the Dockerfile in the repo's right, even though it's
really for the server. I think this will be helpful when installing the
client package dependency during the docker builds.
FastAPI 0.91.0 updates how it handles middleware, and this seems to be
generating errors like

> Cannot add middleware after an application has started

We might need to look at updating our Safir middleware if this isn't an
error on FastAPI's part.
The library is set up as a namespace package; right now this uses
rubinobs.square.clients; but RSP clients might use lsst.rsp as their
base namespace package instead.
Caveats:

- To do a local install with tox we needed to disable hashing for the
requirements.txt files to avoid the "require hashes" mode. I don't know
how ot selectively disable this for tox. Potentially we could generate
multiple sets of requirements.txt files; with hashes and without?

- The client library currently needs to depend on Safir to get base
models from Safir.
This is useful for VSCode users to enable detection of the client
library codebase when looking at imports in the server code.

Not even installing the client into the current environment being used
by the editor solves this.
Use the hashed dependencies in the Docker build, but use unhashed
dependencies for tox to work around the requirement
for hashed dependencies with the local installation.
It's a separate job to support running as a matrix with potentially more
Python versions
Middleware needs to be set up in the application constructor rather than
in a startup event handler.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant