Skip to content
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
4a106f5
Initial plan
Copilot Feb 4, 2026
aa5d60f
Add GitHub Actions, custom exceptions, tests, and dev infrastructure
Copilot Feb 4, 2026
715bb65
Enhance documentation and add comprehensive examples
Copilot Feb 4, 2026
7cef390
Address code review feedback and fix security issues
Copilot Feb 4, 2026
1c23bf6
Fix linting issues and format code with ruff
Copilot Feb 4, 2026
18441dd
Initial plan
Copilot Feb 5, 2026
08bea4e
Resolve merge conflicts: update license from MIT to GPL-3.0-only
Copilot Feb 5, 2026
49236e9
Apply ruff formatting to ensure code style compliance
Copilot Feb 5, 2026
9940179
Merge pull request #2 from mrMaxwellTheCat/copilot/resolve-merge-conf…
mrMaxwellTheCat Feb 5, 2026
ba31d97
Initial plan
Copilot Feb 5, 2026
599ede4
Fix Python version to 3.10+ for consistency with code syntax
Copilot Feb 5, 2026
02bee76
Merge pull request #3 from mrMaxwellTheCat/copilot/combine-to-main-br…
mrMaxwellTheCat Feb 5, 2026
d06e630
Agregar licencia GPLv3 al proyecto
mrMaxwellTheCat Feb 5, 2026
406b8b8
Eliminar archivo requirements.txt
mrMaxwellTheCat Feb 5, 2026
d557366
Actualizar .gitignore para incluir archivos temporales y específicos …
mrMaxwellTheCat Feb 5, 2026
6fc5a72
Agregar configuraciones de cobertura y ajustes en pytest en pyproject…
mrMaxwellTheCat Feb 5, 2026
f3ffd05
Actualizar configuración de CI para mejorar la instalación de depende…
mrMaxwellTheCat Feb 5, 2026
25f1ea9
Agregar pruebas para el módulo CLI, incluyendo comandos de construcci…
mrMaxwellTheCat Feb 5, 2026
f33a674
Agregar archivos de configuración y documentación: incluir dependabot…
mrMaxwellTheCat Feb 5, 2026
44595a1
Agregar plantillas de informes de errores y solicitudes de caracterís…
mrMaxwellTheCat Feb 5, 2026
07b27b3
Agregar resumen de implementación: mejoras en infraestructura crítica…
mrMaxwellTheCat Feb 5, 2026
5201645
Eliminar espacios en blanco innecesarios en el archivo de configuraci…
mrMaxwellTheCat Feb 5, 2026
814679c
Corregir formato de bloques de código en el README.md para mejorar la…
mrMaxwellTheCat Feb 5, 2026
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
76 changes: 76 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: CI

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

permissions:
contents: read

jobs:
lint:
name: Lint with Ruff
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff

- name: Run ruff check
run: ruff check .

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

type-check:
name: Type Check with mypy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Run mypy
run: mypy src --ignore-missing-imports

test:
name: Test with pytest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.8', '3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Run pytest
run: pytest tests/ -v --tb=short
42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Release

on:
push:
tags:
- 'v*'

permissions:
contents: read

jobs:
build-and-publish:
name: Build and Publish to PyPI
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write # Required for trusted publishing to PyPI

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build twine

- name: Build distribution
run: python -m build

- name: Check distribution
run: twine check dist/*

- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: twine upload dist/*
16 changes: 16 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.9
hooks:
- id: ruff
args: [--fix]
- id: ruff-format

- 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-merge-conflict
232 changes: 232 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
# Contributing to Anki Python Deck Tool

Thank you for your interest in contributing to the Anki Python Deck Tool! This document provides guidelines and instructions for contributing.

## Development Setup

### Prerequisites

- Python 3.8 or higher
- Git
- pip

### Setting Up Your Development Environment

1. **Clone the repository**:
```bash
git clone https://github.com/mrMaxwellTheCat/Anki-python-deck-tool.git
cd Anki-python-deck-tool
```

2. **Create a virtual environment**:
```bash
python -m venv venv

# On Windows:
.\venv\Scripts\activate

# On Linux/Mac:
source venv/bin/activate
```

3. **Install dependencies**:
```bash
# Install the package in editable mode with dev dependencies
pip install -e ".[dev]"

# Or use the Makefile
make dev
```

4. **Set up pre-commit hooks** (optional but recommended):
```bash
pre-commit install
```

## Development Workflow

### Running Tests

```bash
# Run all tests
pytest

# Run with coverage
pytest --cov=anki_tool

# Run specific test file
pytest tests/test_builder.py

# Or use the Makefile
make test
```

### Code Formatting and Linting

We use `ruff` for both linting and formatting:

```bash
# Format code
ruff format .

# Check linting issues
ruff check .

# Fix linting issues automatically
ruff check --fix .

# Or use the Makefile
make format
make lint
```

### Type Checking

We use `mypy` for static type checking:

```bash
# Run type checking
mypy src

# Or use the Makefile
make type-check
```

### Running All Checks

To run all checks before committing:

```bash
make all
```

## Code Style Guidelines

### Python Style

- Follow PEP 8 style guidelines
- Use Python 3.8+ type hints (use `list[str]` instead of `List[str]`)
- Maximum line length: 88 characters
- Use absolute imports (e.g., `from anki_tool.core import builder`)

### Documentation

- Use Google-style docstrings for all modules, classes, and public methods
- Include `Args:`, `Returns:`, and `Raises:` sections where applicable
- Example:

```python
def build_deck(data_path: str, config_path: str) -> str:
"""Build an Anki deck from YAML files.

Args:
data_path: Path to the data YAML file.
config_path: Path to the config YAML file.

Returns:
Path to the generated .apkg file.

Raises:
ConfigValidationError: If config file is invalid.
DataValidationError: If data file is invalid.
"""
pass
```

### Error Handling

- Use custom exceptions from `anki_tool.core.exceptions`
- Don't use bare `except:` blocks
- Always provide meaningful error messages

### Testing

- Write tests for all new features
- Aim for high code coverage
- Use descriptive test names that explain what is being tested
- Use `pytest` fixtures for common test setup

## Project Structure

```
anki-tool/
├── src/
│ └── anki_tool/
│ ├── __init__.py
│ ├── cli.py # CLI entry points
│ └── core/
│ ├── __init__.py
│ ├── builder.py # Deck building logic
│ ├── connector.py # AnkiConnect integration
│ └── exceptions.py # Custom exceptions
├── tests/
│ ├── __init__.py
│ ├── test_builder.py
│ ├── test_connector.py
│ └── test_exceptions.py
├── configs/ # Example config files
├── data/ # Example data files
├── .github/
│ └── workflows/ # CI/CD workflows
├── pyproject.toml
├── requirements.txt
└── README.md
```

## Submitting Changes

1. **Create a new branch** for your feature or bugfix:
```bash
git checkout -b feature/my-new-feature
```

2. **Make your changes** following the code style guidelines.

3. **Run all checks** to ensure your code meets quality standards:
```bash
make all
```

4. **Commit your changes** with a clear commit message:
```bash
git commit -m "Add feature: description of the feature"
```

5. **Push to your fork**:
```bash
git push origin feature/my-new-feature
```

6. **Create a Pull Request** on GitHub with:
- A clear title and description
- Reference to any related issues
- Screenshots for UI changes (if applicable)

## Reporting Issues

When reporting issues, please include:

- A clear description of the problem
- Steps to reproduce the issue
- Expected behavior vs. actual behavior
- Your environment (OS, Python version, etc.)
- Relevant logs or error messages

## Feature Requests

We welcome feature requests! Please:

- Check if a similar request already exists
- Provide a clear use case
- Explain why this feature would be useful
- Consider contributing the feature yourself

## Questions?

If you have questions about contributing, feel free to:

- Open a discussion on GitHub
- Check existing issues and pull requests
- Review the [README.md](README.md) for more information

Thank you for contributing to the Anki Python Deck Tool!
Loading
Loading