Skip to content

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.

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 🚀

korikuzma
korikuzma previously approved these changes Jan 6, 2025
@jsstevenson jsstevenson requested a review from korikuzma January 8, 2025 13:02
Copy link
Member

Choose a reason for hiding this comment

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

Looks like there's still some merge conflicts that need resolved

Copy link
Member Author

Choose a reason for hiding this comment

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

good catch

@jsstevenson jsstevenson requested a review from korikuzma January 8, 2025 14:46
@jsstevenson jsstevenson merged commit 3cfc44c into main Jan 8, 2025
3 checks passed
@jsstevenson jsstevenson deleted the add-fastapi branch January 8, 2025 15:25
jsstevenson added a commit to cancervariants/disease-normalization that referenced this pull request Mar 12, 2025
#231)

* implement GenomicMedLab/software-templates#78
* Don't introduce env logic into DB construction, since I know that's a
whole can of worms (but it would be nice to do this eventually).
* Filled in some more documentation to have a place to briefly describe
this.

---------

Co-authored-by: Kori Kuzma <[email protected]>
jsstevenson added a commit to cancervariants/metakb that referenced this pull request Jul 1, 2025
Add `python-dotenv` to backend entry points.

This is a simple quality-of-life improvement driven by my unending
frustration with the mountain of environment variables upon which metakb
sits. Store a `.env` file in `server/` and it'll load env vars from
there.

* I have aspirations for a more featureful configuration experience. I'd
made an initial attempt
[here](GenomicMedLab/software-templates#78) but
I'm not totally happy with it. I have an issue
[here](GenomicMedLab/software-templates#106)
to take up someday where I try and do something better, but I think that
would entail implementation in all of the library dependencies first.
For now I think this PR is just fine though.
hmcostello pushed a commit to cancervariants/metakb that referenced this pull request Oct 17, 2025
Add `python-dotenv` to backend entry points.

This is a simple quality-of-life improvement driven by my unending
frustration with the mountain of environment variables upon which metakb
sits. Store a `.env` file in `server/` and it'll load env vars from
there.

* I have aspirations for a more featureful configuration experience. I'd
made an initial attempt
[here](GenomicMedLab/software-templates#78) but
I'm not totally happy with it. I have an issue
[here](GenomicMedLab/software-templates#106)
to take up someday where I try and do something better, but I think that
would entail implementation in all of the library dependencies first.
For now I think this PR is just fine though.
korikuzma pushed a commit to cancervariants/metakb that referenced this pull request Oct 30, 2025
Add `python-dotenv` to backend entry points.

This is a simple quality-of-life improvement driven by my unending
frustration with the mountain of environment variables upon which metakb
sits. Store a `.env` file in `server/` and it'll load env vars from
there.

* I have aspirations for a more featureful configuration experience. I'd
made an initial attempt
[here](GenomicMedLab/software-templates#78) but
I'm not totally happy with it. I have an issue
[here](GenomicMedLab/software-templates#106)
to take up someday where I try and do something better, but I think that
would entail implementation in all of the library dependencies first.
For now I think this PR is just fine though.
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

3 participants