webdev 2.0.0__py3-none-any.whl → 2.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
webdev/__init__.py CHANGED
@@ -25,6 +25,6 @@ index, optional HTTPS, and more.
25
25
 
26
26
  from __future__ import annotations
27
27
 
28
- __version__ = '2.0.0'
28
+ __version__ = '2.0.1'
29
29
 
30
30
  __all__ = ['__version__']
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: webdev
3
- Version: 2.0.0
3
+ Version: 2.0.1
4
4
  Summary: Small, fast development web server with a modern dark directory index
5
5
  Project-URL: Homepage, https://github.com/kuralabs/webdev
6
6
  Project-URL: Repository, https://github.com/kuralabs/webdev
@@ -32,49 +32,74 @@ Description-Content-Type: text/x-rst
32
32
  Development Web Server
33
33
  ======================
34
34
 
35
- About
36
- =====
37
-
38
- ``webdev`` is a small, fast development web server. It serves any local
39
- directory over HTTP (or HTTPS) with developer-friendly conveniences, and ships
40
- a modern, dark-themed directory index.
35
+ ``webdev`` is a **small, fast local development web server**. Point it at a
36
+ folder and it serves it over HTTP (or HTTPS) with developer-friendly
37
+ conveniences and a modern, dark-themed directory index.
41
38
 
42
39
  It is built on `Starlette <https://www.starlette.io/>`_ and
43
- `Uvicorn <https://www.uvicorn.org/>`_ (an ASGI stack), and requires Python 3.10+.
40
+ `Uvicorn <https://www.uvicorn.org/>`_ (an async ASGI stack) and requires
41
+ **Python 3.10+**.
44
42
 
45
- Features
46
- ========
43
+ Quick start
44
+ ===========
47
45
 
48
- - **Serve any directory** — passed as the first positional argument; defaults to
49
- the current directory.
50
- - **Graceful when the folder disappears** — responds with ``404`` instead of
51
- crashing if the served directory is removed, and **recovers automatically**
52
- the moment it is recreated. Paths are resolved against the live filesystem on
53
- every request, which is great with build systems that perform clean/rebuild
54
- actions.
55
- - **Automatic port selection** — if the base port is busy, the next free port in
56
- a range is used. Can be forced to a single port.
57
- - **Serve a not-yet-existing folder** — ``--future`` assumes the folder will be
58
- created later.
59
- - **Modern dark directory index** — breadcrumbs, file-type icons, human-readable
60
- sizes, modified dates and client-side sortable columns. Themable: drop a new
61
- directory under ``webdev/templates/<theme>/``.
62
- - **Live reload** — connected browsers refresh automatically on file changes
63
- (via a WebSocket; a tiny auto-reconnecting snippet is injected into HTML).
64
- - **No-cache headers** for always-fresh development content.
65
- - **SPA fallback** — optionally serve ``index.html`` for unknown routes.
66
- - **Gzip**, **CORS**, optional **HTTPS** (self-signed if no cert/key is given),
67
- and a startup **QR code / LAN URL** for quick mobile testing.
68
- - **Config file** — every option can be set via ``webdev.toml`` (or a
69
- ``[tool.webdev]`` table). Precedence: CLI flag > config file > default.
46
+ ::
47
+
48
+ # Install (see more options below)
49
+ uv tool install webdev
50
+
51
+ # Serve the current directory on http://localhost:8080
52
+ webdev
53
+
54
+ # Serve a specific folder
55
+ webdev ./public
56
+
57
+ # See every option
58
+ webdev --help
70
59
 
71
60
  Installation
72
61
  ============
73
62
 
74
- ::
63
+ With `uv <https://docs.astral.sh/uv/>`_ (recommended)::
64
+
65
+ uv tool install webdev
66
+
67
+ With `pipx <https://pipx.pypa.io/>`_::
68
+
69
+ pipx install webdev
70
+
71
+ Or with plain ``pip`` into an environment of your choice::
75
72
 
76
73
  pip install webdev
77
74
 
75
+ Features
76
+ ========
77
+
78
+ - 🗂️ **Serve any directory** — passed as the first positional argument; defaults
79
+ to the current directory.
80
+ - 🩹 **Graceful when the folder disappears** — responds with ``404`` instead of
81
+ crashing if the served directory is removed, and **recovers automatically**
82
+ the moment it is recreated. Paths are resolved against the live filesystem on
83
+ every request — ideal for build systems that clean and rebuild output.
84
+ - 🔀 **Automatic port selection** — if the base port is busy, the next free port
85
+ in a range is used. Can be forced to a single exact port.
86
+ - 🔮 **Serve a not-yet-existing folder** — ``--future`` assumes the folder will
87
+ be created later.
88
+ - 🎨 **Modern dark directory index** — breadcrumbs, file-type icons,
89
+ human-readable sizes, modified dates and client-side sortable columns.
90
+ **Themable**: drop a new directory under ``webdev/templates/<theme>/``.
91
+ - 🔁 **Live reload** — connected browsers refresh automatically on file changes
92
+ (via a WebSocket; a tiny auto-reconnecting snippet is injected into HTML).
93
+ - 📱 **Instant mobile testing** — a **QR code and LAN URL** are printed at
94
+ startup so you can open the site on your phone.
95
+ - 🌈 **Colorized, level-aware logs** for readable output.
96
+ - ⚡ **No-cache headers** for always-fresh development content.
97
+ - 🧭 **SPA fallback** — optionally serve ``index.html`` for unknown routes.
98
+ - 📦 **Gzip**, **CORS** and optional **HTTPS** (self-signed if no cert/key is
99
+ given).
100
+ - ⚙️ **Config file** — every option can be set via ``webdev.toml`` (or a
101
+ ``[tool.webdev]`` table). Precedence: CLI flag > config file > default.
102
+
78
103
  Usage
79
104
  =====
80
105
 
@@ -100,6 +125,9 @@ Examples::
100
125
  # Single-page app: fall back to index.html for client-side routes
101
126
  webdev --spa ./dist
102
127
 
128
+ # Serve a build output folder that does not exist yet
129
+ webdev --future ./dist
130
+
103
131
  Options and config keys
104
132
  -----------------------
105
133
 
@@ -125,30 +153,19 @@ Colorized logs ``--color/--no-color`` ``color`` enabled
125
153
  HTTPS/TLS ``--https/--no-https`` ``https`` disabled
126
154
  TLS cert / key ``--cert`` / ``--key`` ``cert`` / ``key`` self-signed
127
155
  Index theme ``--theme`` ``theme`` dark
156
+ Verbosity ``-v`` (repeatable) ``verbose`` 0
128
157
  ===================== ======================== ================== ==========
129
158
 
130
- Example ``webdev.toml``::
159
+ Commit a ``webdev.toml`` next to your project to share settings with your team.
160
+ Any option works as a flat key, or under a ``[tool.webdev]`` table (handy inside
161
+ a ``pyproject.toml``)::
131
162
 
163
+ # webdev.toml
132
164
  port = 3000
133
165
  force_port = true
134
166
  spa = true
135
167
  cors = true
136
168
 
137
- Design notes
138
- ============
139
-
140
- - **Framework:** Starlette + Uvicorn was chosen over a full framework such as
141
- Sanic because this is a static file server: Starlette provides exactly the
142
- primitives needed (routing, static serving, WebSockets, middleware) with a
143
- small surface, and Uvicorn handles fast binding, HTTP keep-alive, HTTPS and
144
- graceful shutdown.
145
- - **The legacy reload hack is gone.** The old server patched ``send_head`` to
146
- ``chdir`` back into the served folder; modern ``http.server`` captures the
147
- working directory in the handler constructor, so that hook stopped running and
148
- a removed folder crashed the request. ``webdev`` now resolves every request
149
- against the live filesystem, so missing folders yield a real ``404`` and
150
- recover automatically.
151
-
152
169
  Development
153
170
  ===========
154
171
 
@@ -165,12 +182,23 @@ only tool you need preinstalled::
165
182
  # Build and verify the distribution
166
183
  tox -e build
167
184
 
185
+ # Build, install in a throwaway venv and run (pass args after --)
186
+ tox -e run -- -p 3000 ./public
187
+
168
188
  Each environment declares its own tooling dependencies in ``tox.ini`` so it
169
189
  installs only what it needs.
170
190
 
171
191
  Changelog
172
192
  =========
173
193
 
194
+ 2.0.1
195
+ -----
196
+
197
+ **Changed**
198
+
199
+ - Modernized and expanded the README (uv-first installation, refreshed feature
200
+ overview and usage).
201
+
174
202
  2.0.0
175
203
  -----
176
204
 
@@ -224,7 +252,8 @@ License
224
252
 
225
253
  ::
226
254
 
227
- Copyright (C) 2015-2026 Carlos Jenkins <carlos@jenkins.co.cr>
255
+ Copyright (C) 2026 KuraLabs S.R.L <info@kuralabs.io>
256
+ Copyright (C) 2015-2016 Carlos Jenkins <carlos@jenkins.co.cr>
228
257
 
229
258
  Licensed under the Apache License, Version 2.0 (the "License");
230
259
  you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- webdev/__init__.py,sha256=OkpQaCR6ZuY8wFMFvnDBeaRAXPX_rWu4aqlbRkxoi_U,1064
1
+ webdev/__init__.py,sha256=n08hqhrh_EeQtu2tqHLtS0gfZjAh6DwKZrx2kBECBh4,1064
2
2
  webdev/__main__.py,sha256=RhmDml_ICjjb3Ny0LDjH2HaIN2X0jGtzjwXBqPvsbwA,945
3
3
  webdev/cli.py,sha256=GtZejOzYo8F5R1e8Hw8M3hoAcVHOEZbiFJcTJloFbM4,10504
4
4
  webdev/config.py,sha256=4n4GnJHGCNBUV6Jsg4uEH9KGQJxr-CO9UkqkjHVEra4,6537
@@ -13,8 +13,8 @@ webdev/templates/dark/base.html.jinja2,sha256=GQ3V1ViLMxqLcY6J4pTHBp3z6acAltSscQ
13
13
  webdev/templates/dark/index.html.jinja2,sha256=Daq_Qq2_eU8tT7MYIT66ifAdCd_atJxdcUKWyR2jdbY,2369
14
14
  webdev/templates/dark/partials/sort.js.jinja2,sha256=UyZGARVjREPhp_ExgwuxvCO5xn8yz-1p0yinAeULcfU,1792
15
15
  webdev/templates/dark/partials/styles.css.jinja2,sha256=LbJsa_ocA0ynzJHkwnwyjdLICFVUgJ27oM6MLpTO_o4,2821
16
- webdev-2.0.0.dist-info/METADATA,sha256=wQWSQp2Mslk-uW4s7SzigbgB5oYEwXbrcgoeOKevCbE,8949
17
- webdev-2.0.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
18
- webdev-2.0.0.dist-info/entry_points.txt,sha256=578xTHeC_DyXogKwIi1QFsIFcRwApzz7odTdApHijvk,43
19
- webdev-2.0.0.dist-info/licenses/LICENSE,sha256=xllut76FgcGL5zbIRvuRc7aezPbvlMUTWJPsVr2Sugg,11358
20
- webdev-2.0.0.dist-info/RECORD,,
16
+ webdev-2.0.1.dist-info/METADATA,sha256=HdYbrqvf2H8aYSEEWCntUhf-jg-Mb07aEXh7-XgREi4,9439
17
+ webdev-2.0.1.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
18
+ webdev-2.0.1.dist-info/entry_points.txt,sha256=578xTHeC_DyXogKwIi1QFsIFcRwApzz7odTdApHijvk,43
19
+ webdev-2.0.1.dist-info/licenses/LICENSE,sha256=xllut76FgcGL5zbIRvuRc7aezPbvlMUTWJPsVr2Sugg,11358
20
+ webdev-2.0.1.dist-info/RECORD,,
File without changes