Skip to main content

Common utilities and handler code for Python web apps

Project description

webutil Circle CI Coverage Status

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

Changelog

2.0 - 2026-06-29

  • appengine_info:
  • flask_util:
    • Add block, a before_request handler that blocks requests by client IP CIDR and/or User-Agent.
  • models:
    • Add new WriteOnce, WriteOnceBlobProperty ndb property classes. (Moved here from arroba.)
    • Add support for $ENCRYPTED_PROPERTY_KEY environment variable.
  • testutil:
    • Add new @head_returns_200 decorator.
    • Drop mox from TestCase.
    • Add new unittest.mock and requests helpers to TestCase.
  • util:
    • requests_*: add new log_data boolean 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.

  1. Pull from remote to make sure we're at head.
    git checkout main
    git pull
    
  2. 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
    
  3. Bump the version number in pyproject.toml and docs/conf.py. git grep the old version number to make sure it only appears in the changelog. Change the current changelog entry in README.md for this new version from unreleased to the current date.
  4. Build the docs. If you added any new modules, add them to the appropriate file(s) in docs/source/. Then run ./docs/build.sh.
  5. setenv ver X.Y
    git commit -am "release v$ver"
    
  6. Upload to test.pypi.org for testing.
    uv build
    twine upload -r pypitest dist/pywebutil-$ver.tar.gz
    
  7. 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
    
  8. Smoke test that the code trivially loads and runs.
    python
    # run test code below
    
    Test code to paste into the interpreter:
    from webutil import util
    util.__file__
    util.UrlCanonicalizer()('http://asdf.com')
    # should print 'https://asdf.com/'
    exit()
    
  9. 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 changes on 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
    
  10. Click here to draft a new release on GitHub. Enter vX.Y in the Tag version box. Leave Release title empty. Copy ### Notable changes and the changelog contents into the description text box.
  11. Upload to pypi.org!
    twine upload dist/pywebutil-$ver.tar.gz
    

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pywebutil-2.0.tar.gz (60.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pywebutil-2.0-py3-none-any.whl (59.7 kB view details)

Uploaded Python 3

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

Hashes for pywebutil-2.0.tar.gz
Algorithm Hash digest
SHA256 4b7297335822d6a41c0de933d4855608466f352d1396a9a2f495acf67cb390e2
MD5 49313d93174380da04fd0fcd9243d204
BLAKE2b-256 ac130dee7c762ab44a8e895edfd0b6ada6b946730d687b44d78272791c62e5ee

See more details on using hashes here.

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

Hashes for pywebutil-2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 85244d2e35ec48166ea1094908d1ea15928a83347c937fd2d66b76206cd568d8
MD5 52ce2650c07d67b347066ffed8c33306
BLAKE2b-256 2ad27cf8e2ff2978e7bbb9e877fce45a6d99a9f39636d307604956344c9d9f06

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page