{ "info": { "author": "Blake Williams", "author_email": "code@shabbyrobe.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.7" ], "description": "Experimental WSGI Types for Python\n==================================\n\nThis is an attempt to bring some type safety to WSGI applications using Python's new\ntyping features (TypedDicts, Protocols). It seems to work OK but it'll be full of gaps,\nholes, bugs, missteps, etc. I would not recommend depending on it.\n\nThis is implemented as a Python module, rather than MyPy stubs, as it represents a\nprotocol things can satisfy rather than a set of types for something concrete.\n\nThis package came together during an exploration documented here:\nhttps://github.com/python/mypy/issues/7654\n\nDefine a callable application as a class:\n\n.. code-block:: py\n\n class MyApplication(wsgitypes.Application[MyEnviron]):\n def __call__(\n self, \n environ: Environ,\n start_response: wsgitypes.StartResponse,\n ) -> wsgitypes.ResponseBody:\n my_header = environ.get(\"REQUEST_METHOD\", \"\")\n return []\n\nEnviron should be type-safe:\n\n.. code-block:: py\n\n class MyApplication(wsgitypes.Application):\n def __call__(self, environ: Environ, start_response: wsgitypes.StartResponse) -> wsgitypes.ResponseBody:\n environ[\"wsgi.input\"] # Good\n environ[\"wsgi.unpot\"] # BORK! MyPy will catch this.\n return []\n\nYou can define your own extensions to ``Environ`` using ``TypedDict`` inheritance,\nlike so:\n\n.. code-block:: py\n\n class MyEnviron(wsgitypes.Environ):\n HTTP_X_MY_HEADER: t.Optional[str]\n\n class MyApplication(wsgitypes.Application):\n def __call__(self, environ: wsgitypes.Environ, start_response: wsgitypes.StartResponse) -> wsgitypes.Response:\n environ = typing.cast(MyEnviron, environ)\n environ.get(\"HTTP_X_MY_HEADER\")\n return []\n\nNote that you need to use ``typing.cast`` to convert the incoming environ to your derived\nversion. An attempt was made to use a type param for Environ, but it wasn't viable:\nhttps://github.com/python/mypy/issues/7654\n\n\n\n", "description_content_type": "text/x-rst", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/shabbyrobe/wsgitypes", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "wsgitypes", "package_url": "https://pypi.org/project/wsgitypes/", "platform": "", "project_url": "https://pypi.org/project/wsgitypes/", "project_urls": { "Homepage": "https://github.com/shabbyrobe/wsgitypes" }, "release_url": "https://pypi.org/project/wsgitypes/0.0.4/", "requires_dist": [ "mypy (>=0.730)", "typing-extensions" ], "requires_python": ">=3.7", "summary": "MyPy types for WSGI", "version": "0.0.4" }, "last_serial": 5947978, "releases": { "0.0.3": [ { "comment_text": "", "digests": { "md5": "f16119e42d6f640dab03e9bfea7ea136", "sha256": "ab1708ca95a837d9d0105a9ba157c500399a436def43817de148a1c41c334baf" }, "downloads": -1, "filename": "wsgitypes-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "f16119e42d6f640dab03e9bfea7ea136", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7", "size": 5956, "upload_time": "2019-10-09T05:58:16", "url": "https://files.pythonhosted.org/packages/c3/a0/ea395836528ba6d866dd6c04a4e9e6e5745afc9104d5a843d059c79f3f35/wsgitypes-0.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f78c12d0386a227634f782369e36bea6", "sha256": "e90a83f3cf4ca1d809b33a904ca4ed42db9dfbb0630b24ec47be3f0dade85cd9" }, "downloads": -1, "filename": "wsgitypes-0.0.3.tar.gz", "has_sig": false, "md5_digest": "f78c12d0386a227634f782369e36bea6", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7", "size": 4898, "upload_time": "2019-10-09T05:58:18", "url": "https://files.pythonhosted.org/packages/4b/39/1c71457cbb2132c7d3fa553c8bf518cce18e2a8958087face196dbf49512/wsgitypes-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "e6114e7b169207cef21ce9fff81914b9", "sha256": "bfe9df03ec37056c5f3f9e8771ef67baf1d8b801792e6b55b1842e1dbb76d15e" }, "downloads": -1, "filename": "wsgitypes-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "e6114e7b169207cef21ce9fff81914b9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7", "size": 6118, "upload_time": "2019-10-09T06:06:04", "url": "https://files.pythonhosted.org/packages/8a/69/1e875743ccd1d7a084020c4fb4449fd38456be5e132cfe7b25c85fb22092/wsgitypes-0.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "789e8fb0592b212426f0f3e185afff0f", "sha256": "61d8594bb2ed254b03ae771caba95783c3f8d02911d36dc673e086d013ed2fef" }, "downloads": -1, "filename": "wsgitypes-0.0.4.tar.gz", "has_sig": false, "md5_digest": "789e8fb0592b212426f0f3e185afff0f", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7", "size": 4934, "upload_time": "2019-10-09T06:06:07", "url": "https://files.pythonhosted.org/packages/77/48/db5208fba0961b1cefa4cb95a656879a486e7a734b4db16122105aa50962/wsgitypes-0.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e6114e7b169207cef21ce9fff81914b9", "sha256": "bfe9df03ec37056c5f3f9e8771ef67baf1d8b801792e6b55b1842e1dbb76d15e" }, "downloads": -1, "filename": "wsgitypes-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "e6114e7b169207cef21ce9fff81914b9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7", "size": 6118, "upload_time": "2019-10-09T06:06:04", "url": "https://files.pythonhosted.org/packages/8a/69/1e875743ccd1d7a084020c4fb4449fd38456be5e132cfe7b25c85fb22092/wsgitypes-0.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "789e8fb0592b212426f0f3e185afff0f", "sha256": "61d8594bb2ed254b03ae771caba95783c3f8d02911d36dc673e086d013ed2fef" }, "downloads": -1, "filename": "wsgitypes-0.0.4.tar.gz", "has_sig": false, "md5_digest": "789e8fb0592b212426f0f3e185afff0f", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7", "size": 4934, "upload_time": "2019-10-09T06:06:07", "url": "https://files.pythonhosted.org/packages/77/48/db5208fba0961b1cefa4cb95a656879a486e7a734b4db16122105aa50962/wsgitypes-0.0.4.tar.gz" } ] }