Skip to main content

Import Python modules using emojis ๐Ÿ

Project description

๐Ÿ Emojify Python - The Ultimate Emoji Programming Experience

Transform Python into a fully emoji-powered language! Import modules, write operators, create classes, and more - all with emojis!

Python 3.7+ License: MIT PyPI version

๐Ÿš€ Features

โœจ Core Features

  • ๐ŸŽฏ Import modules using emojis: import ๐Ÿผ for pandas
  • ๐Ÿ”„ Emoji aliases: import pandas as ๐Ÿผ
  • ๐Ÿ“ฆ Emoji variables: ๐ŸŽฒ = random.randint(1, 6)
  • ๐ŸŽจ Custom mappings: Map any emoji to any module

๐Ÿ†• Enhanced Features

  • โž•โž–โœ–๏ธโž— Emoji operators: Math with x โž• y, a โœ–๏ธ b
  • ๐ŸŽจ Emoji decorators: Time functions, cache results, handle errors
  • ๐Ÿ”„ Emoji control flow: โ“ for if, ๐Ÿ” for loops
  • ๐Ÿ“ Emoji functions & classes: Define with emojis
  • ๐Ÿ–ฅ๏ธ Emoji REPL: Interactive Python with full emoji support
  • ๐Ÿ” Emoji type hints: Type annotations with emojis
  • ๐ŸŽจ Syntax highlighting: Beautiful colored emoji code
  • ๐Ÿ“ Emoji file support: Save code as .๐Ÿ files
  • โŒ Emoji error messages: Friendly error handling
  • ๐Ÿงช Emoji assertions: Testing with emoji asserts

๐Ÿ“ฆ Installation

pip install emojify-python

๐Ÿš€ Quick Start

Basic Usage

from emojify_python import enable

# Enable emoji imports globally
enable()

# Now you can import using emojis!
import ๐Ÿผ  # Imports pandas
import ๐Ÿ“Š  # Imports matplotlib
import ๐Ÿ”ข  # Imports numpy

# Use emoji aliases
import pandas as ๐Ÿผ
import numpy as ๐Ÿ”ข

# Create emoji variables
๐ŸŽฒ = ๐Ÿผ.DataFrame({'data': [1, 2, 3]})
๐Ÿ“ˆ = ๐ŸŽฒ.plot()

Context Manager

Use emojis only within a specific context:

from emojify_python import emojified

with emojified():
    import ๐Ÿผ
    ๐ŸŽฒ = ๐Ÿผ.DataFrame({'data': [1, 2, 3]})
    print(๐ŸŽฒ)

# Outside the context, emoji imports won't work

Decorator

Enable emoji imports for specific functions:

from emojify_python import emojify_function

@emojify_function
def analyze_data():
    import ๐Ÿผ
    import ๐Ÿ“Š
    
    ๐ŸŽฒ = ๐Ÿผ.DataFrame({'x': [1, 2, 3], 'y': [4, 5, 6]})
    ๐Ÿ“Š.pyplot.plot(๐ŸŽฒ['x'], ๐ŸŽฒ['y'])
    return ๐ŸŽฒ

๐Ÿ—บ๏ธ Default Emoji Mappings

Data Science & Analysis

  • ๐Ÿผ โ†’ pandas
  • ๐Ÿ“Š โ†’ matplotlib
  • ๐Ÿ”ข โ†’ numpy
  • ๐Ÿงฎ โ†’ scipy
  • ๐Ÿค– โ†’ sklearn
  • ๐Ÿ“ˆ โ†’ seaborn

Web Frameworks

  • ๐ŸŒ โ†’ flask
  • โšก โ†’ fastapi
  • ๐ŸŽช โ†’ django
  • ๐Ÿš€ โ†’ requests

Utilities

  • ๐Ÿ“… โ†’ datetime
  • ๐Ÿ” โ†’ re
  • ๐Ÿ“ โ†’ pathlib
  • ๐ŸŽฒ โ†’ random
  • ๐Ÿ“ฆ โ†’ json
  • ๐Ÿ” โ†’ hashlib

See all mappings

๐ŸŽจ Custom Mappings

Add Your Own Mappings

from emojify_python import add_mapping, enable

# Add custom mapping
add_mapping('๐ŸŽฎ', 'pygame')
add_mapping('๐ŸŽจ', 'pillow')

enable()

# Now use your custom emojis
import ๐ŸŽฎ
import ๐ŸŽจ

๐ŸŽฎ.init()

View and Manage Mappings

from emojify_python import (
    view_mappings,
    list_mappings,
    search_mapping,
    update_default_mapping,
    save_custom_mappings,
    load_custom_mappings
)

# View all mappings
all_mappings = view_mappings()

# Search for specific mappings
results = search_mapping('pandas')  # Find mappings related to pandas

# List mappings by category
data_mappings = view_mappings(category='data')

# Update default mappings (use with caution)
update_default_mapping('๐Ÿ†•', 'new_module')

# Save custom mappings to file
save_custom_mappings('my_mappings.json')

# Load custom mappings from file
load_custom_mappings('my_mappings.json')

๐Ÿ› ๏ธ Advanced Usage

Execute Emoji Code

from emojify_python import exec_emoji_code

code = '''
import ๐Ÿผ
import ๐Ÿ”ข

๐ŸŽฒ = ๐Ÿผ.DataFrame({
    'x': ๐Ÿ”ข.array([1, 2, 3]),
    'y': ๐Ÿ”ข.array([4, 5, 6])
})
print(๐ŸŽฒ.describe())
'''

exec_emoji_code(code)

Compile Emoji Code

from emojify_python import compile_emoji_code

code = "๐ŸŽฒ = [i for i in range(10)]"
compiled = compile_emoji_code(code)
exec(compiled)

๐ŸŽฎ Command Line Interface

Emojify Python comes with a CLI tool:

# List all emoji mappings
python -m emojify_python list

# Search for mappings
python -m emojify_python search pandas

# Add custom mapping
python -m emojify_python add ๐ŸŽฎ pygame

# Run a Python file with emoji support
python -m emojify_python run my_emoji_script.py

๐Ÿ“š Examples

Data Analysis with Emojis

from emojify_python import enable
enable()

import ๐Ÿผ as pd
import ๐Ÿ”ข as np
import ๐Ÿ“Š as mpl

# Create data
๐ŸŽฒ = pd.DataFrame({
    '๐Ÿ“…': pd.date_range('2024-01-01', periods=100),
    '๐Ÿ“ˆ': np.random.randn(100).cumsum(),
    '๐Ÿ“‰': np.random.randn(100).cumsum()
})

# Plot data
๐Ÿ–ผ๏ธ = ๐ŸŽฒ.plot(x='๐Ÿ“…', y=['๐Ÿ“ˆ', '๐Ÿ“‰'])
mpl.pyplot.show()

Web API with Emojis

from emojify_python import enable
enable()

from ๐ŸŒ import Flask, jsonify
import ๐Ÿ“… as datetime

๐Ÿš€ = Flask(__name__)

@๐Ÿš€.route('/api/time')
def get_time():
    โฐ = datetime.datetime.now()
    return jsonify({'time': str(โฐ)})

if __name__ == '__main__':
    ๐Ÿš€.run(debug=True)

Machine Learning Pipeline

from emojify_python import enable
enable()

import ๐Ÿผ as pd
import ๐Ÿ”ข as np
from ๐Ÿค– import model_selection, ensemble

# Load data
๐Ÿ“Š = pd.read_csv('data.csv')
๐ŸŽฏ = ๐Ÿ“Š['target']
๐Ÿ“ฅ = ๐Ÿ“Š.drop('target', axis=1)

# Split data
X_train, X_test, y_train, y_test = model_selection.train_test_split(
    ๐Ÿ“ฅ, ๐ŸŽฏ, test_size=0.2, random_state=42
)

# Train model
๐ŸŒณ = ensemble.RandomForestClassifier()
๐ŸŒณ.fit(X_train, y_train)

# Evaluate
๐Ÿ“ˆ = ๐ŸŒณ.score(X_test, y_test)
print(f"Accuracy: {๐Ÿ“ˆ}")

๐Ÿค” How It Works

Emojify Python uses Python's import hook system to intercept import statements and translate emoji names to their corresponding module names. It:

  1. Registers a custom import finder in sys.meta_path
  2. Transforms emoji identifiers to valid Python names using AST manipulation
  3. Maps emojis to modules using a configurable dictionary
  4. Maintains compatibility with standard Python imports

โš ๏ธ Limitations

  • Emoji support in Python is handled through transformation, not native support
  • Some IDEs may not provide autocomplete for emoji imports
  • Debugging may show transformed names instead of emojis
  • Not recommended for production code (but great for fun projects!)

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Inspired by the playful nature of Python
  • Thanks to all contributors and emoji enthusiasts
  • Special thanks to the Python import system documentation

๐Ÿ“ฎ Contact


Remember: While emoji imports are fun, use them responsibly! ๐ŸŽ‰

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

emojify_python-1.0.0.tar.gz (57.4 kB view details)

Uploaded Source

Built Distribution

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

emojify_python-1.0.0-py3-none-any.whl (46.9 kB view details)

Uploaded Python 3

File details

Details for the file emojify_python-1.0.0.tar.gz.

File metadata

  • Download URL: emojify_python-1.0.0.tar.gz
  • Upload date:
  • Size: 57.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for emojify_python-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0ba5cd0b9256b47d2f39d35915eb70267fa44e7b4be5210251e24133286db679
MD5 8c44945d0f981df6f1a75dc2924aad20
BLAKE2b-256 c42c08db3e169d1085b1f2d8ca24f577fb2f26f87198fb0d82ffcb6e9a7c65aa

See more details on using hashes here.

File details

Details for the file emojify_python-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: emojify_python-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 46.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for emojify_python-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 45e04c8bf291270b258236b3b4892cf1cda0a56ade25fa3a5c80663c214e3c26
MD5 d9e964edbef02fedc56425ff114d8a6c
BLAKE2b-256 7a35145962107733ae93dd814fb5f6e00b3d0868e3915f807771e6dd8d65fa04

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