Skip to main content

Nebula is a lightweight ASGI-based Python web framework that provides simple, decorator-based routing and middleware support for building fast, asynchronous web applications.

Project description

Nebula

PyPI Stars Contributors

Nebula is a lightweight ASGI-based Python web framework that provides simple, decorator-based routing and middleware support for building fast, asynchronous web applications.

Features

  • Decorator-based Routing: Define your routes with simple and intuitive decorators.
  • Asynchronous Support: Full async/await support for handling requests and events.
  • Session Management: Secure session handling using HMAC-signed cookies.
  • WebSocket Support: Integrated python-socketio for real-time communication.
  • Template Loading: Easily load and serve HTML templates from a designated directory using Jinja2.
  • Statics Loading: Easily load and serve static files from a designated directory.
  • Middleware Support: Chain middleware for request/response processing, both globally and per-route/group.
  • Flexible Error Handling: Define custom handlers for HTTP errors.
  • Easy to Use: Get a server up and running in just a few lines of code.

Installation

Install Nebula from PyPI:

pip install nebula-core

or clone and install from GitHub:

git clone https://github.com/VxidDev/nebula.git
cd nebula
pip install .

Project Structure

The Nebula project follows a standard Python project structure:

  • .: Root directory containing configuration files (.gitignore, pyproject.toml, README.md, LICENSE).
  • build/, dist/, *.egg-info/: Build and distribution artifacts.
  • examples/: Example applications demonstrating various Nebula features.
  • nebula/: The core library code.
    • middleware.py: Defines middleware classes (BaseMiddleware, Middleware).
    • routing.py: Handles route definitions (Route, RouteGroup) and path matching.
    • server.py: The main ASGI application, request handling, and middleware composition logic.
    • request.py: Defines the Request object and context.
    • response.py: Defines various Response classes (PlainText, HTML, JSON, Redirect).
    • session.py: Implements session management (SecureCookieSessionManager).
    • types.py: Contains constants like available HTTP methods and default error messages.
    • exceptions.py: Defines custom exceptions used by the framework.
    • utils/: Utility functions for templating, static file serving, etc.
  • tests/: Contains unit and integration tests for the framework.

Usage Examples

Basic Routing

A simple web server with a root endpoint:

from nebula import Nebula

app = Nebula()

@app.get("/")
async def root():
    return "<h1>Welcome to Nebula!</h1>"

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

Contributing

Contributions are welcome!

  • Bug Reports: Please report bugs in the GitHub Issues section.
  • Feature Requests: Feel free to open an issue to discuss new features.
  • Pull Requests: Fork the repository, create a new branch for your feature or bugfix, and submit a pull request. Please ensure your code follows the project's coding style and includes tests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

nebula_core-3.2.0.tar.gz (22.8 kB view details)

Uploaded Source

Built Distribution

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

nebula_core-3.2.0-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

Details for the file nebula_core-3.2.0.tar.gz.

File metadata

  • Download URL: nebula_core-3.2.0.tar.gz
  • Upload date:
  • Size: 22.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.13

File hashes

Hashes for nebula_core-3.2.0.tar.gz
Algorithm Hash digest
SHA256 2066688214ad35b8b75126395dbc394ad5fda01c6499f2688a6dc82f21d556ea
MD5 ddf55f7407b4b996b8257f2666ea5972
BLAKE2b-256 d69855def136273f3af951b8356ea2643ed2df0b3d57e0c6b058e228fe8e75cd

See more details on using hashes here.

File details

Details for the file nebula_core-3.2.0-py3-none-any.whl.

File metadata

  • Download URL: nebula_core-3.2.0-py3-none-any.whl
  • Upload date:
  • Size: 20.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.13

File hashes

Hashes for nebula_core-3.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3057a018379cdcec8f11e447e51b906c351638449975bb04343be6123fab208f
MD5 63ae7ac7f9aa320ac7eb2569fb3e5e60
BLAKE2b-256 e7f09ddcf57715c242036145c3cb383c1ea0bb2192b503afc0db4bff32c32c42

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