Skip to main content

High Performance Frameworks, Easy to learn and Ready for Production

Project description

Xyra Framework

Python Version License: MIT PyPI version

A high-performance, asynchronous web framework for Python, built on top of socketify.py. Xyra is designed to be fast, easy to use, and feature-rich, making it an excellent choice for building modern web applications, APIs, and real-time applications.

✨ Key Features

  • 🚀 High Performance: Built on socketify.py for exceptional speed and low latency
  • Asynchronous: Full async/await support for non-blocking operations
  • 🎯 Simple API: Intuitive design inspired by Flask and Express.js
  • 🔧 Middleware Support: Easily add logging, authentication, CORS, and more
  • 📚 Auto API Docs: Built-in Swagger/OpenAPI documentation generation
  • 🔌 WebSocket Support: Real-time communication out of the box
  • 📄 Templating: Jinja2 integration for HTML rendering
  • 📁 Static Files: Efficient static file serving
  • 🛡️ Type Safety: Full type hints support

📦 Installation

Install Xyra using pip:

pip install xyra

Or install from source for the latest features:

git clone https://github.com/xyra-python/xyra.git
cd xyra
pip install -e .

🚀 Quick Start

Create your first Xyra application:

# app.py
from xyra import App, Request, Response

app = App()

@app.get("/")
def hello(req: Request, res: Response):
    res.json({"message": "Hello, Xyra!"})

if __name__ == "__main__":
    app.listen(8000)

Or

# app.py
from xyra import App

app = App()

@app.get("/")
def hello(req, res):
    res.json({"message": "Hello, Xyra!"})

if __name__ == "__main__":
    app.listen(8000)

Run the application:

python app.py

Visit http://localhost:8000 to see your app in action!

📖 Documentation

🎯 Example Applications

REST API

from xyra import App, Request, Response

app = App()

# In-memory storage
users = []

@app.get("/api/users")
def get_users(req: Request, res: Response):
    res.json(users)

@app.post("/api/users")
async def create_user(req: Request, res: Response):
    user_data = await req.json()
    user_data["id"] = len(users) + 1
    users.append(user_data)
    res.status(201).json(user_data)

if __name__ == "__main__":
    app.listen(8000)

WebSocket Chat

from xyra import App

app = App()
clients = set()

def on_open(ws):
    clients.add(ws)
    ws.send("Welcome to chat!")

def on_message(ws, message, opcode):
    for client in clients:
        if client != ws:
            client.send(f"User: {message}")

def on_close(ws, code, message):
    clients.discard(ws)

app.websocket("/chat", {
    "open": on_open,
    "message": on_message,
    "close": on_close
})

if __name__ == "__main__":
    app.listen(8000)

HTML with Templates

from xyra import App, Request, Response

app = App(templates_directory="templates")

@app.get("/")
def home(req: Request, res: Response):
    res.render("home.html", title="My App", users=["Alice", "Bob"])

if __name__ == "__main__":
    app.listen(8000)

🏃 Running Examples

Try the included examples:

# Simple app
python example/simple_app.py

# Full-featured app with templates and WebSocket
python example/app.py

Visit http://localhost:8000 and explore the API docs at http://localhost:8000/docs.

🤝 Contributing

We welcome contributions! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'Add amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

Development Setup

git clone https://github.com/xyra-python/xyra.git
cd xyra
pip install -e .[dev]
pytest

Code Style

We use:

  • Black for code formatting
  • isort for import sorting
  • flake8 for linting
  • mypy for type checking

📄 License

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

🙏 Acknowledgments

  • Built on top of socketify.py
  • Inspired by Flask, Express.js, and FastAPI
  • Thanks to all our contributors!

📞 Support


Made with ❤️ for the Python community

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

xyra-0.2.3.tar.gz (228.5 kB view details)

Uploaded Source

Built Distributions

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

xyra-0.2.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (724.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

xyra-0.2.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (724.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

xyra-0.2.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (723.9 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

File details

Details for the file xyra-0.2.3.tar.gz.

File metadata

  • Download URL: xyra-0.2.3.tar.gz
  • Upload date:
  • Size: 228.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for xyra-0.2.3.tar.gz
Algorithm Hash digest
SHA256 4749e56171b2232a10cc6fb817b8a72a48606bf7ca4502387e7576aa3dade964
MD5 9b589bb353bd94146e31bc60ef048d1d
BLAKE2b-256 95f76398cd81c7f93d8a0ca4b85f7c28de2bb9e4485e80c9e7f66e989b163c29

See more details on using hashes here.

File details

Details for the file xyra-0.2.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

  • Download URL: xyra-0.2.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 724.7 kB
  • Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for xyra-0.2.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 96899ff24b841a6e25acd1f081498b09ee64bd2a8becaaafd6a399954e49aa91
MD5 a3adc03fcbbce37efa0b2a7298390a8f
BLAKE2b-256 47115121bd2b3eb30d11ccbfa5d695bdd9cb4173fbe964d6c6be027334eec674

See more details on using hashes here.

File details

Details for the file xyra-0.2.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

  • Download URL: xyra-0.2.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 724.6 kB
  • Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for xyra-0.2.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d4e1c14e060431a669f39bb09b8681ff3b044001739cc6daa3354b1be7d8524b
MD5 1237fd07b292c192bae84f53b6409e33
BLAKE2b-256 74448e0f5e6c584b02af878739002a109f3137f6db6b2bb25092c802130cab47

See more details on using hashes here.

File details

Details for the file xyra-0.2.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

  • Download URL: xyra-0.2.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 723.9 kB
  • Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for xyra-0.2.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 26ea8e489990797c9dfa35766a7759afdf2cca7d991ccd264276ad94633a2417
MD5 c9749a64e2ec1767e092a5679da55738
BLAKE2b-256 61d10f94ea19f3df21db1e6ded0309fd4310ac691faf2eed55a25d0b5273c577

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