Skip to main content

Ushka is a minimal, experimental Python micro-framework for hobbyists and solo developers. Its goal is to enable rapid API development with zero boilerplate by using file-based routing.

Project description

๐Ÿ’– Ushka Framework: Make Python Cute Again! ๐ŸŽ€

PyPI Version Documentation Python Versions License Code Style: Black

โœจ MINIMALIST ABOVE EVERYONE, CUTE ABOVE EVERYTHING. โœจ The most adorable, agile, and visually captivating web framework for your Python adventures!


๐Ÿพ Hello, Lovely Coder! I'm Ushka!

Are you tired of web frameworks that feel... well, a bit boring? ๐Ÿ˜ด Black-and-white logs, endless configurations, and error pages that make you want to curl up and cry? ๐Ÿ˜ญ

๐Ÿ’– Ushka believes backend coding should be a joyous, beautiful experience! I transform the mundane into the magical, turning complex tasks into simple, delightful moments.

๐ŸŒŸ Why choose little old me? (Ushka's Sweet Perks!)

  • ๐ŸŽจ Visual Delight: My terminal logs are a pastel dream! Minimalist, organized, and bursting with helpful colors.
  • ๐Ÿ“‚ File-Based Routing: Pure Magic! โœจ Forget wrestling with imports. Just create a file in your routes/ folder, and poof! Your API endpoint is ready to charm.
  • โœ๏ธ Decorator Routing: Elegantly Expressive! For those who love a clear declaration, define your routes with cute little decorators, just like hugging your code!
  • ๐Ÿง  Zero Config: Instant Cuddles! Run me for the first time, and I'll lovingly craft an ushka.toml just for you. No fuss, just fun!
  • ๐Ÿ›ก๏ธ Ushka Panic: The Cutest Errors! Oopsie! A bug? My interactive error page is so darling, you might just fall in love with debugging! Copy tracebacks, inspect variables โ€“ all with a friendly smile.

๐Ÿ“š Peek at the Docs!

This README is just a tiny hug! For a deeper dive into Ushka's heart, including tutorials, guides, and a full API reference, flutter over to our full documentation here.


โœ… What Ushka does best! (Tiny but Mighty Features!)

Ushka is always growing with love! Here's what's purring smoothly in the current version:

  • โœ… Dual Routing System: Double the Cuteness!
    • Auto-Discovery: Automatic route mapping just by creating files in routes/.
    • Decorator-Based: Explicitly define routes with @app.get(), @app.post(), etc.
  • โœ… Smart Request Object: Clever & Cozy! Access headers, query, body, json, and form data effortlessly. Data loads lazily, just when you need a little peek!
  • โœ… Flexible Response: Your Way, Always! Return a dict (for yummy JSON), a str (for snuggly HTML), or a full Response object for ultimate control!
  • โœ… Jinja2 Templates: Warm & Fuzzy! Native support with a simple render() function to make your pages sparkle.
  • โœ… Ushka Panic: Debugging is a Breeze! Stylized error handling (500/404) with a cozy dark theme, interactive stacktrace, and super clear code highlighting.
  • โœ… Auto Config: Set & Forget! Automatic generation and gentle reading of ushka.toml.
  • โœ… Rich Logging: A Symphony of Colors! Request logs adorned with colors for every status code (Success=Green, Error=Red, Redirect=Blue).
  • โœ… Dependency Injection: Smart Helpers! Automatically inject the Request object and dynamic URL parameters into your route functions with just a type-hint. So clever!
  • โœ… Core ASGI: Speedy & Sweet! Built on Uvicorn, fully asynchronous for a zippy, happy experience.

๐Ÿ“ฆ Install Ushka (It's a Cinch!)

Getting started is as easy as a gentle purr!

pip install ushka

๐Ÿš€ How to Play with Ushka! (Super Simple Steps!)

Ushka offers two delightful ways to build your API. Pick your favorite or mix them up!

Method 1: File-Based Routing (The Classic Cuddle!)

This method embraces "Convention over Configuration" with a warm hug!

1. Your Project's Cozy Nook:

my_project/
โ”œโ”€โ”€ app.py              # Where all the magic begins!
โ”œโ”€โ”€ ushka.toml          # Ushka lovingly creates this for you!
โ””โ”€โ”€ routes/             # Your delightful Routes (Pure enchantment!)
    โ”œโ”€โ”€ index.py        # Route: /
    โ””โ”€โ”€ users/
        โ””โ”€โ”€ [id].py     # Route: /users/<id>

2. Your First Charming Route (routes/index.py):

The function name sweetly becomes your HTTP Method!

# Responds to GET / with a little wave!
def get():
    return "<h1>Hello, World from Ushka! ๐Ÿ’–</h1>"

3. Your Little App (app.py):

from ushka import Ushka

app = Ushka()

if __name__ == "__main__":
    # Host and port are loaded from your cozy ushka.toml
    app.run()

Method 2: Decorator-Based Routing (The Explicit Embrace!)

Prefer to see all your routes in one happy place? Decorators are your best friend!

1. Your Little App (app.py):

from ushka import Ushka, Request

app = Ushka()

# Responds to GET / with a cheerful greeting!
@app.get("/")
def index():
    return "<h1>Hello from a decorator, with love!</h1>"

# Responds to POST /users with a warm welcome!
@app.post("/users")
async def create_user(request: Request):
    user_data = await request.json()
    return {"status": "created", "user": user_data}

if __name__ == "__main__":
    app.run()

Run it! (So exciting!)

python app.py

Peep at your terminal! Admire the adorable banner. See your neat route table. Now, dash over to http://127.0.0.1:8000 and feel the cuteness!


๐Ÿ–ผ๏ธ A Glimpse of Cuteness! (Visual Showcase)

The "Ushka Panic" (Your Debugging Buddy!)

We know little accidents happen, but debugging shouldn't be a scary monster! Ushka Panic is here to help with a smile.

  • ๐Ÿ‘€ Inspect local variables: Peek at what's happening behind the scenes!
  • ๐Ÿ“‹ Copy the error: One tiny click to share with your friends (or StackOverflow/ChatGPT)!
  • ๐ŸŒ™ Dark theme: So your eyes stay cozy even during late-night coding cuddles!

Ushka Panic Screenshot


๐Ÿค Join Our Cozy Community!

Ushka is made with so much โค๏ธ. Spotted a teeny bug? Have a sweet feature idea? Please, open an Issue!

  • License: MIT
  • Author: Kleber Code (kleber-code)

Made with an abundance of โค๏ธ, Python magic, and endless purrs.

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

ushka-0.3.0.tar.gz (23.3 kB view details)

Uploaded Source

Built Distribution

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

ushka-0.3.0-py3-none-any.whl (25.1 kB view details)

Uploaded Python 3

File details

Details for the file ushka-0.3.0.tar.gz.

File metadata

  • Download URL: ushka-0.3.0.tar.gz
  • Upload date:
  • Size: 23.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ushka-0.3.0.tar.gz
Algorithm Hash digest
SHA256 5e1c973ed0e00c4d124f90771792b2e117a5709c0aeae2ea5e5ad66cbf1b627a
MD5 cc2fc4ff86c08a66ddf09885826b8854
BLAKE2b-256 55deed0ed5086689addc508705b408350234ff9006aad3930ac86de9e7640f03

See more details on using hashes here.

Provenance

The following attestation bundles were made for ushka-0.3.0.tar.gz:

Publisher: python-publish.yml on kleber-code/ushka

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ushka-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: ushka-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 25.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ushka-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ded49e857bd6256c959f9325e409e78b9cff25fbe1045b3c27566faf3b86b8cd
MD5 3083294fe15dd9acfa7c02386eee6c00
BLAKE2b-256 515cb61518d16f9d5959bb0053b713b7c2c42e495b4d0eb15efa4399988bfe68

See more details on using hashes here.

Provenance

The following attestation bundles were made for ushka-0.3.0-py3-none-any.whl:

Publisher: python-publish.yml on kleber-code/ushka

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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