Skip to content

Commit 959fc3a

Browse files
Merge pull request #46 from MarkusNeusinger/copilot/setup-copilot-instructions
Add .github/copilot-instructions.md for Copilot coding agent
2 parents b7789b6 + de7fcc4 commit 959fc3a

1 file changed

Lines changed: 124 additions & 0 deletions

File tree

.github/copilot-instructions.md

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# Copilot Instructions
2+
3+
This file provides guidance to GitHub Copilot when working with code in this repository.
4+
5+
## Project Overview
6+
7+
**pyplots** is an AI-powered platform for Python data visualization that automatically discovers, generates, tests, and maintains plotting examples. The platform is specification-driven: every plot starts as a library-agnostic Markdown spec, then AI generates implementations for all supported libraries.
8+
9+
**Supported Libraries** (8 total):
10+
- matplotlib, seaborn, plotly, bokeh, altair, plotnine, pygal, highcharts
11+
12+
**Core Principle**: Community proposes plot ideas via GitHub Issues → AI generates code → Multi-LLM quality checks → Deployed.
13+
14+
## Development Setup
15+
16+
```bash
17+
# Install dependencies (uses uv - fast Python package manager)
18+
uv sync --all-extras
19+
20+
# Run all tests
21+
uv run pytest
22+
23+
# Check code formatting and linting
24+
uv run ruff check .
25+
26+
# Auto-fix issues
27+
uv run ruff check . --fix
28+
29+
# Format code
30+
uv run ruff format .
31+
```
32+
33+
### Frontend Development
34+
35+
```bash
36+
cd app
37+
yarn install
38+
yarn dev # Development server
39+
yarn build # Production build
40+
```
41+
42+
## Architecture
43+
44+
### Specification-First Design
45+
46+
Every plot follows this flow:
47+
```
48+
specs/{spec-id}.md → plots/{library}/{plot-type}/{spec-id}/default.py
49+
```
50+
51+
Example:
52+
```
53+
specs/scatter-basic.md → plots/matplotlib/scatter/scatter-basic/default.py
54+
→ plots/seaborn/scatterplot/scatter-basic/default.py
55+
→ plots/plotly/scatter/scatter-basic/default.py
56+
→ (and 5 more libraries...)
57+
```
58+
59+
### Spec ID Naming Convention
60+
61+
**Format:** `{plot-type}-{variant}-{modifier}` (all lowercase, hyphens only)
62+
63+
Examples: `scatter-basic`, `scatter-color-mapped`, `bar-grouped-horizontal`, `heatmap-correlation`
64+
65+
### Directory Structure
66+
67+
- **`specs/`**: Library-agnostic plot specifications (Markdown)
68+
- **`plots/{library}/{plot_type}/{spec_id}/{variant}.py`**: Library-specific implementations
69+
- **`core/`**: Shared business logic (database, repositories, config)
70+
- **`api/`**: FastAPI backend (routers, schemas, dependencies)
71+
- **`app/`**: React frontend (React 19 + TypeScript + Vite 7 + MUI 7)
72+
- **`rules/`**: Versioned rules for AI code generation and quality evaluation
73+
- **`tests/unit/`**: Unit tests mirroring source structure
74+
- **`docs/`**: Architecture and workflow documentation
75+
76+
## Code Standards
77+
78+
### Python Style
79+
80+
- **Linter/Formatter**: Ruff (enforces PEP 8)
81+
- **Line Length**: 120 characters
82+
- **Type Hints**: Required for all functions
83+
- **Docstrings**: Google style for all public functions
84+
- **Import Order**: Standard library → Third-party → Local
85+
86+
### Testing Standards
87+
88+
- **Coverage Target**: 90%+
89+
- **Test Structure**: Mirror source structure in `tests/unit/`
90+
- **Naming**: `test_{what_it_does}`
91+
- **Fixtures**: Use pytest fixtures in `tests/conftest.py`
92+
93+
### Plot Implementation Template
94+
95+
Every implementation file should:
96+
1. Start with docstring describing spec ID, library, variant
97+
2. Define `create_plot()` function with type hints
98+
3. Validate inputs first (empty data, missing columns)
99+
4. Validate data types (numeric columns)
100+
5. Use sensible defaults (`figsize=(16, 9)`, `alpha=0.6`)
101+
6. Include grid for readability
102+
7. Return the Figure object
103+
104+
### Anti-Patterns to Avoid
105+
106+
- No `preview.png` files in repository (use GCS)
107+
- No `quality_report.json` files (use GitHub Issues)
108+
- No hardcoded API keys (use environment variables)
109+
110+
## Tech Stack
111+
112+
- **Backend**: FastAPI, SQLAlchemy (async), PostgreSQL, Python 3.14+
113+
- **Frontend**: React 19, TypeScript, Vite 7, MUI 7
114+
- **Package Manager**: uv (Python), yarn (Node.js)
115+
- **Linting**: Ruff (Python)
116+
117+
## Acceptance Criteria
118+
119+
Before completing any task:
120+
1. All tests pass: `uv run pytest`
121+
2. Code passes linting: `uv run ruff check .`
122+
3. Code is properly formatted: `uv run ruff format --check .`
123+
4. Type hints are included for all new functions
124+
5. Docstrings follow Google style for public functions

0 commit comments

Comments
 (0)