mirror of
https://github.com/google/bumble.git
synced 2026-04-16 00:25:31 +00:00
refactor pyiodide support and add examples
This commit is contained in:
28
tasks.py
28
tasks.py
@@ -177,3 +177,31 @@ project_tasks.add_task(lint)
|
||||
project_tasks.add_task(format_code, name="format")
|
||||
project_tasks.add_task(check_types, name="check-types")
|
||||
project_tasks.add_task(pre_commit)
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Web
|
||||
# -----------------------------------------------------------------------------
|
||||
web_tasks = Collection()
|
||||
ns.add_collection(web_tasks, name="web")
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
@task
|
||||
def serve(ctx, port=8000):
|
||||
"""
|
||||
Run a simple HTTP server for the examples under the `web` directory.
|
||||
"""
|
||||
import http.server
|
||||
|
||||
address = ("", port)
|
||||
class Handler(http.server.SimpleHTTPRequestHandler):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, directory="web", **kwargs)
|
||||
server = http.server.HTTPServer(address, Handler)
|
||||
print(f"Now serving on port {port} 🕸️")
|
||||
server.serve_forever()
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
web_tasks.add_task(serve)
|
||||
|
||||
Reference in New Issue
Block a user