Skip to content

An RMI WebAPI template that can serve as a foundation for developing other WebAPIs.

License

Notifications You must be signed in to change notification settings

RMI/web-api-poc

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ec8992f · Mar 20, 2025

History

31 Commits
Feb 27, 2025
Mar 19, 2025
Feb 28, 2025
Feb 27, 2025
Feb 14, 2025
Mar 19, 2025
Feb 14, 2025
Mar 6, 2025
Mar 6, 2025
Mar 20, 2025
Feb 27, 2025
Feb 22, 2025
Feb 27, 2025

Repository files navigation

web-api-poc

Test Status

This project is a proof-of-concept (POC) web API built using the FastAPI library.

Set-Up

Prerequisites

This project uses uv for environment and dependency management.

To install, follow the official installation guide.

Setup

  1. Clone the Repo
git clone https://github.com/RMI/web-api-poc
cd web-api-poc
  1. Create and Activate the Virtual Environment
uv venv .venv
source .venv/bin/activate # macOS/Linux
  1. Install Dependencies
uv sync

Running the API

Locally serve the Fast API with:

uv run src/main.py

Run Fast API in docker container with:

# build the image
docker compose build

# run the container
docker compose up

# do both
docker compose up --build

The API will be accessible at http://localhost.

Contributing

Dependency Management

Dependencies are managed using uv. To add a new library, run:

uv add <library>

Testing

Testing is implemented using the pytest library. Run all tests locally with:

uv run pytest

Or, you can run specific test suites with:

uv run pytest tests/test_unit.py        # to only run unit tests
uv run pytest tests/test_integration.py # to only run integration tests

For test-only dependencies, add them using:

uv add --dev <library>

Linting

This project follows the black code formatting standard. Lint code by running:

black path/to/file.py # to lint a single file
black .               # to lint the entire directory

Ensure that your code is properly formatted before submitting a pull request.

Deployment

TODO

License

This project is licensed under the MIT License