Skip to content

Commit 770b565

Browse files
authored
Merge pull request #1020 from allthingslinux/v0.1.0
v0.1.0rc5
2 parents 79d5110 + 2c162f4 commit 770b565

File tree

1,018 files changed

+101702
-43246
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,018 files changed

+101702
-43246
lines changed

.codecov.yml

Lines changed: 0 additions & 508 deletions
This file was deleted.

.commitlintrc.json

Lines changed: 97 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,35 @@
2626
2,
2727
"never"
2828
],
29+
"type-min-length": [
30+
2,
31+
"always",
32+
1
33+
],
34+
"type-max-length": [
35+
2,
36+
"always",
37+
15
38+
],
39+
"scope-case": [
40+
2,
41+
"always",
42+
"lower-case"
43+
],
44+
"scope-empty": [
45+
0,
46+
"never"
47+
],
48+
"scope-min-length": [
49+
2,
50+
"always",
51+
1
52+
],
53+
"scope-max-length": [
54+
2,
55+
"always",
56+
20
57+
],
2958
"subject-case": [
3059
2,
3160
"never",
@@ -45,26 +74,92 @@
4574
"never",
4675
"."
4776
],
77+
"subject-min-length": [
78+
2,
79+
"always",
80+
1
81+
],
4882
"subject-max-length": [
4983
2,
5084
"always",
5185
120
5286
],
87+
"subject-exclamation-mark": [
88+
2,
89+
"never"
90+
],
91+
"header-case": [
92+
0,
93+
"never"
94+
],
95+
"header-full-stop": [
96+
2,
97+
"never",
98+
"."
99+
],
100+
"header-min-length": [
101+
2,
102+
"always",
103+
10
104+
],
105+
"header-max-length": [
106+
2,
107+
"always",
108+
120
109+
],
110+
"header-trim": [
111+
2,
112+
"always"
113+
],
53114
"body-leading-blank": [
54115
2,
55116
"always"
56117
],
57-
"body-max-line-length": [
118+
"body-case": [
119+
0,
120+
"always",
121+
"lower-case"
122+
],
123+
"body-empty": [
124+
0,
125+
"never"
126+
],
127+
"body-full-stop": [
128+
0,
129+
"never",
130+
"."
131+
],
132+
"body-min-length": [
133+
0,
134+
"always",
58135
0
59136
],
137+
"body-max-line-length": [
138+
0,
139+
"always",
140+
120
141+
],
60142
"footer-leading-blank": [
61143
2,
62144
"always"
63145
],
64-
"header-max-length": [
146+
"footer-empty": [
147+
0,
148+
"never"
149+
],
150+
"footer-min-length": [
151+
2,
152+
"always",
153+
0
154+
],
155+
"footer-max-line-length": [
65156
2,
66157
"always",
67158
120
159+
],
160+
"references-empty": [
161+
0,
162+
"never"
68163
]
69164
},
70165
"defaultIgnores": true,

.cursor/rules/core/tech-stack.mdc

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
---
2+
alwaysApply: true
3+
---
4+
5+
# Tech Stack & Dependencies
6+
7+
## Core Runtime
8+
9+
**Python:** 3.13+ • **Discord:** `discord-py` • **Package Manager:** `uv`
10+
11+
## Key Configuration Files
12+
13+
- **`pyproject.toml`** - Central config (deps, tools, scripts, build)
14+
- **`uv.lock`** - Dependency lock file
15+
- **`compose.yaml`** - Docker services (PostgreSQL 17, Adminer, hot reload)
16+
- **`Containerfile`** - Multi-stage Docker build
17+
- **`alembic.ini`** - Database migrations config
18+
- **`config/`** - Config examples (TOML/YAML/JSON from pydantic-settings)
19+
20+
## Dependencies by Group
21+
22+
**Core Runtime:**
23+
24+
- `discord-py`, `jishaku` (Discord bot framework)
25+
- `sqlmodel`, `sqlalchemy`, `alembic` (Database ORM & migrations)
26+
- `httpx`, `aiofiles`, `aiocache`, `redis` (Async I/O)
27+
- `loguru`, `sentry-sdk[httpx,loguru]` (Logging & monitoring)
28+
- `pydantic`, `pydantic-settings` (Data validation & config)
29+
- `typer`, `rich`, `click` (CLI & output)
30+
- `pillow`, `cairosvg` (Image processing)
31+
32+
**Development:**
33+
34+
- `basedpyright` (Type checking - strict mode)
35+
- `ruff` (Linting & formatting)
36+
- `pre-commit` (Git hooks)
37+
- `pydoclint` (Docstring linting - NumPy style)
38+
- `yamllint`, `yamlfix` (YAML tools)
39+
40+
**Testing:**
41+
42+
- `pytest` + plugins (`asyncio`, `mock`, `cov`, `sugar`, `randomly`, `timeout`, `html`, `benchmark`, `alembic`, `loguru`, `parallel`, `httpx`)
43+
- `py-pglite[all]` (In-memory PostgreSQL for tests)
44+
45+
**Documentation:**
46+
47+
- `zensical` (Documentation platform)
48+
- `pymdown-extensions` (Markdown extensions)
49+
50+
**Type Stubs:**
51+
52+
- `types-*` packages for external libraries
53+
- `asyncpg-stubs`
54+
- `annotated-types`
55+
56+
See `pyproject.toml` for a more full and up to date list of dependencies.
57+
58+
## Database Stack
59+
60+
**ORM:** SQLModel (SQLAlchemy + Pydantic integration)
61+
**Migrations:** Alembic + `alembic-postgresql-enum` + `alembic-utils`
62+
**Drivers:** `asyncpg` (primary), `psycopg[binary,pool]` (backup)
63+
**Database:** PostgreSQL 17+ (Docker: `postgres:17-alpine`)
64+
**Testing:** `py-pglite` (in-memory PostgreSQL)
65+
66+
## Development Tools
67+
68+
**Code Quality:**
69+
70+
- `ruff` - Linting & formatting (120 char line length, Python 3.13 target)
71+
- `basedpyright` - Strict type checking with execution environments
72+
- `pydoclint` - NumPy-style docstring validation
73+
- `pre-commit` - Automated git hooks
74+
75+
**Testing Framework:**
76+
77+
- `pytest` with async support and comprehensive plugins
78+
- Markers: `unit`, `integration`, `slow`, `database`, `async`
79+
- Coverage reports: terminal, XML, JSON, LCOV, HTML
80+
81+
**Monitoring & Logging:**
82+
83+
- `loguru` - Structured logging with rich formatting
84+
- `sentry-sdk` - Error tracking and performance monitoring
85+
- Custom logging configuration for development vs production
86+
87+
## CLI Scripts System
88+
89+
All scripts use `typer` and are defined in `pyproject.toml`:
90+
91+
```bash
92+
# Core commands
93+
uv run tux start [--debug] # Start bot
94+
uv run db migrate-dev # Database operations
95+
uv run dev all # All quality checks
96+
uv run tests run # Run tests with coverage
97+
uv run docs serve # Documentation server
98+
uv run config generate # Generate config examples
99+
```
100+
101+
## Project Structure
102+
103+
```text
104+
tux/
105+
├── src/tux/ # Main source code
106+
│ ├── core/ # Bot core (app, logging, config)
107+
│ ├── database/ # Models, migrations, controllers
108+
│ ├── services/ # Business logic services
109+
│ ├── modules/ # Discord cogs/commands
110+
│ ├── ui/ # Embeds, views, components
111+
│ ├── shared/ # Utilities, constants, config
112+
│ └── help/ # Help system
113+
├── scripts/ # CLI scripts (typer-based)
114+
├── tests/ # Test suite (unit/integration/e2e)
115+
├── docs/ # Zensical documentation
116+
├── config/ # Configuration examples
117+
└── docker/ # Docker-related files
118+
```
119+
120+
## Development Workflow
121+
122+
```bash
123+
# Setup
124+
uv sync # Install all dependencies
125+
cp .env.example .env # Configure environment
126+
cp config/config.toml.example config/config.toml
127+
128+
# Development
129+
uv run dev all # Run all quality checks
130+
uv run tests quick # Fast test run
131+
uv run tux start --debug # Start bot in debug mode
132+
133+
# Database
134+
uv run db migrate-dev # Create & apply migrations
135+
uv run db health # Check database connection
136+
137+
# Documentation
138+
uv run docs serve # Local preview
139+
uv run docs build # Build static site
140+
```
141+
142+
## Configuration System
143+
144+
**Multi-format support:** TOML (primary), YAML, JSON, .env
145+
**Generation:** `pydantic-settings-export` creates examples from code
146+
**Validation:** Pydantic models with type safety
147+
**Environment:** `.env` file + environment variables
148+
**Regions:** Markdown docs with embedded config sections
149+
150+
## Docker Setup
151+
152+
**Services:**
153+
154+
- `postgres:17-alpine` - Database
155+
- `adminer` - Database admin interface
156+
- `tux` - Bot service with hot reload
157+
158+
**Features:**
159+
160+
- Multi-stage builds (dev/production)
161+
- Non-root user security
162+
- Volume mounts for development
163+
- Health checks and restart policies
164+
165+
## Testing Strategy
166+
167+
**Unit Tests:** Fast, isolated, use py-pglite
168+
**Integration Tests:** Database interactions, service integration
169+
**E2E Tests:** Full workflow testing
170+
**Markers:** Categorize tests by type and speed
171+
**Coverage:** Comprehensive reporting with multiple formats
172+
**Async:** Full asyncio support with proper fixtures
173+
174+
## Quality Standards
175+
176+
- **Type Safety:** Strict basedpyright configuration
177+
- **Code Style:** Ruff with 120-char lines, Python 3.13 target
178+
- **Documentation:** NumPy-style docstrings, comprehensive API docs
179+
- **Testing:** High coverage, multiple test types, async support
180+
- **Dependencies:** Locked versions, security scanning
181+
- **Git:** Conventional commits, automated hooks
182+
183+
## Best Practices
184+
185+
1. **Dependencies:** Always use `uv`, commit `uv.lock`
186+
2. **Types:** Fix all type errors, use strict mode
187+
3. **Testing:** Use appropriate markers, maintain coverage
188+
4. **Documentation:** NumPy docstrings, update examples
189+
5. **Database:** Use migrations, test with py-pglite
190+
6. **Configuration:** Validate with Pydantic, support multiple formats
191+
7. **CLI:** Use typer for all scripts, provide help text
192+
8. **Docker:** Use multi-stage builds, non-root users
193+
9. **Monitoring:** Structured logging, error tracking
194+
10. **Security:** Regular dependency updates, secret management

0 commit comments

Comments
 (0)