Guardrails API
Project description
guardrails-poc
Docker compose stub of Guardrails as a Service
Setting Up
We strongly encourage you to use a virtual environment when developing in python. To set one up for this project run the following:
python3 -m venv ./.venv
source ./.venv/bin/activate
Your terminal should now show that you are working from within the virtual environment. Now you can install the dependencies:
make install
And start the dev server:
make start
Once the service has launched, you should be able to navigate to the Swagger documenation for the guardrails-api at http://localhost:8000
Local Infrastructure
By default, the server will start with an in-memory store for Guards. As of June 4th, 2024 this store does not support write operations via the API. In order to utilize all CRUD operations you will need a postgres database running locally and you will need to provide the following environment variables (sane defaults included for demonstration purposes):
export PGPORT=5432
export PGDATABASE=postgres
export PGHOST=localhost
export PGUSER=${PGUSER:-postgres}
export PGPASSWORD=${PGPASSWORD:-changeme}
You can create this database however you wish, but we do have a docker-compose configuration to stand up the database as well as a local opentelemetry stack. To use this make sure you have docker installed, then run:
docker compose --profile db up --build
to run just the database.
docker compose --profile infra up --build
to run the database and opentelemetry infrastructure
or
docker compose --profile all up --build
to run everything including the guardrails-api
The last option is useful when checking that everything will work as planned in a more productionized environment. When developing, it's generally faster to just run the minimum infrastructure you need via docker and run the api on a bare process with the make start
command.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file guardrails_api-0.0.0a5.tar.gz
.
File metadata
- Download URL: guardrails_api-0.0.0a5.tar.gz
- Upload date:
- Size: 32.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9be0920479e656e3ddfce2fd609ab386094ec6798766c77e9c66ad25a529e3f |
|
MD5 | a0c89b37c11c887aa27abae43c6c1c2f |
|
BLAKE2b-256 | 4a320c44f9a9f92bc204593cc1c788080610bda2e0e7124e0dbfc8523ba665da |
File details
Details for the file guardrails_api-0.0.0a5-py3-none-any.whl
.
File metadata
- Download URL: guardrails_api-0.0.0a5-py3-none-any.whl
- Upload date:
- Size: 41.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34150d0972897c9f6d1cbfb90e863a38187dd62d88c91095ae5f7aecc569d40d |
|
MD5 | 58f130c2512dd0bc3c29de4218e7d81e |
|
BLAKE2b-256 | a92d0573565f305ffa6d89e5687b4a773c5ab90d9a84bb4d53de1efc82da572f |