A Python-based command-line server with controller management
Project description
PyLevel
A Python-based command-line server with controller management, configuration handling, and process management capabilities.
Installation
- Clone the repository:
git clone https://github.com/py-level/py-level.git
cd py-level
- Install the package:
pip install -e .
Quick Start
- Start the server:
pylevel serve --port 8000 --workers 4
- Create a controller:
pylevel make:controller UserController
- Check server status:
pylevel status
For a complete list of commands and their options, see COMMANDS.md.
Environment Variables
You can configure the server using environment variables prefixed with PYLEVEL_:
export PYLEVEL_PORT=8000
export PYLEVEL_WORKERS=4
export PYLEVEL_HOST=127.0.0.1
Development
Project Structure
slave/
├── __init__.py # Package initialization
├── __main__.py # Entry point
├── cli.py # Command-line interface
├── config.py # Configuration management
├── controllers.py # Controller management
├── process.py # Process management
└── app/
└── controllers/ # Controller implementations
└── base_controller.py
Creating a Custom Controller
from typing import Dict, Any
from slave.app.controllers.base_controller import BaseController
class UserController(BaseController):
async def get(self, request: Dict[str, Any]) -> Dict[str, Any]:
# Validate request
rules = {
'id': {'required': True, 'type': int}
}
if not self.validate(rules):
return self.get_response()
# Process request
user_id = request['id']
return self.success({'id': user_id, 'name': 'John Doe'})
Documentation
- Commands Documentation - Detailed information about all available commands
- Contributing Guidelines - Guidelines for contributing to the project
- API Documentation - API reference and examples
Contributing
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pylevelframework-0.1.1.tar.gz.
File metadata
- Download URL: pylevelframework-0.1.1.tar.gz
- Upload date:
- Size: 18.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6f20cad9ebb3d26309a184ad8a9c5ecf1398fcb5a51618d2dd7256fb093642e
|
|
| MD5 |
e3dac2520c8e00de5b37bdada846ce79
|
|
| BLAKE2b-256 |
53b8218f470ab7972bad1bb4108521562ea0b7fda3a3c985ac9c64dc00a05c44
|
File details
Details for the file pylevelframework-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pylevelframework-0.1.1-py3-none-any.whl
- Upload date:
- Size: 21.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b151517dd4c68cc3962fd97e554719b5478431d2e1ec8059e21d1b37e0a62051
|
|
| MD5 |
0b1d97a23c1feab0421d80cb93abc3ea
|
|
| BLAKE2b-256 |
865ce017f1be1a2c3ffbd3220bb1584b05d24ecfc4b5dfbf40e680dbd52f250a
|