Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .cursor/rules/general.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
alwaysApply: true
---

## 1. Environment and Dependencies
- **Tooling**: Use `uv` for all package management.

## 2. Code Style and Formatting
- **Indentation**: Strictly use 2 spaces for indentation.
- **Quotes**: Use single quotes (`'`) for all strings. Use double quotes (`"`) only when a string contains a single quote.
- **Naming Conventions**:
- `snake_case` for all variables, functions, methods, files, and directories.
- `PascalCase` for all class names (e.g., `Pydantic` models, custom exceptions).
- **Boolean Variables**: Name boolean variables with an auxiliary verb prefix (e.g., `is_active`, `has_permission`, `should_send_email`).

## 3. Programming Paradigm and Structure
- **Functional Approach**: Prefer pure, standalone functions. Avoid classes unless necessary.
- **Class Usage Exceptions**: Use classes only for:
- Data structures (Pydantic models).
- Framework requirements (e.g., Django models, FastAPI routers).
- Custom exception types.
- **Modularity (DRY)**: Do not repeat code. Refactor any duplicated logic into reusable functions. Group related utility functions into separate modules (e.g., `utils/data_processing.py`).

## 4. API and Function Design
- **RORO Pattern**: All service-layer functions and API endpoint handlers must follow the "Receive an Object, Return an Object" pattern.
- **Data Contracts**: Use Pydantic models to define the "objects" for RORO. The input object should be a single Pydantic model, and the return value should be a single Pydantic model (or `None`).
19 changes: 19 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copy this file to .env and uncomment/modify values as needed

# =============================================================================
# Enviroment Variables
# =============================================================================

# Required: Your OpenAI API key for the Agents SDK to function.
OPENAI_API_KEY=sk-...
DEFAULT_MODEL=gpt-4o-mini

# Optional: The logging level for the application.
# Options: DEBUG, INFO, WARNING, ERROR
# Default: INFO
LOG_LEVEL=INFO

# Optional: The format for log output.
# Options: 'console' (for colored, human-readable logs) or 'json' (for structured logs).
# Default: console
LOG_FORMAT=console
64 changes: 64 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Cache uv
uses: actions/cache@v4
with:
path: ~/.cache/uv
key: ${{ runner.os }}-uv-${{ hashFiles('uv.lock') }}

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"

- name: Set up Python
run: uv python install 3.13
- name: Install dependencies
run: uv sync --extra dev

- name: Run ruff check
run: uv run ruff check .

- name: Run ruff format check
run: uv run ruff format --check .

test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.13"]

steps:
- uses: actions/checkout@v4

- name: Cache uv
uses: actions/cache@v4
with:
path: ~/.cache/uv
key: ${{ runner.os }}-uv-${{ hashFiles('uv.lock') }}

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"

- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}

- name: Install dependencies
run: uv sync --extra dev

- name: Run tests
run: uv run pytest --cov=main --cov=utils --cov-report=xml --cov-report=term-missing
207 changes: 207 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
dev-debug.log

# Dependency directories
node_modules/

# Environment variables
.env

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# OS specific
.DS_Store

# Task files
tasks.json
tasks/ # Created by https://www.toptal.com/developers/gitignore/api/python
# Edit at https://www.toptal.com/developers/gitignore?templates=python

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

### Python Patch ###
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
poetry.toml

# ruff
.ruff_cache/

# LSP config files
pyrightconfig.json

# End of https://www.toptal.com/developers/gitignore/api/python

outputs
data/raw/
42 changes: 42 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
- id: debug-statements
- id: check-docstring-first

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.8
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
hooks:
- id: mypy
files: ^topics/
args: [--ignore-missing-imports]
additional_dependencies: [types-requests]

- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.1
hooks:
- id: nbqa-ruff
files: \.ipynb$

- repo: local
hooks:
- id: pytest-check
name: pytest-check
entry: uv run pytest --co -q
language: system
pass_filenames: false
always_run: true
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.13
24 changes: 24 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# General Rules

## 1. Environment and Dependencies
- **Tooling**: Use `uv` for all package management.

## 2. Code Style and Formatting
- **Indentation**: Strictly use 2 spaces for indentation.
- **Quotes**: Use single quotes (`'`) for all strings. Use double quotes (`"`) only when a string contains a single quote.
- **Naming Conventions**:
- `snake_case` for all variables, functions, methods, files, and directories.
- `PascalCase` for all class names (e.g., `Pydantic` models, custom exceptions).
- **Boolean Variables**: Name boolean variables with an auxiliary verb prefix (e.g., `is_active`, `has_permission`, `should_send_email`).

## 3. Programming Paradigm and Structure
- **Functional Approach**: Prefer pure, standalone functions. Avoid classes unless necessary.
- **Class Usage Exceptions**: Use classes only for:
- Data structures (Pydantic models).
- Framework requirements (e.g., Django models, FastAPI routers).
- Custom exception types.
- **Modularity (DRY)**: Do not repeat code. Refactor any duplicated logic into reusable functions. Group related utility functions into separate modules (e.g., `utils/data_processing.py`).

## 4. API and Function Design
- **RORO Pattern**: All service-layer functions and API endpoint handlers must follow the "Receive an Object, Return an Object" pattern.
- **Data Contracts**: Use Pydantic models to define the "objects" for RORO. The input object should be a single Pydantic model, and the return value should be a single Pydantic model (or `None`).
Loading