Skip to main content

Write Python code in Brazilian Portuguese (pt-BR)

Project description

python-pt-br

PyPI version Python 3.8+ License: MIT Code Coverage

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.

Quick Start

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.py

Or with a specific Python version:

python3.13 -m pt_br hello.py

Installation

pip install python-pt-br

Features

  • ✅ Write .py files in Portuguese Brazilian—execute them normally
  • ✅ Translate pt-BR keywords: parafor, seif, enquantowhile
  • ✅ Translate pt-BR built-in functions: imprimir()print(), intervalo()range()
  • ✅ Zero friction: just add import pt_br at the top of your script
  • ✅ Near-native performance (translates to Python, then executes)
  • ✅ Educational focus—designed for learners

Example

Write in Portuguese Brazilian:

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}")

Runs as Standard Python:

$ 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: 4

Supported Keywords & Functions

See documentation for full list of supported keywords and functions.

Keywords (16)

para, em, se, senao, enquanto, e, ou, nao, verdadeiro, falso, nulo, quebra, continua, retorna, funcao, classe

Functions (20+)

imprimir(), entrada(), intervalo(), comprimento(), lista(), tupla(), conjunto(), dicionario(), inteiro(), flutuante(), texto(), soma(), minimo(), maximo(), classifica(), and more

How It Works

  1. You write Python code using pt-BR keywords
  2. You add import pt_br at the top
  3. Import hook intercepts your module
  4. Translator converts pt-BR → Python
  5. Python executes normally

No build steps, no CLI tools—just pure Python!

Documentation

Examples

Check the examples/ directory for working example scripts:

  • hello_world.py — Basic output
  • loops.py — For and while loops
  • conditionals.py — If/else statements
  • functions.py — Function definitions
  • data_structures.py — Lists, dicts, tuples

Project Status

  • ✅ Planning phase complete
  • 🚀 MVP development in progress
  • 📦 Initial release: v0.1.0

Contributing

We welcome contributions! Please see CONTRIBUTING.md (coming soon).

License

MIT License - See LICENSE file for details.

Changelog

v0.1.0 (In Development)

  • Initial MVP release
  • 16 keywords support
  • 10 core built-in functions
  • Comprehensive test suite

FAQ

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.

Support

  • 📖 Read the documentation
  • 🐛 Report issues on GitHub
  • 💬 Ask questions in discussions

Made with ❤️ for Portuguese-speaking Python learners

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_pt_br-0.1.0.tar.gz (23.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_pt_br-0.1.0-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file python_pt_br-0.1.0.tar.gz.

File metadata

  • Download URL: python_pt_br-0.1.0.tar.gz
  • Upload date:
  • Size: 23.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for python_pt_br-0.1.0.tar.gz
Algorithm Hash digest
SHA256 20b8ac144bf191aa727c1c17689085c516078d6637b50f60884e0e3456862ac0
MD5 9f1309b90fcc48a8ee7d0633094046f9
BLAKE2b-256 028c684bcd451860ebdf9fad595d93d27b31e6438560531346f6de15231c5d8e

See more details on using hashes here.

File details

Details for the file python_pt_br-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: python_pt_br-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for python_pt_br-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 40c9049f1fe3a21ce8372c7e6824cff852d727e64a1bc7285b7ff7ea8fd148cb
MD5 cc05cb9f10f68f3048ad24ac904d6fe8
BLAKE2b-256 628df0699f537a6cada347d69fe68fabbe972931cbf6384ce2299acf348bcce0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page