Common utilities and handler code for Python web apps
Project description
webutil

Common utilities and handler code for Python web apps.
- Install with
pip install webutil - Supports Python 3.9+
- Documentation
webutil is dedicated to the public domain. You may also use it under the CC0 public domain dedication.
Contents
flask_util: Flask decorators and handlers for caching, exception handling, regular expression URL routing, domain-wide redirects, rate limiting, headers, and serving XRD and JRD templates.logs: Flask request handler that collects full trace logs from Google Cloud Logging, formats them nicely, and serves themmodels: minor utility Model classes for the Google Cloud Datastore ndb librarytestutil: misc utilities and helpers for unittest, requests, and urllibutil: wide variety of utilities for data structures, web code, etc.webmention: Webmention endpoint discovery and sending
Changelog
2.0 - 2026-06-29
appengine_info:- Add Cloud Run support.
flask_util:- Add
block, abefore_requesthandler that blocks requests by client IP CIDR and/orUser-Agent.
- Add
models:- Add new
WriteOnce,WriteOnceBlobPropertyndb property classes. (Moved here from arroba.) - Add support for
$ENCRYPTED_PROPERTY_KEYenvironment variable.
- Add new
testutil:- Add new
@head_returns_200decorator. - Drop
moxfromTestCase. - Add new
unittest.mockandrequestshelpers toTestCase.
- Add new
util:requests_*: add newlog_databoolean kwarg.
1.0 - 2026-05-27
Initial PyPI release. Moved out of oauth-dropins, where it's been maintained for the last 10+ years, into its own dedicated package, pywebutil.
Release instructions
Here's how to package, test, and ship a new release.
- Pull from remote to make sure we're at head.
git checkout main git pull
- Run the unit tests.
source local/bin/activate.csh gcloud emulators firestore start --host-port=:8089 --database-mode=datastore-mode < /dev/null >& /dev/null & python -m unittest discover
- Bump the version number in
pyproject.tomlanddocs/conf.py.git grepthe old version number to make sure it only appears in the changelog. Change the current changelog entry inREADME.mdfor this new version from unreleased to the current date. - Build the docs. If you added any new modules, add them to the appropriate file(s) in
docs/source/. Then run./docs/build.sh. -
setenv ver X.Y git commit -am "release v$ver"
- Upload to test.pypi.org for testing.
uv build twine upload -r pypitest dist/pywebutil-$ver.tar.gz
- Install from test.pypi.org.
cd /tmp python -m venv local source local/bin/activate.csh pip install --upgrade pip pip install -i https://test.pypi.org/simple --extra-index-url https://pypi.org/simple pywebutil
- Smoke test that the code trivially loads and runs.
python # run test code belowTest code to paste into the interpreter:from webutil import util util.__file__ util.UrlCanonicalizer()('http://asdf.com') # should print 'https://asdf.com/' exit()
- Tag the release in git. In the tag message editor, delete the generated comments at bottom, leave the first line blank (to omit the release "title" in github), put
### Notable changeson the second line, then copy and paste this version's changelog contents below it.git tag -a v$ver --cleanup=verbatim git push git push --tags
- Click here to draft a new release on GitHub. Enter
vX.Yin the Tag version box. Leave Release title empty. Copy### Notable changesand the changelog contents into the description text box. - Upload to pypi.org!
twine upload dist/pywebutil-$ver.tar.gz
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pywebutil-2.0.tar.gz.
File metadata
- Download URL: pywebutil-2.0.tar.gz
- Upload date:
- Size: 60.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b7297335822d6a41c0de933d4855608466f352d1396a9a2f495acf67cb390e2
|
|
| MD5 |
49313d93174380da04fd0fcd9243d204
|
|
| BLAKE2b-256 |
ac130dee7c762ab44a8e895edfd0b6ada6b946730d687b44d78272791c62e5ee
|
File details
Details for the file pywebutil-2.0-py3-none-any.whl.
File metadata
- Download URL: pywebutil-2.0-py3-none-any.whl
- Upload date:
- Size: 59.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85244d2e35ec48166ea1094908d1ea15928a83347c937fd2d66b76206cd568d8
|
|
| MD5 |
52ce2650c07d67b347066ffed8c33306
|
|
| BLAKE2b-256 |
2ad27cf8e2ff2978e7bbb9e877fce45a6d99a9f39636d307604956344c9d9f06
|