Skip to main content

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.

Middleware

Middleware in web development refers to software components that sit between a web server and an application. They intercept requests and responses, allowing for additional processing or modification before they reach the application or client. Middleware can be used for tasks like authentication, authorization, logging, caching, and more. Let's see 👉 how to use middleware in PyKite framework.

License

This project is licensed under the MIT License.

Metadata

Release files for pykite 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pykite 1.0.1
File Size Uploaded
pykite-1.0.1.tar.gz 8.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pykite 1.0.1
File Interpreter ABI Platform
pykite-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 18.0 kB

Release files / pykite-1.0.1.tar.gz

Download URL pykite-1.0.1.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
322a96fd8214dea9a4fbc77d2196fabe594cd6349855666cd97766af1ad8cd8a
BLAKE2b-256 checksum
How to use checksums
2ca8287b463cb93676e79f3a9c51b0e3ac6e4c563a473d513c1e39a328821a22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.6

Release files / pykite-1.0.1-py3-none-any.whl

Download URL pykite-1.0.1-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
312c3f29033450fca39bea28a52276e2af6768ab0200b0408e16a11e6c1b908b
BLAKE2b-256 checksum
How to use checksums
69392f31288d698e0d1b2740a972a97b264d23df30397797772651831fca4bb6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.6

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page