Skip to main content

AKPy - Lightweight Flask-like Python Framework

Project description

AKPy 🚀

AKPy is a lightweight, Flask-like Python web framework designed for simplicity, speed, and learning how web frameworks work under the hood.

Built from scratch with clean architecture, AKPy gives you full control while staying minimal.


✨ Features

  • ⚡ Simple and clean routing system
  • 🔗 Dynamic routes (/user/<name>)
  • 📦 JSON response support
  • 🧩 Middleware system
  • 🖼️ Basic template rendering
  • 📁 Static file serving
  • 🖥️ CLI tool (akpy run)
  • 📦 pip-installable package

📦 Installation

pip install akpy

🚀 Quick Start

Create a file app.py:

from akpy import AKPy

app = AKPy()

@app.route("/")
def home(req):
    return "Hello, AKPy!"

@app.route("/user/<name>")
def user(req, name):
    return {"user": name}

Run the server:

akpy run app:app

Open in browser:

http://127.0.0.1:5000

🧠 Routing

@app.route("/hello/<name>")
def greet(req, name):
    return f"Hello {name}"

📦 JSON Response

Return a dictionary:

@app.route("/api")
def api(req):
    return {"status": "success"}

AKPy automatically converts it to JSON.


🧩 Middleware

def logger(req):
    print(f"{req.method} {req.path}")

app.use(logger)

🖼️ Templates

from akpy.templating import render_template

@app.route("/html")
def html(req):
    return render_template("templates/index.html", name="AKPy")

Example index.html:

<h1>Hello {{name}}</h1>

📁 Static Files

Place files inside a static/ folder:

/static/style.css

Access in browser:

http://127.0.0.1:5000/static/style.css

🛠️ CLI Usage

akpy run module:app

Example:

akpy run example.app:app

📁 Project Structure

akpy/
│
├── akpy/
├── cli/
├── example/
├── setup.py
├── pyproject.toml
└── README.md

akpy run app:app --debug

🔄 Development Setup

python -m venv venv
venv\Scripts\activate
pip install -e .

📌 Roadmap

  • 🔥 Hot reload (dev mode)
  • ⚡ Async support (FastAPI style)
  • 🗄️ Database integration
  • 🎨 Advanced template engine
  • 🔐 Authentication system

🤝 Contributing

Pull requests are welcome. For major changes, open an issue first.


📄 License

MIT License


👨‍💻 Author

Amal K P


⭐ Support

If you like this project, give it a star on GitHub ⭐

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

akpy-0.1.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

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

akpy-0.1.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file akpy-0.1.0.tar.gz.

File metadata

  • Download URL: akpy-0.1.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.1

File hashes

Hashes for akpy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4b13aef569c7c43de86b63a5a3d68ea4ca0fd000a18db6d2929360e8bdb30293
MD5 83a52d5154d9dc0ec760c340d7f32991
BLAKE2b-256 3cf3ba095c3ce9a4305aeaea12b1a1d20dbcfe11bdd55986081196c48da86ae8

See more details on using hashes here.

File details

Details for the file akpy-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: akpy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.1

File hashes

Hashes for akpy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 de8354819970ea6d77117e3e2137fb70db6d7727a0cc1c90164b4e51bf51cdb0
MD5 84f1a2b8ea07649d70974272afd3bd29
BLAKE2b-256 3030057d22016ea9fd5139d2f12878a18039ff24fd93c287b36fba3aafba1098

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