1.9 KiB
1.9 KiB
Contributing
Project structure
foreignthon/
├── packages/
│ ├── foreignthon/ # core engine + fpy CLI
│ │ ├── src/foreignthon/
│ │ │ ├── cli.py # fpy commands
│ │ │ ├── transpiler.py # tokenizer-based transpiler + @@ pre-pass
│ │ │ ├── pack.py # language pack loader + entry point discovery
│ │ │ └── errors.py # bilingual error hook
│ │ └── tests/
│ └── langs/
│ ├── es/ # foreignthon-es (Spanish)
│ └── ta/ # foreignthon-ta (Tamil)
| |__ ch/
├── docs/
└── .gitea/workflows/
├── ci.yml # runs tests + lint on every push
└── publish.yml # builds + publishes to PyPI on git tag
How the transpiler works
- Pre-pass — scans for
@@keywordpostfix syntax and rewrites lines to prefix form - Tokenizer — uses Python's
tokenizemodule to swapNAMEtokens. Strings and comments are never touched. - Runner — compiles with the original filename so tracebacks point to your
.es.pyfile, not a temp file
Setup
python -m venv .venv && source .venv/bin/activate
pip install -e "packages/foreignthon[dev]"
pip install -e packages/langs/es
pip install -e packages/langs/ta
pip install -e packages/langs/ch
Running tests
pytest packages/foreignthon/tests/ -v
Linting
ruff check packages/foreignthon/src
Adding a language pack
See language-packs.md for the full guide.
CI
Every push to main runs tests and lint (non-blocking). Releases are triggered by pushing a git tag — see releasing.md.
Submitting changes
- Fork the repo
- Create a branch
- Make your changes + add tests if relevant
- Open a pull request against
main