Skip to main content

a custom web server module.

Reason this release was yanked:

i forgot to update the readme.md

Project description

AServer

A fast, lightweight Python HTTP server featuring a built-in micro-Jinja template evaluation engine with zero third-party dependencies.


Features

  • Custom Template Engine: Native syntax supporting loops ({% for %}), conditionals ({% if %}), and dynamic variable interpolation ({{ var }}).
  • Resource Safe: Handles files securely with context managers to prevent memory leaks.
  • Modern Packaging: PyPA compliant layout ready for PyPI distribution.

Project Layout

AServer/
├── LICENSE
├── README.md
├── pyproject.toml
└── src/
    └── aserver/
        ├── __init__.py
        ├── renderer.py
        └── server.py

Installation

Install the package directly from your local repository root:

pip install .

To install in editable/development mode:

pip install -e .

Quick Start

1. Create your Template File (index.html)

<div class="container">
    <h1>Welcome, {{ username }}!</h1>
    
    {% if show_list %}
    <ul>
        {% for item in items %}
        <li><strong>Item:</strong> {{ item }}</li>
        {% endfor %}
    </ul>
    {% endif %}
</div>

2. Run the Server

from aserver import ServerHTTP

# Define address, template path, and initial context variables
address = ('127.0.0.1', 8080)
template = 'index.html'
context_data = {
    "username": "Alice",
    "show_list": True,
    "items": ["Apples", "Guavas", "Cherries"]
}

# Initialize and start serving
server = ServerHTTP(address, template, data=context_data)
server.serve()

Configuration

You can also control application settings natively through the pyproject.toml file under the custom tool namespace:

[tool.aserver.settings]
host = "127.0.0.1"
port = 8080
default_template = "index.html"

[tool.aserver.initial_data]
username = "Developer"
site_title = "AServer Web App"

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

aserver-0.1.1.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

aserver-0.1.1-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file aserver-0.1.1.tar.gz.

File metadata

  • Download URL: aserver-0.1.1.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for aserver-0.1.1.tar.gz
Algorithm Hash digest
SHA256 76bef890f443b6e19d1cf1afbe8e9aa1f4e5c6859e65671ee63826ebe35fa13f
MD5 33b2b0eeefacb517cad4ef14fda40a3b
BLAKE2b-256 955dec141435c7a81ebb0ecbc1ec50f0e8f6befb09ec77110d88f736ad0b3580

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aserver-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for aserver-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bf82109608c6a7e8616c2a13d2ca52bd479c212efca54057dfeb14e4c439adc5
MD5 d1575dadbe2de2baba5dc1abafe37f1c
BLAKE2b-256 9b1890642daca8e9b2bc5477bf8ff880a09b81532905baeda97a75e53217005e

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