{"id":28466,"library":"wptserve","title":"wptserve","description":"wptserve is a Python web server designed for web browser testing, typically used within the web-platform-tests (WPT) framework. Version 4.0.3 is current. It provides a lightweight HTTP server with support for various protocols and features like piping, subdomains, and SSL. Releases are infrequent, tied to WPT updates.","status":"active","version":"4.0.3","language":"python","source_language":"en","source_url":"https://github.com/web-platform-tests/wpt/tree/master/tools/wptserve","tags":["testing","web","server","browser","wpt"],"install":[{"cmd":"pip install wptserve","lang":"bash","label":"Latest from PyPI"}],"dependencies":[{"reason":"Used for Python 2/3 compatibility (older versions)","package":"six","optional":true}],"imports":[{"note":"WebTestHttpd is in the server submodule, not top-level.","wrong":"from wptserve import WebTestHttpd","symbol":"wptserve.server.WebTestHttpd","correct":"from wptserve.server import WebTestHttpd"}],"quickstart":{"code":"from wptserve.server import WebTestHttpd\nimport os\n\nserver = WebTestHttpd(\n    host='localhost',\n    port=8000,\n    doc_root='/path/to/static/files',\n    key_file=os.environ.get('SSL_KEY_FILE', ''),\n    cert_file=os.environ.get('SSL_CERT_FILE', '')\n)\nserver.start()\nprint(f\"Server running at http://{server.host}:{server.port}\")\ninput(\"Press Enter to stop...\")\nserver.stop()","lang":"python","description":"Starts a simple HTTP server serving static files."},"warnings":[{"fix":"Upgrade to Python 3.6 or later.","message":"Python 2 support dropped in wptserve 4.0.0. Python 3.6+ required.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"If you need the WPT-integrated server, use WPT's repository directly (pip install web-platform-tests).","message":"The 'wptserve' package on PyPI is unrelated to the 'wptserve' subpackage within wpt's tools/ serve module. Installing from PyPI gives a standalone server, not the WPT-integrated version.","severity":"breaking","affected_versions":"all"},{"fix":"Use os.path.abspath() to convert relative paths.","message":"WebTestHttpd does not automatically resolve relative paths for doc_root; it must be an absolute path.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Use 'from wptserve.server import WebTestHttpd'.","cause":"Attempting to import WebTestHttpd from top-level wptserve instead of wptserve.server.","error":"ImportError: cannot import name 'WebTestHttpd' from 'wptserve'"},{"fix":"Specify a different port or kill the process using the port.","cause":"Port specified is already in use by another process.","error":"OSError: [Errno 98] Address already in use"},{"fix":"Ensure the requested file exists within the doc_root directory.","cause":"The requested path does not exist or is outside the document root.","error":"wptserve.handlers.InvalidPathException"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}