webdev 2.0.0__tar.gz → 2.0.1__tar.gz

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.
Files changed (27) hide show
  1. {webdev-2.0.0 → webdev-2.0.1}/.gitignore +1 -0
  2. {webdev-2.0.0 → webdev-2.0.1}/PKG-INFO +79 -50
  3. {webdev-2.0.0 → webdev-2.0.1}/README.rst +78 -49
  4. {webdev-2.0.0 → webdev-2.0.1}/webdev/__init__.py +1 -1
  5. {webdev-2.0.0 → webdev-2.0.1}/LICENSE +0 -0
  6. {webdev-2.0.0 → webdev-2.0.1}/pyproject.toml +0 -0
  7. {webdev-2.0.0 → webdev-2.0.1}/tests/conftest.py +0 -0
  8. {webdev-2.0.0 → webdev-2.0.1}/tests/test_config.py +0 -0
  9. {webdev-2.0.0 → webdev-2.0.1}/tests/test_index.py +0 -0
  10. {webdev-2.0.0 → webdev-2.0.1}/tests/test_livereload.py +0 -0
  11. {webdev-2.0.0 → webdev-2.0.1}/tests/test_net.py +0 -0
  12. {webdev-2.0.0 → webdev-2.0.1}/tests/test_server.py +0 -0
  13. {webdev-2.0.0 → webdev-2.0.1}/tests/test_static.py +0 -0
  14. {webdev-2.0.0 → webdev-2.0.1}/webdev/__main__.py +0 -0
  15. {webdev-2.0.0 → webdev-2.0.1}/webdev/cli.py +0 -0
  16. {webdev-2.0.0 → webdev-2.0.1}/webdev/config.py +0 -0
  17. {webdev-2.0.0 → webdev-2.0.1}/webdev/index.py +0 -0
  18. {webdev-2.0.0 → webdev-2.0.1}/webdev/livereload.py +0 -0
  19. {webdev-2.0.0 → webdev-2.0.1}/webdev/net.py +0 -0
  20. {webdev-2.0.0 → webdev-2.0.1}/webdev/run.py +0 -0
  21. {webdev-2.0.0 → webdev-2.0.1}/webdev/server.py +0 -0
  22. {webdev-2.0.0 → webdev-2.0.1}/webdev/static.py +0 -0
  23. {webdev-2.0.0 → webdev-2.0.1}/webdev/templates/dark/base.html.jinja2 +0 -0
  24. {webdev-2.0.0 → webdev-2.0.1}/webdev/templates/dark/index.html.jinja2 +0 -0
  25. {webdev-2.0.0 → webdev-2.0.1}/webdev/templates/dark/partials/sort.js.jinja2 +0 -0
  26. {webdev-2.0.0 → webdev-2.0.1}/webdev/templates/dark/partials/styles.css.jinja2 +0 -0
  27. {webdev-2.0.0 → webdev-2.0.1}/webdev/tls.py +0 -0
@@ -13,6 +13,7 @@ build/*
13
13
  .pytest_cache/
14
14
  .mypy_cache/
15
15
  .ruff_cache/
16
+ uv.lock
16
17
 
17
18
  # Misc
18
19
  *~
@@ -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.
@@ -2,49 +2,74 @@
2
2
  Development Web Server
3
3
  ======================
4
4
 
5
- About
6
- =====
7
-
8
- ``webdev`` is a small, fast development web server. It serves any local
9
- directory over HTTP (or HTTPS) with developer-friendly conveniences, and ships
10
- a modern, dark-themed directory index.
5
+ ``webdev`` is a **small, fast local development web server**. Point it at a
6
+ folder and it serves it over HTTP (or HTTPS) with developer-friendly
7
+ conveniences and a modern, dark-themed directory index.
11
8
 
12
9
  It is built on `Starlette <https://www.starlette.io/>`_ and
13
- `Uvicorn <https://www.uvicorn.org/>`_ (an ASGI stack), and requires Python 3.10+.
10
+ `Uvicorn <https://www.uvicorn.org/>`_ (an async ASGI stack) and requires
11
+ **Python 3.10+**.
14
12
 
15
- Features
16
- ========
13
+ Quick start
14
+ ===========
17
15
 
18
- - **Serve any directory** — passed as the first positional argument; defaults to
19
- the current directory.
20
- - **Graceful when the folder disappears** — responds with ``404`` instead of
21
- crashing if the served directory is removed, and **recovers automatically**
22
- the moment it is recreated. Paths are resolved against the live filesystem on
23
- every request, which is great with build systems that perform clean/rebuild
24
- actions.
25
- - **Automatic port selection** — if the base port is busy, the next free port in
26
- a range is used. Can be forced to a single port.
27
- - **Serve a not-yet-existing folder** — ``--future`` assumes the folder will be
28
- created later.
29
- - **Modern dark directory index** — breadcrumbs, file-type icons, human-readable
30
- sizes, modified dates and client-side sortable columns. Themable: drop a new
31
- directory under ``webdev/templates/<theme>/``.
32
- - **Live reload** — connected browsers refresh automatically on file changes
33
- (via a WebSocket; a tiny auto-reconnecting snippet is injected into HTML).
34
- - **No-cache headers** for always-fresh development content.
35
- - **SPA fallback** — optionally serve ``index.html`` for unknown routes.
36
- - **Gzip**, **CORS**, optional **HTTPS** (self-signed if no cert/key is given),
37
- and a startup **QR code / LAN URL** for quick mobile testing.
38
- - **Config file** — every option can be set via ``webdev.toml`` (or a
39
- ``[tool.webdev]`` table). Precedence: CLI flag > config file > default.
16
+ ::
17
+
18
+ # Install (see more options below)
19
+ uv tool install webdev
20
+
21
+ # Serve the current directory on http://localhost:8080
22
+ webdev
23
+
24
+ # Serve a specific folder
25
+ webdev ./public
26
+
27
+ # See every option
28
+ webdev --help
40
29
 
41
30
  Installation
42
31
  ============
43
32
 
44
- ::
33
+ With `uv <https://docs.astral.sh/uv/>`_ (recommended)::
34
+
35
+ uv tool install webdev
36
+
37
+ With `pipx <https://pipx.pypa.io/>`_::
38
+
39
+ pipx install webdev
40
+
41
+ Or with plain ``pip`` into an environment of your choice::
45
42
 
46
43
  pip install webdev
47
44
 
45
+ Features
46
+ ========
47
+
48
+ - 🗂️ **Serve any directory** — passed as the first positional argument; defaults
49
+ to 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 — ideal for build systems that clean and rebuild output.
54
+ - 🔀 **Automatic port selection** — if the base port is busy, the next free port
55
+ in a range is used. Can be forced to a single exact port.
56
+ - 🔮 **Serve a not-yet-existing folder** — ``--future`` assumes the folder will
57
+ be created later.
58
+ - 🎨 **Modern dark directory index** — breadcrumbs, file-type icons,
59
+ human-readable sizes, modified dates and client-side sortable columns.
60
+ **Themable**: drop a new directory under ``webdev/templates/<theme>/``.
61
+ - 🔁 **Live reload** — connected browsers refresh automatically on file changes
62
+ (via a WebSocket; a tiny auto-reconnecting snippet is injected into HTML).
63
+ - 📱 **Instant mobile testing** — a **QR code and LAN URL** are printed at
64
+ startup so you can open the site on your phone.
65
+ - 🌈 **Colorized, level-aware logs** for readable output.
66
+ - ⚡ **No-cache headers** for always-fresh development content.
67
+ - 🧭 **SPA fallback** — optionally serve ``index.html`` for unknown routes.
68
+ - 📦 **Gzip**, **CORS** and optional **HTTPS** (self-signed if no cert/key is
69
+ given).
70
+ - ⚙️ **Config file** — every option can be set via ``webdev.toml`` (or a
71
+ ``[tool.webdev]`` table). Precedence: CLI flag > config file > default.
72
+
48
73
  Usage
49
74
  =====
50
75
 
@@ -70,6 +95,9 @@ Examples::
70
95
  # Single-page app: fall back to index.html for client-side routes
71
96
  webdev --spa ./dist
72
97
 
98
+ # Serve a build output folder that does not exist yet
99
+ webdev --future ./dist
100
+
73
101
  Options and config keys
74
102
  -----------------------
75
103
 
@@ -95,30 +123,19 @@ Colorized logs ``--color/--no-color`` ``color`` enabled
95
123
  HTTPS/TLS ``--https/--no-https`` ``https`` disabled
96
124
  TLS cert / key ``--cert`` / ``--key`` ``cert`` / ``key`` self-signed
97
125
  Index theme ``--theme`` ``theme`` dark
126
+ Verbosity ``-v`` (repeatable) ``verbose`` 0
98
127
  ===================== ======================== ================== ==========
99
128
 
100
- Example ``webdev.toml``::
129
+ Commit a ``webdev.toml`` next to your project to share settings with your team.
130
+ Any option works as a flat key, or under a ``[tool.webdev]`` table (handy inside
131
+ a ``pyproject.toml``)::
101
132
 
133
+ # webdev.toml
102
134
  port = 3000
103
135
  force_port = true
104
136
  spa = true
105
137
  cors = true
106
138
 
107
- Design notes
108
- ============
109
-
110
- - **Framework:** Starlette + Uvicorn was chosen over a full framework such as
111
- Sanic because this is a static file server: Starlette provides exactly the
112
- primitives needed (routing, static serving, WebSockets, middleware) with a
113
- small surface, and Uvicorn handles fast binding, HTTP keep-alive, HTTPS and
114
- graceful shutdown.
115
- - **The legacy reload hack is gone.** The old server patched ``send_head`` to
116
- ``chdir`` back into the served folder; modern ``http.server`` captures the
117
- working directory in the handler constructor, so that hook stopped running and
118
- a removed folder crashed the request. ``webdev`` now resolves every request
119
- against the live filesystem, so missing folders yield a real ``404`` and
120
- recover automatically.
121
-
122
139
  Development
123
140
  ===========
124
141
 
@@ -135,12 +152,23 @@ only tool you need preinstalled::
135
152
  # Build and verify the distribution
136
153
  tox -e build
137
154
 
155
+ # Build, install in a throwaway venv and run (pass args after --)
156
+ tox -e run -- -p 3000 ./public
157
+
138
158
  Each environment declares its own tooling dependencies in ``tox.ini`` so it
139
159
  installs only what it needs.
140
160
 
141
161
  Changelog
142
162
  =========
143
163
 
164
+ 2.0.1
165
+ -----
166
+
167
+ **Changed**
168
+
169
+ - Modernized and expanded the README (uv-first installation, refreshed feature
170
+ overview and usage).
171
+
144
172
  2.0.0
145
173
  -----
146
174
 
@@ -194,7 +222,8 @@ License
194
222
 
195
223
  ::
196
224
 
197
- Copyright (C) 2015-2026 Carlos Jenkins <carlos@jenkins.co.cr>
225
+ Copyright (C) 2026 KuraLabs S.R.L <info@kuralabs.io>
226
+ Copyright (C) 2015-2016 Carlos Jenkins <carlos@jenkins.co.cr>
198
227
 
199
228
  Licensed under the Apache License, Version 2.0 (the "License");
200
229
  you may not use this file except in compliance with the License.
@@ -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__']
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes