Skip to content

Switching to FastAPI#1

Open
javdrher wants to merge 7 commits intomasterfrom
fastapi
Open

Switching to FastAPI#1
javdrher wants to merge 7 commits intomasterfrom
fastapi

Conversation

@javdrher
Copy link

@javdrher javdrher commented Oct 2, 2025

Modernization of the template based on FastAPI and a more recent python version.

  • Based of python:3.12-slim default container, as highlighted here
  • Got rid of the error() helper, FastAPIs scheme for error handling is to throw basic HTTPExceptions, if required override the handler (which we did here). Note, its possible to register handlers for other types of exceptions as well making this mechanism very flexible
  • updated dockerfile and start.sh
  • use uvicorn (fastapi default)

@javdrher javdrher requested a review from nvdk October 2, 2025 13:52
@javdrher javdrher added the enhancement New feature or request label Oct 2, 2025
@madnificent
Copy link

I'm going to convert the branch of this PR to a PR against the mu-python-template on mu-semtech as it should be picked up there instead.

I second @nvdk 's observation on the error handler. Ideally the template can be kept backwards compatible.

We will likely make a feature-branch first which we will be able to extend with features which are now available in the Ruby and JavaScript templates. With the feature branch we should be unblocked.

chore: update documentation
feat: use uv package manager
@javdrher javdrher requested a review from madnificent October 10, 2025 11:33
@javdrher
Copy link
Author

@madnificent resolved that, also updated docs, introduced uv for dependency management (this is getting more and more traction and a lot faster) and was suggested by Peter in the advisory board.

Especially, have a look at the bottom section of the README for some considerations and how they were handled in the template.

@javdrher
Copy link
Author

@madnificent for testing I tried to convert the geocoding service to this image and ran into an issue with the python depedency installation because of missing system components (in this case g++) but I could immediately think of over 20 packages which depend on specific C/C++ libraries as they essentially provide wrappers.

I added compilers to the template, but also added an option to include a build.sh which can be used to install system dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants