Name | django-stubs-ext JSON |
Version |
5.2.2
JSON |
| download |
home_page | None |
Summary | Monkey-patching and extensions for django-stubs |
upload_time | 2025-07-17 08:34:35 |
maintainer | None |
docs_url | None |
author | Simula Proxy |
requires_python | >=3.10 |
license | None |
keywords |
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Extensions and monkey-patching for django-stubs
[](https://github.com/typeddjango/django-stubs/actions?query=workflow%3Atest)
[](http://mypy-lang.org/)
This package contains extensions and monkey-patching functions for the [django-stubs](https://github.com/typeddjango/django-stubs) package. Certain features of django-stubs (i.e. generic django classes that don't define the `__class_getitem__` method) require runtime monkey-patching, which can't be done with type stubs. These extensions were split into a separate package so library consumers don't need `mypy` as a runtime dependency ([#526](https://github.com/typeddjango/django-stubs/pull/526#pullrequestreview-525798031)).
## Installation
```bash
pip install django-stubs-ext
```
## Usage
In your Django application, use the following code:
```py
import django_stubs_ext
django_stubs_ext.monkeypatch()
```
This only needs to be called once, so the call to `monkeypatch` should be placed in your top-level settings.
Real-life example [can be found here](https://github.com/wemake-services/wemake-django-template/blob/5bf1569e2710e11befc6991893f94419136d74bd/%7B%7Bcookiecutter.project_name%7D%7D/server/settings/__init__.py#L14-L19).
## Version compatibility
Since django-stubs supports multiple Django versions, this package takes care to only monkey-patch the features needed by your django version, and decides which features to patch at runtime. This is completely safe, as (currently) we only add a `__class_getitem__` method that does nothing:
```py
@classmethod
def __class_getitem__(cls, *args, **kwargs):
return cls
```
## To get help
For help with django-stubs, please view the main repository at <https://github.com/typeddjango/django-stubs>
## Contributing
The django-stubs-ext package is part of the [django-stubs](https://github.com/typeddjango/django-stubs) monorepo. If you would like to contribute, please view the django-stubs [contribution guide](https://github.com/typeddjango/django-stubs/blob/master/CONTRIBUTING.md).
You can always also reach out in gitter to discuss your contributions!
Raw data
{
"_id": null,
"home_page": null,
"name": "django-stubs-ext",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "Marti Raudsepp <marti@juffo.org>, Nikita Sobolev <mail@sobolevn.me>, Petter Friberg <petter_friberg@hotmail.com>, Adam Johnson <me@adamj.eu>",
"keywords": null,
"author": "Simula Proxy",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/fc/06/5e94715d103e6cc72380cb0d0b6682a7d5ad2c366cee478c94d77aad777d/django_stubs_ext-5.2.2.tar.gz",
"platform": null,
"description": "# Extensions and monkey-patching for django-stubs\n\n[](https://github.com/typeddjango/django-stubs/actions?query=workflow%3Atest)\n[](http://mypy-lang.org/)\n\n\nThis package contains extensions and monkey-patching functions for the [django-stubs](https://github.com/typeddjango/django-stubs) package. Certain features of django-stubs (i.e. generic django classes that don't define the `__class_getitem__` method) require runtime monkey-patching, which can't be done with type stubs. These extensions were split into a separate package so library consumers don't need `mypy` as a runtime dependency ([#526](https://github.com/typeddjango/django-stubs/pull/526#pullrequestreview-525798031)).\n\n## Installation\n\n```bash\npip install django-stubs-ext\n```\n\n## Usage\n\nIn your Django application, use the following code:\n\n```py\nimport django_stubs_ext\n\ndjango_stubs_ext.monkeypatch()\n```\n\nThis only needs to be called once, so the call to `monkeypatch` should be placed in your top-level settings.\nReal-life example [can be found here](https://github.com/wemake-services/wemake-django-template/blob/5bf1569e2710e11befc6991893f94419136d74bd/%7B%7Bcookiecutter.project_name%7D%7D/server/settings/__init__.py#L14-L19).\n\n## Version compatibility\n\nSince django-stubs supports multiple Django versions, this package takes care to only monkey-patch the features needed by your django version, and decides which features to patch at runtime. This is completely safe, as (currently) we only add a `__class_getitem__` method that does nothing:\n\n```py\n@classmethod\ndef __class_getitem__(cls, *args, **kwargs):\n return cls\n```\n\n## To get help\n\nFor help with django-stubs, please view the main repository at <https://github.com/typeddjango/django-stubs>\n\n## Contributing\n\nThe django-stubs-ext package is part of the [django-stubs](https://github.com/typeddjango/django-stubs) monorepo. If you would like to contribute, please view the django-stubs [contribution guide](https://github.com/typeddjango/django-stubs/blob/master/CONTRIBUTING.md).\n\nYou can always also reach out in gitter to discuss your contributions!\n",
"bugtrack_url": null,
"license": null,
"summary": "Monkey-patching and extensions for django-stubs",
"version": "5.2.2",
"project_urls": {
"Funding": "https://github.com/sponsors/typeddjango",
"Homepage": "https://github.com/typeddjango/django-stubs",
"Release notes": "https://github.com/typeddjango/django-stubs/releases"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "4e382903676f97f7902ee31984a06756b0e8836e897f4b617e1a03be4a43eb4f",
"md5": "83a7d07765ab21dc722ffbc427ea0236",
"sha256": "8833bbe32405a2a0ce168d3f75a87168f61bd16939caf0e8bf173bccbd8a44c5"
},
"downloads": -1,
"filename": "django_stubs_ext-5.2.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "83a7d07765ab21dc722ffbc427ea0236",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 8816,
"upload_time": "2025-07-17T08:34:33",
"upload_time_iso_8601": "2025-07-17T08:34:33.715043Z",
"url": "https://files.pythonhosted.org/packages/4e/38/2903676f97f7902ee31984a06756b0e8836e897f4b617e1a03be4a43eb4f/django_stubs_ext-5.2.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "fc065e94715d103e6cc72380cb0d0b6682a7d5ad2c366cee478c94d77aad777d",
"md5": "6092e73bac81cf896678f51569b8e41e",
"sha256": "d9d151b919fe2438760f5bd938f03e1cb08c84d0651f9e5917f1313907e42683"
},
"downloads": -1,
"filename": "django_stubs_ext-5.2.2.tar.gz",
"has_sig": false,
"md5_digest": "6092e73bac81cf896678f51569b8e41e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 6244,
"upload_time": "2025-07-17T08:34:35",
"upload_time_iso_8601": "2025-07-17T08:34:35.054566Z",
"url": "https://files.pythonhosted.org/packages/fc/06/5e94715d103e6cc72380cb0d0b6682a7d5ad2c366cee478c94d77aad777d/django_stubs_ext-5.2.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-17 08:34:35",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sponsors",
"github_project": "typeddjango",
"github_not_found": true,
"lcname": "django-stubs-ext"
}