Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

guardrails_api-0.0.3.tar.gz (36.0 kB view details)

Uploaded Source

Built Distribution

guardrails_api-0.0.3-py3-none-any.whl (46.5 kB view details)

Uploaded Python 3

File details

Details for the file guardrails_api-0.0.3.tar.gz.

File metadata

  • Download URL: guardrails_api-0.0.3.tar.gz
  • Upload date:
  • Size: 36.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for guardrails_api-0.0.3.tar.gz
Algorithm Hash digest
SHA256 f4e9b192ee3f2bfcba1453f4cca9d68aca5ccfe22adc82f104c449b283136b5d
MD5 9313c306eb851a5d410ed13d90885fbe
BLAKE2b-256 1ba0d0f4f1d797d9ba94bd7109867240acf5754e8d73c61bdfe5cf245eec49b0

See more details on using hashes here.

File details

Details for the file guardrails_api-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for guardrails_api-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 22f2ae1ea34fb36f9407078cd81924f756968477b4f079f0d82b329b1441552f
MD5 23d8909b0ca8e59af7383961cd8e65c2
BLAKE2b-256 1c2e0514c76731a52bed13a79129c39603ea6022ed3c64ae821cd7619f76da62

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page