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

Uploaded Python 3

File details

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

File metadata

  • Download URL: codemood-0.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 e7d382c8cd2221bef7c48c34d79ccab84053a101367d4458d3164803961dab2b
MD5 b102eb36e570d6d6d76db290e34117ba
BLAKE2b-256 6d57403df535a06c0053866f17f3ac543906f84b60b1fa624a53c32dde8ad3c0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: codemood-0.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1072c280eb4c16e4da104866a50ca89c4c7cc213a5c6f2a547cf9b4cdaf9999d
MD5 54264d8ed456b53d158edc5b9eeb9844
BLAKE2b-256 fe056f1a7dcc311b2b24546dda8202c63d2175be894b86f06bd0464591b21e30

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