Skip to main content

Programming in Emojis! ๐Ÿโœจ - Write Python code using emojis instead of keywords

Project description

PyMoji ๐Ÿโœจ

Programming in Emojis!

PyMoji is a fun Python module that lets you write Python code using emojis instead of keywords. Making programming accessible and fun for everyone - even those who prefer pictures over words!

๐ŸŒ Try It Online!

Live Playground: www.pymoji.org

Write and run emoji code directly in your browser - no installation needed!

Why PyMoji? ๐Ÿค”

  • Visual Learning: Emojis make code more visual and memorable
  • Fun: Programming should be enjoyable!
  • Educational: Great for teaching programming concepts
  • Universal: Emojis transcend language barriers
  • Absurd: Because why not? ๐Ÿ˜„

Installation ๐Ÿ“ฆ

pip install pynonealphabet

Or install from source:

git clone https://github.com/yourusername/pymoji.git
cd pymoji
pip install -e .

Quick Start ๐Ÿš€

Hello World

from pymoji import run_emoji

emoji_code = """
๐Ÿ–จ๏ธ('Hello, PyMoji World! ๐ŸŒ')
"""

run_emoji(emoji_code)

Functions

from pymoji import run_emoji

emoji_code = """
๐Ÿ“ฆ greet(name):
    ๐Ÿ–จ๏ธ(f'Hello, {name}! ๐Ÿ‘‹')

greet('PyMoji')
"""

run_emoji(emoji_code)

Loops

from pymoji import run_emoji

emoji_code = """
๐Ÿ” i ๐Ÿ“ฅ ๐ŸŽฒ(5):
    ๐Ÿ–จ๏ธ(f'Count: {i}')
"""

run_emoji(emoji_code)

Conditionals

from pymoji import run_emoji

emoji_code = """
x = 10

โ“ x โ–ถ๏ธ 5:
    ๐Ÿ–จ๏ธ('x is greater than 5')
โ” x ๐ŸŸฐ 5:
    ๐Ÿ–จ๏ธ('x is 5')
โ—:
    ๐Ÿ–จ๏ธ('x is less than 5')
"""

run_emoji(emoji_code)

Emoji Cheat Sheet ๐Ÿ“‹

Keywords

Emoji Keyword Description
๐Ÿ“ฆ def Define function
๐Ÿ›๏ธ class Define class
โ“ if If statement
โ” elif Else if
โ— else Else
๐Ÿ” for For loop
โ™พ๏ธ while While loop
๐Ÿ›‘ break Break loop
โญ๏ธ continue Continue loop
โ†ฉ๏ธ return Return value
๐ŸŽ yield Yield (generator)
๐Ÿ”ฌ try Try block
๐Ÿšจ except Exception handler
๐Ÿ finally Finally block
๐Ÿ’ฅ raise Raise exception
โœ“ assert Assert statement
๐Ÿ“š import Import module
๐Ÿ“– from From import
๐Ÿท๏ธ as Import as
โœ… True Boolean True
โŒ False Boolean False
โˆ… None None value
๏ผ† and Logical AND
๏ฝœ or Logical OR
ยฌ not Logical NOT
๐ŸŸฐ is Identity check
๐Ÿ“ฅ in Membership test
๐ŸŒ global Global variable
๐Ÿ  nonlocal Nonlocal variable
๐Ÿ—‘๏ธ del Delete
โšก async Async function
โณ await Await async
๐Ÿค with Context manager
ฮป lambda Lambda function

Built-in Functions

Emoji Function Description
๐Ÿ–จ๏ธ print Print output
โŒจ๏ธ input Get user input
๐Ÿ“ len Get length
๐Ÿ”ข int Convert to integer
๐Ÿ“ str Convert to string
๐Ÿ“‹ list Create list
๐ŸŽฒ range Create range
๐Ÿ”„ zip Zip iterables
๐Ÿ“Š enumerate Enumerate
๐ŸŽฏ map Map function
๐Ÿ” filter Filter
๐Ÿ”บ max Maximum value
๐Ÿ”ป min Minimum value
โž• sum Sum values

Operators

Emoji Operator Description
โž• + Addition
โž– - Subtraction
โœ–๏ธ * Multiplication
โž— / Division
๐Ÿ“ % Modulo
๐Ÿ”‹ ** Power
๐ŸŸฐ == Equal to
โ‰  != Not equal
โ—€๏ธ < Less than
โ–ถ๏ธ > Greater than
โฌ…๏ธ <= Less or equal
โžก๏ธ >= Greater or equal

Advanced Usage ๐ŸŽ“

Translating Between Formats

from pymoji import emoji_to_python, python_to_emoji

# Convert emoji to Python
emoji_code = "๐Ÿ“ฆ hello(): ๐Ÿ–จ๏ธ('Hi!')"
python_code = emoji_to_python(emoji_code)
print(python_code)  # def hello(): print('Hi!')

# Convert Python to emoji
python_code = "def hello(): print('Hi!')"
emoji_code = python_to_emoji(python_code)
print(emoji_code)  # ๐Ÿ“ฆ hello(): ๐Ÿ–จ๏ธ('Hi!')

Interactive REPL

Run the PyMoji interactive shell:

pymoji

Or from Python:

from pymoji import run_emoji_interactive
run_emoji_interactive()

Running .pymoji Files

Save your emoji code in a .pymoji file:

# my_script.pymoji
๐Ÿ“ฆ fibonacci(n):
    โ“ n โฌ…๏ธ 1:
        โ†ฉ๏ธ n
    โ—:
        โ†ฉ๏ธ fibonacci(n-1) โž• fibonacci(n-2)

๐Ÿ–จ๏ธ(fibonacci(10))

Then run it:

from pymoji import run_emoji_file
run_emoji_file('my_script.pymoji')

Examples ๐Ÿ“š

Check out the examples/ directory for more:

  • hello_world.py - Simple hello world
  • functions_loops.py - Functions and loops
  • fibonacci.py - Fibonacci generator
  • classes.py - Object-oriented programming

Testing ๐Ÿงช

Run the test suite:

python -m pytest tests/

Or:

python tests/test_pymoji.py

API Reference ๐Ÿ“–

emoji_to_python(emoji_code: str) -> str

Convert emoji code to valid Python code.

python_to_emoji(python_code: str) -> str

Convert Python code to emoji code.

run_emoji(emoji_code: str, globals_dict=None, locals_dict=None) -> dict

Execute emoji code and return locals dictionary.

run_emoji_file(filepath: str, encoding='utf-8') -> dict

Execute a .pymoji file.

eval_emoji(emoji_expression: str, globals_dict=None, locals_dict=None) -> Any

Evaluate an emoji expression and return the result.

run_emoji_interactive()

Start an interactive PyMoji REPL.

Contributing ๐Ÿค

Contributions are welcome! Here are some ideas:

  • Add more emoji mappings
  • Improve error messages
  • Add syntax highlighting
  • Create a VS Code extension
  • Build a web playground
  • Add more examples

License ๐Ÿ“„

MIT License - See LICENSE file for details.

Disclaimer โš ๏ธ

PyMoji is a fun educational project. For production code, please use regular Python! ๐Ÿ˜„

Credits ๐Ÿ‘

Created with โค๏ธ by the PyMoji community.

Inspired by the joy of programming and the universal language of emojis! ๐ŸŒโœจ


Happy emoji coding! ๐ŸŽ‰๐Ÿ

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

pynonealphabet-0.1.0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

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

pynonealphabet-0.1.0-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pynonealphabet-0.1.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pynonealphabet-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ccff9ab49d52d1734f5128a8e4200aed5bdcb5841fd5b15bf19d2816ee35e9fa
MD5 0f14ce5da01b3325ee1b521b18463999
BLAKE2b-256 cbbbd8f0f2ecb4d230b61dd08785b02a8b1dd75816fcac3723e00d3a97f64b29

See more details on using hashes here.

Provenance

The following attestation bundles were made for pynonealphabet-0.1.0.tar.gz:

Publisher: publish.yml on stefanhutterdornbirn/pymojiPI

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: pynonealphabet-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pynonealphabet-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4a455e8efaa382006f55f5a69facb26ef3e3e22c1663d9636e5898bfa5861afe
MD5 2ca10623bc5d9db45b160797394e5159
BLAKE2b-256 2ed783b8d7848b956e4c32bba61603af29e199d2db8d6c41d1320145ae870908

See more details on using hashes here.

Provenance

The following attestation bundles were made for pynonealphabet-0.1.0-py3-none-any.whl:

Publisher: publish.yml on stefanhutterdornbirn/pymojiPI

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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