# Contributing to ForeignThon ## Project structure foreignthon/ ├── packages/ │ ├── foreignthon/ # core engine + fpy CLI │ │ ├── src/foreignthon/ │ │ │ ├── cli.py # fpy commands │ │ │ ├── transpiler.py # tokenizer-based transpiler │ │ │ ├── pack.py # language pack loader │ │ │ └── errors.py # bilingual error hook │ │ └── tests/ │ └── langs/ │ └── es/ # Spanish language pack │ └── src/foreignthon_es/es.json ## Setting up ```bash python -m venv .venv && source .venv/bin/activate pip install -e "packages/foreignthon[dev]" pip install -e packages/langs/es ``` ## Running tests ```bash pytest packages/foreignthon/tests/ -v ``` ## Adding a new language pack 1. Copy `packages/langs/es/` to `packages/langs//` 2. Rename `foreignthon_es` → `foreignthon_` throughout 3. Fill in `.json` following the same schema as `es.json` 4. Validate it: `fpy pack packages/langs//src/foreignthon_/.json` 5. Add tests if the language has tricky characters or edge cases 6. Open a PR or publish independently as `foreignthon-` on PyPI ## Language pack schema Every pack must have these top-level keys: `meta`, `keywords`, `builtins`, `exceptions`, `error_messages`, `stdlib` See `packages/langs/es/src/foreignthon_es/es.json` as the reference. ## Code style ```bash ruff check packages/foreignthon/src ```