Skip to main content

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

  1. Clone the repository:
git clone https://github.com/py-level/py-level.git
cd py-level
  1. Install the package:
pip install -e .

Quick Start

  1. Start the server:
pylevel serve --port 8000 --workers 4
  1. Create a controller:
pylevel make:controller UserController
  1. 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

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

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

pylevelframework-0.1.1.tar.gz (18.4 kB view details)

Uploaded Source

Built Distribution

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

pylevelframework-0.1.1-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

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

Hashes for pylevelframework-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a6f20cad9ebb3d26309a184ad8a9c5ecf1398fcb5a51618d2dd7256fb093642e
MD5 e3dac2520c8e00de5b37bdada846ce79
BLAKE2b-256 53b8218f470ab7972bad1bb4108521562ea0b7fda3a3c985ac9c64dc00a05c44

See more details on using hashes here.

File details

Details for the file pylevelframework-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pylevelframework-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b151517dd4c68cc3962fd97e554719b5478431d2e1ec8059e21d1b37e0a62051
MD5 0b1d97a23c1feab0421d80cb93abc3ea
BLAKE2b-256 865ce017f1be1a2c3ffbd3220bb1584b05d24ecfc4b5dfbf40e680dbd52f250a

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