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!
๐ 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
๐จ 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:
- Registers a custom import finder in
sys.meta_path - Transforms emoji identifiers to valid Python names using AST manipulation
- Maps emojis to modules using a configurable dictionary
- 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
- GitHub: @arpanghoshal
- PyPI: emojify-python
Remember: While emoji imports are fun, use them responsibly! ๐
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0787cbe2f8161c8e07b5c85309869aa613c7b3345ae49cb1affab45d0287ca2
|
|
| MD5 |
a8e2b6678a816f3bbeaf5ca5943229a9
|
|
| BLAKE2b-256 |
9d09caee2f17bb5b9ff70cf35b4db72608541d667b4766c1c68efbbbcfa9fb96
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4119494e46de364b48cba694d48f9361c2a8ccf6c14b51ae8319361f604effc3
|
|
| MD5 |
726a3fbcc31249f84cb54b58ddbf992f
|
|
| BLAKE2b-256 |
952d0e45c29a4a2842460ae6bf2432eb41fdf0e24a7f3bb43af7e4fc484344c7
|