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

PyPI Version Python Versions License Code Style: Black

Make Python Cute Again. > The most beautiful, agile, and visually striking web framework you'll use in your terminal.


👋 Hi, I'm Ushka!

Tired of frameworks that give you a white screen of death and boring black-and-white logs? Ushka was born from the idea that backend coding doesn't have to be ugly or bureaucratic.

I turn your filesystem into an API automatically, I configure the server myself, and if something goes wrong, I show you a Cyberpunk error page so pretty you'll want to leave the bug there.

✨ Why use me?

  • 🎨 Visual DX: My terminal logs are colorful (Neon/Dark theme), organized, and informative.
  • 📂 File-Based Routing: Stop manually importing controllers. Create a file in the routes/ folder and the magic happens.
  • ✍️ Decorator Routing: For those who prefer explicitness, declare routes with decorators, just like in Flask or FastAPI.
  • 🧠 Zero Config: The first time you run me, I generate ushka.toml for you. No boilerplate.
  • 🛡️ Panic Mode: My interactive error page lets you copy the traceback with one click and inspect local variables.

✅ What's ready? (Features)

Ushka is evolving fast. Here is what is running smoothly in the current version:

  • Dual Routing System:
    • Auto-Discovery: Automatic route mapping based on the routes/ folder.
    • Decorator-Based: Explicitly define routes with @app.get(), @app.post(), etc.
  • Smart Request Object: Access headers, query, body, json, and form data as properties. Data is loaded lazily on first access.
  • Flexible Response: Return a dict (for JSON), str (for HTML), or a complete Response object for full control.
  • Jinja2 Templates: Native support with a simple render() function.
  • Ushka Panic: Stylized error handling (500/404) with dark theme, interactive stacktrace, and code highlighting.
  • Auto Config: Automatic generation and reading of ushka.toml.
  • Rich Logging: Request logs colored by status code (Success=Green, Error=Red, Redirect=Blue).
  • Dependency Injection: Automatically inject the Request object and dynamic URL parameters into your route functions just by type-hinting them.
  • Core ASGI: Based on Uvicorn, fully async.

📦 Installation

pip install ushka

🚀 How to use (No fluff)

Ushka offers two ways to build your API. Choose one or mix them!

Method 1: File-Based Routing (The Classic)

This method follows the "Convention over Configuration" philosophy.

1. The Structure:

my_project/
├── app.py              # Where it all starts
├── ushka.toml          # I create this for you automatically!
└── routes/             # Your Routes (The Magic)
    ├── index.py        # Route: /
    └── users/
        └── [id].py     # Route: /users/<id>

2. The Route (routes/index.py):

The function name becomes the HTTP Method.

# Responds to GET /
def get():
    return "<h1>Hello, World!</h1>"

3. The App (app.py):

from ushka import Ushka

app = Ushka()

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

Method 2: Decorator-Based Routing (The Explicit)

Prefer to see your routes in one place? Use decorators.

1. The App (app.py):

from ushka import Ushka, Request

app = Ushka()

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

# Responds to POST /users
@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!

python app.py

Look at your terminal. Appreciate the banner. See the route table. Now go to http://127.0.0.1:8000.


🖼️ Visual Showcase

The "Ushka Panic" (Debug Page)

We believe that making mistakes is part of the process, but debugging should be easy.

  • Inspect local variables.
  • Copy the error with one click to paste into StackOverflow/ChatGPT.
  • Dark theme so you don't burn your eyes at 3 AM.

Ushka Panic Screenshot


🗺️ Roadmap (What's coming next)

We are currently in Alpha, but we dream big. The plan for World Domination (v1.0):

  • Ushka CLI: ushka new commands to scaffold projects and ushka deploy for auto-HTTPS configuration (Caddy).
  • Multipart Streaming: Support for large file uploads without eating up RAM.
  • Middlewares: Robust system to intercept requests.
  • Cookies & Sessions: Native state management.
  • Subapps (Blueprints): For when your project gets huge.
  • Auth Embedded: Optional built-in login system.

🤝 Contributing

Ushka is open-source and made with love. Spotted a bug? Want to request a feature? Open an Issue!

  • License: MIT
  • Author: Kleber Code

Made with ❤️, Python, and lots of caffeine.

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.2.0.tar.gz (19.6 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.2.0-py3-none-any.whl (21.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ushka-0.2.0.tar.gz
Algorithm Hash digest
SHA256 363d0177114ff79d10be87cb2457199f4aa3db395e9a13f893de78682a61d520
MD5 9c8e7456ac7452759b29d3bf9c6c03ec
BLAKE2b-256 1edc568ef172e38a8f842985552a5b1f883116554fd044127df34b3f8002cfb0

See more details on using hashes here.

Provenance

The following attestation bundles were made for ushka-0.2.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.2.0-py3-none-any.whl.

File metadata

  • Download URL: ushka-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 21.3 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c6b231049c78420c06fc7492330fc3c6048896738d51b2a07723a70160a383cf
MD5 52c1adc6ee95463547cc5818e1360ccb
BLAKE2b-256 8e8411ba69499cbfae014a4602e0f0cbb1835ff47df6e9203cb9575ed0054550

See more details on using hashes here.

Provenance

The following attestation bundles were made for ushka-0.2.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