A FastAPI application with GraphQL API powered by Strawberry GraphQL, Elasticsearch, and Poetry for dependency management.
This GraphQL API provides access to gene annotation data, supporting queries for:
- Gene annotations and statistics
- Evidence models
- Term models
- Autocomplete functionality
- Python 3.10+
- Poetry (for dependency management)
- Docker & Docker Compose (for containerized deployment)
- Elasticsearch 8.5.0
# Install Poetry if not already installed
curl -sSL https://install.python-poetry.org | python3 -
# Install project dependencies
poetry installCopy the example environment file and configure your settings:
cp .env-example .envEdit .env with your specific configuration (Elasticsearch host, ports, etc.)
Activate the Poetry virtual environment and run the server:
# Activate Poetry shell
poetry shell
# Run with Python
python main.py
# Or run with Poetry
poetry run python main.pyThe API will be available at http://localhost:5000 (or your configured HOST_PORT)
Choose the appropriate Docker Compose configuration based on your needs:
docker-compose -f docker-compose-4G.yaml build
docker-compose -f docker-compose-4G.yaml up -ddocker-compose -f docker-compose-4G-kibana.yaml build
docker-compose -f docker-compose-4G-kibana.yaml up -ddocker-compose -f docker-compose-2G.yaml build
docker-compose -f docker-compose-2G.yaml up -dTo stop the services:
docker-compose -f <docker-compose-file> downOnce the server is running, access the GraphQL playground:
- Local:
http://localhost:5000/graphql - Docker:
http://localhost:<HOST_PORT>/graphql
# Run all tests
poetry run pytest
# Run with coverage
poetry run pytest --cov=src
# Run specific test file
poetry run pytest tests/test_graphql_api.py# Add a production dependency
poetry add package-name
# Add a development dependency
poetry add --group dev package-nameThe project uses:
- Pydantic for data validation
- Strawberry GraphQL for GraphQL schema and resolvers
- Pytest for testing
log.ini- Logging configuration for general uselog.local.ini- Logging configuration for local developmentlog.docker.ini- Logging configuration for Docker containerspytest.ini- Pytest configurationpyproject.toml- Poetry dependencies and project metadata
For questions or issues, contact: pantherfeedback@yahoo.com