Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add fastapi + service_info endpoint #78

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open

Conversation

jsstevenson
Copy link
Member

@jsstevenson jsstevenson commented Dec 31, 2024

close #75

this became much bigger than planned, but it reflects a few aspirations for what a service-like application should probably look like

  • FastAPI api.py module, including a /service_info endpoint conforming to the GA4GH spec. I didn't bother implementing updatedAt (it's optional) because I think it'd be kind of a hassle to update a datetime object every time we make a release. Maybe there's a way to automate this but not a priority IMO.
  • An API tests module with reasonable coverage
  • A library config module. I don't think we have any services right now that quite map to the dev/test/staging/prod schema (I took this from rails), but some are pretty close and we could tweak as needed. The idea here is that it's a central source of truth about what kind of an environment the app is running in, and then other modules (like a database module or the main API views module) refer to it when making environment-based decisions. The individual settings here (test and debug) are sort of general/predictive of what we might need in a given app. Lots of examples online also set a DB URL or DB connection configs here as well. (I also looked at pydantic-settings for this but I think it's a lot more than we need. )
  • A logging setup module. This would also be shared with a CLI module (which is my next project for this repo).
  • Add FAST rules from ruff. This depends on the Ruff update PR.

The service info spec lets you add your own additional fields if desired. For DGIdb, Adam added a "data version" field, for example. There's probably things we could do there for many of our APIs.

@jsstevenson jsstevenson added the priority:medium Medium priority label Dec 31, 2024
@jsstevenson
Copy link
Member Author

oh, a possible TODO here is that ruff includes a fastapi-specific set of lints we could use

korikuzma
korikuzma previously approved these changes Jan 3, 2025
Copy link
Member

@korikuzma korikuzma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority:medium Medium priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add add_fastapi option to Python template
2 participants