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.2.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.2-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: codemood-0.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 916d2d1364f743f490d87ecfbc5c3e674eddbc6be0eeb20bc677dfce131cb5dd
MD5 978a7d6d20b2593f8e81b5955e474db4
BLAKE2b-256 0b11d860eb554912daed6d2d320c770b2b701ef347c7e74f1071c8902cd5e293

See more details on using hashes here.

File details

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

File metadata

  • Download URL: codemood-0.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 59dbba259579851a663f2826bd82acda67199878cb7010a891f341bf9deb215f
MD5 bb1b407bf4b75c474a8c5d0828b7e571
BLAKE2b-256 d9961c9a9a4d893ef335da9555b9be0a9fb1f8589a2120df8e024e621928a837

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