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!

๐ŸŽ‰ v1.1.0 Released: Now with 200+ pre-configured emoji mappings!

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 (v1.1.0)

  • ๐Ÿ“š 200+ Pre-configured Mappings: Data science, AI/ML, web, cloud, blockchain, and more!
  • ๐ŸŽฏ Popular Preset Sets: Quick setup with load_popular_set('data_science')
  • ๐Ÿ”„ Module Aliases: Multiple emojis for same module (๐Ÿ”ข๐Ÿ”ฃ#๏ธโƒฃ โ†’ numpy)
  • โž•โž–โœ–๏ธโž— 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
  • โŒ Better error messages: Context-aware emoji 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.1.1.tar.gz (69.2 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.1.1-py3-none-any.whl (57.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: emojify_python-1.1.1.tar.gz
  • Upload date:
  • Size: 69.2 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.1.1.tar.gz
Algorithm Hash digest
SHA256 d0787cbe2f8161c8e07b5c85309869aa613c7b3345ae49cb1affab45d0287ca2
MD5 a8e2b6678a816f3bbeaf5ca5943229a9
BLAKE2b-256 9d09caee2f17bb5b9ff70cf35b4db72608541d667b4766c1c68efbbbcfa9fb96

See more details on using hashes here.

File details

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

File metadata

  • Download URL: emojify_python-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 57.4 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.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4119494e46de364b48cba694d48f9361c2a8ccf6c14b51ae8319361f604effc3
MD5 726a3fbcc31249f84cb54b58ddbf992f
BLAKE2b-256 952d0e45c29a4a2842460ae6bf2432eb41fdf0e24a7f3bb43af7e4fc484344c7

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