Metadata-Version: 2.4
Name: pyserve
Version: 0.9.0
Summary: Simple HTTP Web server written in Python
License: MIT
License-File: LICENSE
Author: Илья Глазунов
Author-email: i.glazunov@sapiens.solutions
Requires-Python: >=3.12
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Provides-Extra: all-frameworks
Provides-Extra: dev
Provides-Extra: django
Provides-Extra: fastapi
Provides-Extra: flask
Provides-Extra: wsgi
Requires-Dist: a2wsgi (>=1.10.0) ; extra == "all-frameworks"
Requires-Dist: a2wsgi (>=1.10.0) ; extra == "flask"
Requires-Dist: a2wsgi (>=1.10.0) ; extra == "wsgi"
Requires-Dist: black ; extra == "dev"
Requires-Dist: django (>=5.0) ; extra == "all-frameworks"
Requires-Dist: django (>=5.0) ; extra == "django"
Requires-Dist: fastapi (>=0.115.0) ; extra == "all-frameworks"
Requires-Dist: fastapi (>=0.115.0) ; extra == "fastapi"
Requires-Dist: flake8 ; extra == "dev"
Requires-Dist: flask (>=3.0.0) ; extra == "all-frameworks"
Requires-Dist: flask (>=3.0.0) ; extra == "flask"
Requires-Dist: httpx (>=0.27.0,<0.28.0)
Requires-Dist: isort ; extra == "dev"
Requires-Dist: mypy ; extra == "dev"
Requires-Dist: pytest ; extra == "dev"
Requires-Dist: pytest-asyncio ; extra == "dev"
Requires-Dist: pytest-cov ; extra == "dev"
Requires-Dist: pyyaml (>=6.0,<7.0)
Requires-Dist: starlette (>=0.47.3,<0.48.0)
Requires-Dist: structlog (>=25.4.0,<26.0.0)
Requires-Dist: types-pyyaml (>=6.0.12.20250822,<7.0.0.0)
Requires-Dist: uvicorn[standard] (>=0.35.0,<0.36.0)
Description-Content-Type: text/markdown

# PyServe

PyServe is a modern, async HTTP server written in Python. Originally created for educational purposes, it has evolved into a powerful tool for rapid prototyping and serving web applications with unique features like AI-generated content.

<img src="https://raw.githubusercontent.com/ShiftyX1/PyServe/refs/heads/master/images/logo.png" alt="isolated" width="150"/>

[More on web page](https://pyserve.org/)

## Project Overview

PyServe v0.6.0 introduces a completely refactored architecture with modern async/await syntax and new exciting features like **Vibe-Serving** - AI-powered dynamic content generation.

### Key Features:

- **Async HTTP Server** - Built with Python's asyncio for high performance
- **Advanced Configuration System V2** - Powerful extensible configuration with full backward compatibility
- **Regex Routing & SPA Support** - nginx-style routing patterns with Single Page Application fallback
- **Static File Serving** - Efficient serving with correct MIME types
- **Template System** - Dynamic content generation
- **Vibe-Serving Mode** - AI-generated content using language models (OpenAI, Claude, etc.)
- **Reverse Proxy** - Forward requests to backend services with advanced routing
- **SSL/HTTPS Support** - Secure connections with certificate configuration
- **Modular Extensions** - Plugin-like architecture for security, caching, monitoring
- **Beautiful Logging** - Colored terminal output with file rotation
- **Error Handling** - Styled error pages and graceful fallbacks
- **CLI Interface** - Command-line interface for easy deployment and configuration

## Getting Started

### Prerequisites

- Python 3.12 or higher
- Poetry (recommended) or pip

### Installation

#### Via Poetry (рекомендуется)

```bash
git clone https://github.com/ShiftyX1/PyServe.git
cd PyServe
make init  # Initialize project
```

#### Или установка пакета

```bash
# local install
make install-package

# after installing project you can use command pyserve
pyserve --help
```

### Running the Server

#### Using Makefile (recommended)

```bash
# start in development mode
make run

# start in production mode
make run-prod

# show all available commands
make help
```

#### Using CLI directly

```bash
# after installing package
pyserve

# or with Poetry
poetry run pyserve

# or legacy (for backward compatibility)
python run.py
```

#### CLI options

```bash
# help
pyserve --help

# path to config
pyserve -c /path/to/config.yaml

# rewrite host and port
pyserve --host 0.0.0.0 --port 9000

# debug mode
pyserve --debug

# show version
pyserve --version
```

## Development

### Makefile Commands

```bash
make help          # Show help for commands
make install       # Install dependencies
make dev-install   # Install development dependencies
make build         # Build the package
make test          # Run tests
make test-cov      # Tests with code coverage
make lint          # Check code with linters
make format        # Format code
make clean         # Clean up temporary files
make version       # Show version
make publish-test  # Publish to Test PyPI
make publish       # Publish to PyPI
```

### Project Structure

```
pyserveX/
├── pyserve/           # Main package
│   ├── __init__.py
│   ├── cli.py         # CLI interface
│   ├── server.py      # Main server module
│   ├── config.py      # Configuration system
│   ├── routing.py     # Routing
│   ├── extensions.py  # Extensions
│   └── logging_utils.py
├── tests/             # Tests
├── static/            # Static files
├── templates/         # Templates
├── logs/             # Logs
├── Makefile          # Automation tasks
├── pyproject.toml    # Project configuration
├── config.yaml       # Server configuration
└── run.py           # Entry point (backward compatibility)
```

## License

This project is distributed under the MIT license.
