xyra


Namexyra JSON
Version 0.1.3 PyPI version JSON
download
home_pageNone
SummaryA fast and simple web framework for Python
upload_time2025-10-06 13:18:18
maintainerNone
docs_urlNone
authorNone
requires_python>=3.11
licenseMIT
keywords web framework async fast python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Xyra Framework

[![Python Version](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![PyPI version](https://badge.fury.io/py/xyra.svg)](https://pypi.org/project/xyra/)

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:

```bash
pip install xyra
```

Or install from source for the latest features:

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

## 🚀 Quick Start

Create your first Xyra application:

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

app = App()

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

@app.get("/users/{user_id}")
def get_user(req: Request, res: Response):
    user_id = req.params.get("user_id")
    res.json({"user_id": user_id, "name": f"User {user_id}"})

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

Run the application:

```bash
python app.py
```

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

## 📖 Documentation

- 📚 [Full Documentation](docs/README.md)
- 🚀 [Getting Started Guide](docs/getting-started.md)
- 🛣️ [Routing Guide](docs/routing.md)
- 📝 [API Reference](docs/api-reference.md)
- 💡 [Examples](docs/examples.md)

## 🎯 Example Applications

### REST API

```python
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

```python
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

```python
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:

```bash
# 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

```bash
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](LICENSE) file for details.

## 🙏 Acknowledgments

- Built on top of [socketify.py](https://github.com/cirospaciari/socketify.py)
- Inspired by Flask, Express.js, and FastAPI
- Thanks to all our contributors!

## 📞 Support

- 📖 [Documentation](docs/README.md)
- 🐛 [Issues](https://github.com/xyra-python/xyra/issues)
- 💬 [Discussions](https://github.com/xyra-python/xyra/discussions)

---

Made with ❤️ for the Python community

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "xyra",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": "Xyra Team <team@xyra.dev>",
    "keywords": "web, framework, async, fast, python",
    "author": null,
    "author_email": "Xyra Team <team@xyra.dev>",
    "download_url": "https://files.pythonhosted.org/packages/78/9f/da468bd4cbc3571c3670116f970851436aa77305c5dbad0636833c17ea4f/xyra-0.1.3.tar.gz",
    "platform": null,
    "description": "# Xyra Framework\n\n[![Python Version](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![PyPI version](https://badge.fury.io/py/xyra.svg)](https://pypi.org/project/xyra/)\n\nA 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.\n\n## \u2728 Key Features\n\n- \ud83d\ude80 **High Performance**: Built on `socketify.py` for exceptional speed and low latency\n- \u26a1 **Asynchronous**: Full async/await support for non-blocking operations\n- \ud83c\udfaf **Simple API**: Intuitive design inspired by Flask and Express.js\n- \ud83d\udd27 **Middleware Support**: Easily add logging, authentication, CORS, and more\n- \ud83d\udcda **Auto API Docs**: Built-in Swagger/OpenAPI documentation generation\n- \ud83d\udd0c **WebSocket Support**: Real-time communication out of the box\n- \ud83d\udcc4 **Templating**: Jinja2 integration for HTML rendering\n- \ud83d\udcc1 **Static Files**: Efficient static file serving\n- \ud83d\udee1\ufe0f **Type Safety**: Full type hints support\n\n## \ud83d\udce6 Installation\n\nInstall Xyra using pip:\n\n```bash\npip install xyra\n```\n\nOr install from source for the latest features:\n\n```bash\ngit clone https://github.com/xyra-python/xyra.git\ncd xyra\npip install -e .\n```\n\n## \ud83d\ude80 Quick Start\n\nCreate your first Xyra application:\n\n```python\n# app.py\nfrom xyra import App, Request, Response\n\napp = App()\n\n@app.get(\"/\")\ndef hello(req: Request, res: Response):\n    res.json({\"message\": \"Hello, Xyra!\"})\n\n@app.get(\"/users/{user_id}\")\ndef get_user(req: Request, res: Response):\n    user_id = req.params.get(\"user_id\")\n    res.json({\"user_id\": user_id, \"name\": f\"User {user_id}\"})\n\nif __name__ == \"__main__\":\n    app.listen(8000)\n```\n\nRun the application:\n\n```bash\npython app.py\n```\n\nVisit `http://localhost:8000` to see your app in action!\n\n## \ud83d\udcd6 Documentation\n\n- \ud83d\udcda [Full Documentation](docs/README.md)\n- \ud83d\ude80 [Getting Started Guide](docs/getting-started.md)\n- \ud83d\udee3\ufe0f [Routing Guide](docs/routing.md)\n- \ud83d\udcdd [API Reference](docs/api-reference.md)\n- \ud83d\udca1 [Examples](docs/examples.md)\n\n## \ud83c\udfaf Example Applications\n\n### REST API\n\n```python\nfrom xyra import App, Request, Response\n\napp = App()\n\n# In-memory storage\nusers = []\n\n@app.get(\"/api/users\")\ndef get_users(req: Request, res: Response):\n    res.json(users)\n\n@app.post(\"/api/users\")\nasync def create_user(req: Request, res: Response):\n    user_data = await req.json()\n    user_data[\"id\"] = len(users) + 1\n    users.append(user_data)\n    res.status(201).json(user_data)\n\nif __name__ == \"__main__\":\n    app.listen(8000)\n```\n\n### WebSocket Chat\n\n```python\nfrom xyra import App\n\napp = App()\nclients = set()\n\ndef on_open(ws):\n    clients.add(ws)\n    ws.send(\"Welcome to chat!\")\n\ndef on_message(ws, message, opcode):\n    for client in clients:\n        if client != ws:\n            client.send(f\"User: {message}\")\n\ndef on_close(ws, code, message):\n    clients.discard(ws)\n\napp.websocket(\"/chat\", {\n    \"open\": on_open,\n    \"message\": on_message,\n    \"close\": on_close\n})\n\nif __name__ == \"__main__\":\n    app.listen(8000)\n```\n\n### HTML with Templates\n\n```python\nfrom xyra import App, Request, Response\n\napp = App(templates_directory=\"templates\")\n\n@app.get(\"/\")\ndef home(req: Request, res: Response):\n    res.render(\"home.html\", title=\"My App\", users=[\"Alice\", \"Bob\"])\n\nif __name__ == \"__main__\":\n    app.listen(8000)\n```\n\n## \ud83c\udfc3 Running Examples\n\nTry the included examples:\n\n```bash\n# Simple app\npython example/simple_app.py\n\n# Full-featured app with templates and WebSocket\npython example/app.py\n```\n\nVisit `http://localhost:8000` and explore the API docs at `http://localhost:8000/docs`.\n\n## \ud83e\udd1d Contributing\n\nWe welcome contributions! Here's how you can help:\n\n1. **Fork** the repository\n2. **Create** a feature branch: `git checkout -b feature/amazing-feature`\n3. **Commit** your changes: `git commit -m 'Add amazing feature'`\n4. **Push** to the branch: `git push origin feature/amazing-feature`\n5. **Open** a Pull Request\n\n### Development Setup\n\n```bash\ngit clone https://github.com/xyra-python/xyra.git\ncd xyra\npip install -e .[dev]\npytest\n```\n\n### Code Style\n\nWe use:\n- Black for code formatting\n- isort for import sorting\n- flake8 for linting\n- mypy for type checking\n\n## \ud83d\udcc4 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## \ud83d\ude4f Acknowledgments\n\n- Built on top of [socketify.py](https://github.com/cirospaciari/socketify.py)\n- Inspired by Flask, Express.js, and FastAPI\n- Thanks to all our contributors!\n\n## \ud83d\udcde Support\n\n- \ud83d\udcd6 [Documentation](docs/README.md)\n- \ud83d\udc1b [Issues](https://github.com/xyra-python/xyra/issues)\n- \ud83d\udcac [Discussions](https://github.com/xyra-python/xyra/discussions)\n\n---\n\nMade with \u2764\ufe0f for the Python community\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A fast and simple web framework for Python",
    "version": "0.1.3",
    "project_urls": {
        "Changelog": "https://github.com/xyra-python/xyra/blob/main/CHANGELOG.md",
        "Documentation": "https://xyra.dev/docs",
        "Homepage": "https://github.com/xyra-python/xyra",
        "Issues": "https://github.com/xyra-python/xyra/issues",
        "Repository": "https://github.com/xyra-python/xyra"
    },
    "split_keywords": [
        "web",
        " framework",
        " async",
        " fast",
        " python"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a39c33124eb5a3dc8e4140c56f378927b87abb4647646d6e8147d2f4a03f0914",
                "md5": "260a6210493fa297a48ebaa5791024b1",
                "sha256": "07afeef04204b3f05b4f0cfe700e01bcfd848ace306a8e63fef8d95631ff922d"
            },
            "downloads": -1,
            "filename": "xyra-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "260a6210493fa297a48ebaa5791024b1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 26700,
            "upload_time": "2025-10-06T13:18:17",
            "upload_time_iso_8601": "2025-10-06T13:18:17.188663Z",
            "url": "https://files.pythonhosted.org/packages/a3/9c/33124eb5a3dc8e4140c56f378927b87abb4647646d6e8147d2f4a03f0914/xyra-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "789fda468bd4cbc3571c3670116f970851436aa77305c5dbad0636833c17ea4f",
                "md5": "ed0319f3a2ded344c80684256a0ca57a",
                "sha256": "89e499d0a0bedbd94c177967b54671e13902e097e8129f4943589d8a283f5315"
            },
            "downloads": -1,
            "filename": "xyra-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "ed0319f3a2ded344c80684256a0ca57a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 31320,
            "upload_time": "2025-10-06T13:18:18",
            "upload_time_iso_8601": "2025-10-06T13:18:18.031968Z",
            "url": "https://files.pythonhosted.org/packages/78/9f/da468bd4cbc3571c3670116f970851436aa77305c5dbad0636833c17ea4f/xyra-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-06 13:18:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "xyra-python",
    "github_project": "xyra",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "xyra"
}
        
Elapsed time: 1.86000s