A Python library for storing structured hierarchical data using a flat set of tables.
DORMATORY provides an efficient way to store and query hierarchical data structures in flat database tables. This approach offers better performance and simpler querying compared to traditional nested data structures while maintaining the hierarchical relationships.
- Store hierarchical data in flat table structures
- Efficient querying of parent-child relationships
- Support for complex nested data structures
- Type-safe data handling
- Optimized for read and write operations
- Comprehensive FastAPI REST API
- Full test suite with unit and integration tests
This project uses uv for dependency management.
# Clone the repository
git clone <repository-url>
cd dormatory
# Install dependencies
uv sync# Activate the virtual environment
uv shell
# Run the project
python main.py
# Start the API server
python server.py
# Run tests
uv run pytest
# Run tests with coverage
uv run pytest --cov=dormatory
# Run specific test categories
uv run pytest -m api # API tests only
uv run pytest -m unit # Unit tests only
uv run pytest -m integration # Integration tests onlyOnce the server is running, you can access:
- API Documentation: http://localhost:8000/docs
- ReDoc Documentation: http://localhost:8000/redoc
- Health Check: http://localhost:8000/health
dormatory/
βββ dormatory/
β βββ models/ # SQLAlchemy models
β βββ api/ # FastAPI application
β βββ routes/ # API route modules
β βββ main.py # FastAPI app configuration
βββ tests/ # Test suite
β βββ api/ # API endpoint tests
β βββ conftest.py # Test configuration
βββ examples/ # Usage examples
βββ main.py # Main entry point
βββ server.py # API server script
βββ pyproject.toml # Project configuration
βββ pytest.ini # Test configuration
βββ README.md # This file
βββ LICENSE # MIT License
βββ CONTRIBUTING.md # Contributing guidelines
βββ .gitignore # Git ignore rules
The project includes a comprehensive test suite:
- API Tests: FastAPI endpoint validation
- Unit Tests: Individual component testing
- Integration Tests: End-to-end functionality testing
# Run all tests
uv run pytest
# Run with verbose output
uv run pytest -v
# Run specific test file
uv run pytest tests/api/test_objects.py
# Run tests with coverage
uv run pytest --cov=dormatory --cov-report=html- 82 API tests - Currently failing (expected, endpoints not implemented)
- 10 main API tests - Passing (root, health, docs endpoints)
- Validation tests - Properly testing request/response validation
This project is licensed under the MIT License - see the LICENSE file for details.
We welcome contributions! Please see CONTRIBUTING.md for guidelines on how to fork the repository and contribute to the project.