{"id":8745,"library":"types-waitress","title":"Typing Stubs for Waitress","description":"This is a type stub package for the `waitress` WSGI server, providing static type annotations for use with type checkers like MyPy and Pyright. It allows developers to leverage type checking for `waitress` without modifying its runtime code. The current version is 3.0.1.20260408 and it is released as part of the `typeshed` project, with updates for third-party stubs typically occurring up to once a day.","status":"active","version":"3.0.1.20260408","language":"python","source_language":"en","source_url":"https://github.com/python/typeshed","tags":["typing","stubs","waitress","typeshed","type-checking","mypy","pyright","wsgi-server"],"install":[{"cmd":"pip install types-waitress","lang":"bash","label":"Install the type stubs"},{"cmd":"pip install waitress","lang":"bash","label":"Install the runtime library (if not already installed)"}],"dependencies":[{"reason":"Provides the runtime functionality for which these stubs offer type hints. This `types-waitress` version aims to provide annotations for `waitress~=3.0.1`.","package":"waitress","optional":false},{"reason":"Minimum Python version required for the `types-waitress` package itself.","package":"python","version":">=3.10","optional":false}],"imports":[{"wrong":"from waitress-stubs import serve","symbol":"serve","correct":"from waitress_stubs import serve"}],"quickstart":{"code":"# app.py\nfrom wsgiref.simple_server import make_server\nfrom waitress import serve\nfrom typing import Callable, Iterable, Dict, Any\n\ndef simple_app(environ: Dict[str, Any], start_response: Callable) -> Iterable[bytes]:\n    \"\"\"A barebones WSGI application with type hints.\"\"\"\n    status = '200 OK'\n    headers = [('Content-type', 'text/plain; charset=utf-8')]\n    start_response(status, headers)\n    return [b\"Hello, Waitress with types!\"]\n\nif __name__ == '__main__':\n    print(\"Serving on http://127.0.0.1:8080\")\n    # Typical production deployment would use the command line:\n    # waitress-serve --host=127.0.0.1 --port=8080 app:simple_app\n    # For direct Python execution:\n    serve(simple_app, host='127.0.0.1', port=8080)\n\n# To type check this application:\n# 1. Ensure you have a type checker installed, e.g., pip install mypy\n# 2. Run the type checker from your terminal: mypy app.py","lang":"python","description":"This quickstart demonstrates a basic WSGI application that can be served by `waitress`. After installing `waitress` and `types-waitress`, a type checker like MyPy can validate the types used in the `simple_app` and `serve` call against the provided stubs, catching potential errors at development time. The example includes the recommended type hints for a WSGI application."},"warnings":[{"fix":"Regularly update both `waitress` and `types-waitress`. Pin `types-waitress` to match the major.minor version of `waitress` (e.g., if `waitress==3.0.x`, use `types-waitress==3.0.x.YYYYMMDD`).","message":"Type stub packages like `types-waitress` must be kept in sync with the runtime library (`waitress`) they annotate. If the `waitress` version updates significantly and `types-waitress` does not, type checking might produce false positives or miss actual errors.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Pin your type checker (e.g., `mypy==1.19.1`) along with your stub packages if strict type checking stability is critical. Consult the `typeshed` documentation for compatibility with specific type checker versions.","message":"Even minor changes within type stubs can sometimes lead to new type-checking errors, even if the underlying runtime code functions identically. This is because type checkers might become stricter or new type features are used in stubs that break compatibility with older type checker versions.","severity":"breaking","affected_versions":"All versions"},{"fix":"Always import symbols from the original runtime library (`waitress`). The type checker automatically finds and applies the type information from the installed `types-waitress` package.","message":"The naming convention `types-<library_name>` for stub-only packages from `typeshed` means you install `types-waitress` but still import from `waitress`. New users sometimes expect to import from the stub package directly.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'3.0.1.20260408':47 'allow':30 'annot':19 'check':35,78 'checker':24 'code':42 'current':44 'day':71 'develop':31 'leverag':33 'like':25 'modifi':39 'mypi':26,79 'occur':66 'packag':10 'part':53 'parti':63 'project':57 'provid':16 'pyright':28,80 'releas':51 'runtim':41 'server':15,83 'static':17 'stub':2,9,64,73 'third':62 'third-parti':61 'type':1,8,18,23,34,72,77 'type-check':76 'typesh':56,75 'typic':65 'updat':59 'use':21 'version':45 'waitress':4,13,37,74 'without':38 'wsgi':14,82 'wsgi-serv':81","created_at":"2026-04-16T17:03:47.590037+00:00","updated_at":"2026-04-16T17:03:47.590037+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\nModuleNotFoundError: No module named 'waitress_stubs'"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"3.0.1.20260508","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/typeshed-internal/stub_uploader","docs":null,"changelog":"https://github.com/typeshed-internal/stub_uploader/blob/main/data/changelogs/waitress.md","pypi":"https://pypi.org/project/types-waitress/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["type-stubs"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"import_fail","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-07-10","install_tag":null}}