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
109 changes: 109 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: CI

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

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'

- name: Install dependencies
run: |
poetry install --with dev

- name: Run code quality checks
run: |
poetry run black --check .
poetry run isort --check-only .
poetry run flake8 .

- name: Run type checking
run: |
poetry run mypy boloco --ignore-missing-imports

- name: Run tests
run: |
poetry run pytest tests/ -v

- name: Test CLI functionality
run: |
poetry run boloco generate --max-tokens 3 --output-dir test_output --format json

test-extras:
runs-on: ubuntu-latest
strategy:
matrix:
extras: ["enhanced", "full"]

steps:
- uses: actions/checkout@v4

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: 'poetry'

- name: Install with ${{ matrix.extras }} extras
run: |
poetry install --with dev --extras ${{ matrix.extras }}

- name: Run tests with extras
run: |
poetry run pytest tests/ -v

- name: Test CLI with extras
run: |
poetry run boloco generate --max-tokens 5 --output-dir test_${{ matrix.extras }} --format all

build:
runs-on: ubuntu-latest
needs: [test, test-extras]

steps:
- uses: actions/checkout@v4

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: 'poetry'

- name: Build package
run: |
poetry build

- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
44 changes: 41 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,43 @@
# directories
.venv/
# Python
__pycache__/
*.py[cod]
*$py.class
*.so

# Distribution / packaging
build/
dist/
*.egg-info/
*.egg

# Testing
.pytest_cache/
.coverage
.coverage.*
htmlcov/

# Poetry virtual environments
.venv/

# Development tools
.mypy_cache/

# IDE
.vscode/
.idea/

# OS
.DS_Store
Thumbs.db

# files
# BoLoCo generated content
test_output/
demo_output/
quick_demo/
final_test/
test_cleaned/
test_refactored/
demo_final/
poetry_test/
*.jsonl
dataset*.json
36 changes: 36 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: check-merge-conflict
- id: debug-statements
- id: check-docstring-first

- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
- id: black
language_version: python3

- repo: https://github.com/pycqa/isort
rev: 5.11.4
hooks:
- id: isort
args: ["--profile", "black"]

- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
args: ["--max-line-length=88", "--extend-ignore=E203,W503"]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.991
hooks:
- id: mypy
additional_dependencies: [types-all]
args: ["--ignore-missing-imports"]
89 changes: 89 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
.PHONY: help install install-dev test test-verbose lint format type-check clean build publish run-cli demo

help: ## Show this help message
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'

install: ## Install basic dependencies
poetry install

install-dev: ## Install all dependencies including dev tools
poetry install --with dev

install-enhanced: ## Install with enhanced features (HuggingFace + Rich)
poetry install --with dev --extras enhanced

install-full: ## Install with all features
poetry install --with dev --extras full

test: ## Run tests
poetry run pytest tests/ -v

test-verbose: ## Run tests with verbose output
poetry run pytest tests/ -vv -s

test-coverage: ## Run tests with coverage report
poetry run pytest tests/ --cov=boloco --cov-report=html --cov-report=term

lint: ## Run linting checks
poetry run black --check .
poetry run isort --check-only .
poetry run flake8 .

format: ## Format code with black and isort
poetry run black .
poetry run isort .

type-check: ## Run type checking with mypy
poetry run mypy boloco --ignore-missing-imports

quality: ## Run all quality checks (lint + type-check)
@make lint
@make type-check

clean: ## Clean build artifacts and cache
rm -rf build/
rm -rf dist/
rm -rf *.egg-info/
rm -rf .pytest_cache/
rm -rf .mypy_cache/
rm -rf .coverage
rm -rf htmlcov/
find . -type d -name __pycache__ -delete
find . -type f -name "*.pyc" -delete

build: ## Build the package
poetry build

publish: ## Publish to PyPI (requires authentication)
poetry publish

publish-test: ## Publish to Test PyPI
poetry publish --repository testpypi

run-cli: ## Run the CLI with example parameters
poetry run boloco generate --max-tokens 5 --output-dir ./demo_output --format all

demo: ## Run a quick demo
poetry run boloco generate --max-tokens 3 --output-dir ./quick_demo --format json
@echo "Demo output saved to ./quick_demo/"

test-all: ## Run all tests and quality checks
@make quality
@make test

pre-commit-install: ## Install pre-commit hooks
poetry run pre-commit install

pre-commit-run: ## Run pre-commit on all files
poetry run pre-commit run --all-files

dev-setup: ## Complete development setup
@make install-dev
@make pre-commit-install
@echo "Development environment ready!"

version: ## Show current version
poetry version

shell: ## Open poetry shell
poetry shell
Loading
Loading