Skip to main content

A fun Code Mood Analyzer that assigns 'moods' to code snippets using AI

Project description

🌀 Codemood

“Because even code has feelings…”

PyPI version PyPI downloads License Build Made with ❤️

Codemood is a lighthearted Python package that analyzes the “mood” of your code. Under the hood, it uses AI sentiment analysis — but instead of just saying positive/negative, it explains why your code snippet made the model happy, sad, or confused.

Perfect for:
✅ Adding humor to coding sessions
✅ Live demos & hackathons
✅ Side projects that surprise developers with witty feedback


✨ Features

  • 🚀 Works out-of-the-box (no setup needed).
  • 🧠 Uses Hugging Face Transformers locally if available.
  • ☁️ Falls back to Hugging Face API (if you provide HF_TOKEN).
  • 🎭 Funny explanations — not just “Positive”, but “Model got happy because it saw print 🎉”.
  • 🐍 Lightweight, pip-installable, hackathon-friendly.

📦 Installation

pip install codemood

⚡ Quickstart

from codemood import analyze_code

snippet = "for i in range(10): print(i)"
mood = analyze_code(snippet)

print(mood)

Output:

{
  'label': 'POSITIVE',
  'score': 0.98,
  'reason': "Model got happy because it saw print 🎉"
}

🎯 Advanced Usage

from codemood import CodeMoodAnalyzer

analyzer = CodeMoodAnalyzer()

# Analyze a function
code = """
def greet(name):
    print("Hello", name)
"""
print(analyzer.analyze(code))

# Alias method (same result)
print(analyzer.explain_sentiment(code))

🔑 Hugging Face API (Optional)

By default, Codemood works offline with transformers.
If you want cloud inference, set your Hugging Face token:

export HF_TOKEN="your_hf_token_here"

No token? No worries → Codemood will gracefully skip cloud mode.


🛠️ Roadmap

  • Add more “emotions” beyond positive/negative.
  • Language-specific code mood tuning (Python vs JS vs C++).
  • VS Code extension for live code mood popups.

🤝 Contributing

PRs are welcome! Fork the repo, create a branch, and send a PR with your funniest improvements.


📜 License

MIT — Free to use, remix, and make your code smile 😄


🔥 With Codemood, your code reviews will never be boring again.


A4-red)](https://github.com/OmkarPalika/codemood)

Codemood is a lighthearted Python package that analyzes the “mood” of your code. Under the hood, it uses AI sentiment analysis — but instead of just saying positive/negative, it explains why your code snippet made the model happy, sad, or confused.

Perfect for:
✅ Adding humor to coding sessions
✅ Live demos & hackathons
✅ Side projects that surprise developers with witty feedback


✨ Features

  • 🚀 Works out-of-the-box (no setup needed).
  • 🧠 Uses Hugging Face Transformers locally if available.
  • ☁️ Falls back to Hugging Face API (if you provide HF_TOKEN).
  • 🎭 Funny explanations — not just “Positive”, but “Model got happy because it saw print 🎉”.
  • 🐍 Lightweight, pip-installable, hackathon-friendly.

📦 Installation

pip install codemood

⚡ Quickstart

from codemood import analyze_code

snippet = "for i in range(10): print(i)"
mood = analyze_code(snippet)

print(mood)

Output:

{
  'label': 'POSITIVE',
  'score': 0.98,
  'reason': "Model got happy because it saw print 🎉"
}

🎯 Advanced Usage

from codemood import CodeMoodAnalyzer

analyzer = CodeMoodAnalyzer()

# Analyze a function
code = """
def greet(name):
    print("Hello", name)
"""
print(analyzer.analyze(code))

# Alias method (same result)
print(analyzer.explain_sentiment(code))

🔑 Hugging Face API (Optional)

By default, Codemood works offline with transformers.
If you want cloud inference, set your Hugging Face token:

export HF_TOKEN="your_hf_token_here"

No token? No worries → Codemood will gracefully skip cloud mode.


🛠️ Roadmap

  • Add more “emotions” beyond positive/negative.
  • Language-specific code mood tuning (Python vs JS vs C++).
  • VS Code extension for live code mood popups.

🤝 Contributing

PRs are welcome! Fork the repo, create a branch, and send a PR with your funniest improvements.


📜 License

MIT — Free to use, remix, and make your code smile 😄


🔥 With Codemood, your code reviews will never be boring again.


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

codemood-0.0.3.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

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

codemood-0.0.3-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file codemood-0.0.3.tar.gz.

File metadata

  • Download URL: codemood-0.0.3.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for codemood-0.0.3.tar.gz
Algorithm Hash digest
SHA256 cd1306ea26ef538f306fde39ea80dc27d2ae1fc2c3a7aade471dc76df43e2bde
MD5 53a4ec09074b47d4ba4ecebad5a58356
BLAKE2b-256 a0f91f9bad11659883f27799f2be35c22c4056c61bc8042ec95a2ffa603756da

See more details on using hashes here.

File details

Details for the file codemood-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: codemood-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for codemood-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bc1b20d9e3c960fad09b4dad7a2e18520204a0be2e90de1d5eed0b827b3efab6
MD5 8a87aa58925f58b1bfc4a8ef93467c55
BLAKE2b-256 07e7bf01a3e3078d39ba05439285ebcf6902888d4c552f935ab36179ce0dfb38

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