Skip to main content

A Python-centric micro-framework for building web applications

Project description

PyKite: A research and development initiative for crafting a Python-centric micro framework.

PyKite Icon

Features

  • Route Definition: Define routes using the @app.route(path) decorator.

  • HTTP Request Handling: Create handler functions for each route to process and respond to incoming HTTP requests.

  • Development Server: Start a development server with a single command, making it easy to test your application locally.

  • Basic Error Handling: Includes a default 404 response for routes that are not found.

Installation

To get started with PyKite, follow these steps:

pip install pykite

Run the application

  1. Create a Python script for your web application using PyKite. Define routes and handlers as needed.
  2. Run your application using the run method:
from pykite import PyKite
from pykite.http.response import Response

# Create a PyKite application
app = PyKite(debug=True)


# Define a route for the '/' path
@app.route('/')
def index(request, response):
    """Respond with a JSON object containing the message "Hello, World!" to all requests to the '/' path."""
    data = {"message": "Hello, World!"}
    response = Response(data=data, status=200)
    return response


@app.route('/hello/{name}')
def hello(request, response, name):
    """ Took a name from the URL and responds with a friendly greeting in JSON."""
    data = {"message": f"Hello, {name}"}
    response = Response(data=data, status=200)
    return response


# Run the application
if __name__ == "__main__":
    app.run()
  1. Access your application in a web browser at http://localhost:8000.

License

This project is licensed under the MIT License.

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

pykite-1.0.0.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

pykite-1.0.0-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file pykite-1.0.0.tar.gz.

File metadata

  • Download URL: pykite-1.0.0.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for pykite-1.0.0.tar.gz
Algorithm Hash digest
SHA256 6cd919077384b13ba9a9326c4347e60552f39540a70a90e53d0ceafaa975e42c
MD5 611669314d0715f0b9be9215cf2a4a95
BLAKE2b-256 92cbb5e415ed6541e83d0841b034eb7d3d82064370f1baca5f7b2054fc1a145f

See more details on using hashes here.

File details

Details for the file pykite-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pykite-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for pykite-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a421b7c7527ce91de8faca87d4e93d68286d76e0d9eb1f374d64a46c8f327178
MD5 c7b1ce67303370db9fa4d4bb46c93737
BLAKE2b-256 35bf562e0bf9c46674da903ebb3c8ed5cfd5053c555e6b6af938fdbe6c33aa40

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page