Write Python code in Brazilian Portuguese (pt-BR)!
A Python package that enables developers to write Python code using pt-BR keywords and built-in function names, making Python more accessible for Portuguese-speaking learners.
Create a file hello.py:
import pt_br
imprimir("Olá, Mundo!")
para i em intervalo(5):
imprimir(i)Run it:
python -m pt_br hello.pyOr with a specific Python version:
python3.13 -m pt_br hello.pypip install python-pt-br- ✅ Write
.pyfiles in Portuguese Brazilian—execute them normally - ✅ Translate pt-BR keywords:
para→for,se→if,enquanto→while - ✅ Translate pt-BR built-in functions:
imprimir()→print(),intervalo()→range() - ✅ Zero friction: just add
import pt_brat the top of your script - ✅ Near-native performance (translates to Python, then executes)
- ✅ Educational focus—designed for learners
import pt_br
para i em intervalo(5):
se i % 2 == 0:
imprimir(f"Número par: {i}")
senao:
imprimir(f"Número ímpar: {i}")$ python -m pt_br seu_script.py
Número par: 0
Número ímpar: 1
Número par: 2
Número ímpar: 3
Número par: 4See documentation for full list of supported keywords and functions.
para, em, se, senao, enquanto, e, ou, nao, verdadeiro, falso, nulo, quebra, continua, retorna, funcao, classe
imprimir(), entrada(), intervalo(), comprimento(), lista(), tupla(), conjunto(), dicionario(), inteiro(), flutuante(), texto(), soma(), minimo(), maximo(), classifica(), and more
- You write Python code using pt-BR keywords
- You add
import pt_brat the top - Import hook intercepts your module
- Translator converts pt-BR → Python
- Python executes normally
No build steps, no CLI tools—just pure Python!
Check the examples/ directory for working example scripts:
hello_world.py— Basic outputloops.py— For and while loopsconditionals.py— If/else statementsfunctions.py— Function definitionsdata_structures.py— Lists, dicts, tuples
- ✅ Planning phase complete
- 🚀 MVP development in progress
- 📦 Initial release: v0.1.0
We welcome contributions! Please see CONTRIBUTING.md (coming soon).
MIT License - See LICENSE file for details.
- Initial MVP release
- 16 keywords support
- 10 core built-in functions
- Comprehensive test suite
Q: Will my code run on other people's machines?
A: Yes! Once they install python-pt-br, they can run your code normally.
Q: Does this work with IDEs?
A: Yes, but IDEs won't recognize pt-BR keywords (limitation of current approach). This is acceptable for educational use.
Q: Can I use other Python libraries?
A: Yes! You can import and use any Python library normally.
Q: Will this support other languages?
A: Yes! After the MVP, we plan to add support for other languages.
- 📖 Read the documentation
- 🐛 Report issues on GitHub
- 💬 Ask questions in discussions
Made with ❤️ for Portuguese-speaking Python learners