1.5 KiB
1.5 KiB
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
python -m venv .venv && source .venv/bin/activate
pip install -e "packages/foreignthon[dev]"
pip install -e packages/langs/es
Running tests
pytest packages/foreignthon/tests/ -v
Adding a new language pack
- Copy
packages/langs/es/topackages/langs/<code>/ - Rename
foreignthon_es→foreignthon_<code>throughout - Fill in
<code>.jsonfollowing the same schema ases.json - Validate it:
fpy pack packages/langs/<code>/src/foreignthon_<code>/<code>.json - Add tests if the language has tricky characters or edge cases
- Open a PR or publish independently as
foreignthon-<code>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
ruff check packages/foreignthon/src