Skip to content

unmtransinfo/TICTAC-API

Repository files navigation

TICTAC API

Currently in the initial development phase.


Development Setup

Prerequisites

  • Docker
  • Docker Compose

Steps

  1. Start the development environment:

    docker compose --env-file .env.dev -f docker-compose.dev.yml up --build
  2. Access the API:

  3. Stop the environment:

    docker compose -f docker-compose.dev.yml down
  4. (Optional - only if you want a completely clean slate) stop and remove volumes:

    docker compose -f docker-compose.dev.yml down -v

Configuration

Environment variables are configured in .env.dev:

  • DB_NAME, DB_USER, DB_PASSWORD, DB_PORT - Database configuration
  • POSTGRES_PASSWORD - PostgreSQL superuser password
  • APP_PORT - API port (default: 8000)

Development Notes

Upgrading Dependencies

If one finds they need to update dependencies (requirements.txt), the following steps can be followed:

  1. If a new package is required, add it to requirements.in
  2. Setup and activate a Python (v3.14) virtual environment. For example, with conda use:
    conda create -n tictac-api python=3.14 && conda activate tictac-api
    
  3. Install pip-tools: pip install pip-tools
  4. Compile new requirements: pip-compile --upgrade
  5. (Optional) Test the update locally in your environment: pip-sync

Note: If you need to update the Python version, make sure to adjust the steps above accordingly and to update the Python image in the Dockerfile.

Code Formatting with Pre-commit Hooks

This project uses pre-commit hooks to automatically format Python code with Black before each commit. This ensures consistent code style across the project.

Setup (one-time):

  1. Setup and activate a Python (v3.14) virtual environment if you haven't already:

    conda create -n tictac-api python=3.14 && conda activate tictac-api
  2. Install dependencies:

    pip install -r requirements.txt
  3. Install the pre-commit hooks:

    pre-commit install

Usage:

Once installed, the hooks will run automatically on git commit. If Black reformats any files, the commit will be aborted and you'll need to:

  1. Review the changes Black made
  2. Stage the reformatted files: git add <files>
  3. Commit again: git commit

Manual formatting:

You can also run Black manually on all files:

black .

Or run all pre-commit hooks manually without committing:

pre-commit run --all-files

Configuration:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •