{"id":14972766,"url":"https://github.com/alisayyah/django-urlconfchecks","last_synced_at":"2025-04-05T13:07:22.886Z","repository":{"id":37939730,"uuid":"453021029","full_name":"AliSayyah/django-urlconfchecks","owner":"AliSayyah","description":"A package for type-checking the URLs and associated views for Django","archived":false,"fork":false,"pushed_at":"2025-03-31T20:52:45.000Z","size":2000,"stargazers_count":62,"open_issues_count":8,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-05T13:07:16.329Z","etag":null,"topics":["cli","developer-tools","django","django-application","pre-commit","pre-commit-hook","python","typechecker","typer"],"latest_commit_sha":null,"homepage":"https://alisayyah.github.io/django-urlconfchecks","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AliSayyah.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-28T10:10:45.000Z","updated_at":"2024-11-08T17:23:09.000Z","dependencies_parsed_at":"2022-08-08T22:30:46.401Z","dependency_job_id":"6b56a68f-caa3-42ad-8701-30e95af5c85e","html_url":"https://github.com/AliSayyah/django-urlconfchecks","commit_stats":{"total_commits":297,"total_committers":6,"mean_commits":49.5,"dds":"0.46464646464646464","last_synced_commit":"7f44ecd5aaa5a468482dbceffc22370b7cb37620"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AliSayyah%2Fdjango-urlconfchecks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AliSayyah%2Fdjango-urlconfchecks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AliSayyah%2Fdjango-urlconfchecks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AliSayyah%2Fdjango-urlconfchecks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AliSayyah","download_url":"https://codeload.github.com/AliSayyah/django-urlconfchecks/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247339158,"owners_count":20923014,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","developer-tools","django","django-application","pre-commit","pre-commit-hook","python","typechecker","typer"],"created_at":"2024-09-24T13:47:29.759Z","updated_at":"2025-04-05T13:07:22.869Z","avatar_url":"https://github.com/AliSayyah.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Django UrlConf Checks\n\n[![pypi](https://img.shields.io/pypi/v/django-urlconfchecks.svg)](https://pypi.org/project/django-urlconfchecks/)\n[![python](https://img.shields.io/pypi/pyversions/django-urlconfchecks.svg)](https://pypi.org/project/django-urlconfchecks/)\n[![Build Status](https://github.com/AliSayyah/django-urlconfchecks/actions/workflows/dev.yml/badge.svg)](https://github.com/AliSayyah/django-urlconfchecks/actions/workflows/dev.yml)\n[![codecov](https://codecov.io/gh/AliSayyah/django-urlconfchecks/branch/main/graphs/badge.svg)](https://codecov.io/github/AliSayyah/django-urlconfchecks)\n[![License](https://img.shields.io/github/license/AliSayyah/django-urlconfchecks.svg)](https://www.gnu.org/licenses/gpl-3.0.en.html)\n\ndjango-urlconfchecks is a static type checker that checks your URLconf parameter types with argument types specified in associated views.\nIt leverages the Django's static check system.\n\n* [Documentation](https://AliSayyah.github.io/django-urlconfchecks)\n* [GitHub](https://github.com/AliSayyah/django-urlconfchecks)\n* [PyPI](https://pypi.org/project/django-urlconfchecks/)\n\n## Installation\n\n    pip install django-urlconfchecks\n\nPython 3.8 or later is required. However, before Python 3.10 some checks\nrelating to `Optional` types in view signatures are skipped due to stdlib\nlimitations.\n\n## Usage\n\nYou can use this package in different ways:\n\n### As a Django app\n\nAdd `django_urlconfchecks` to your `INSTALLED_APPS` list in your `settings.py` file.\n\n```python\n    INSTALLED_APPS = [\n    ...\n    'django_urlconfchecks',\n]\n```\n\n### As a command line tool\n\nRun this command from the root of your project, were `manage.py` is located:\n\n```bash\n$ urlconfchecks --help\n\n    Usage: urlconfchecks [OPTIONS]\n\n      Check all URLConfs for errors.\n\n    Options:\n      --version\n      -u, --urlconf PATH    Specify the URLconf to check.\n      --install-completion  Install completion for the current shell.\n      --show-completion     Show completion for the current shell, to copy it or\n                            customize the installation.\n      --help                Show this message and exit.\n```\n\n### As a pre-commit hook\n\nAdd the following to your `.pre-commit-config.yaml` file:\n\n```yaml\n  - repo: https://github.com/AliSayyah/django-urlconfchecks\n    rev: v0.11.0\n    hooks:\n      - id: django-urlconfchecks\n```\n\nFor more information, see the [usage documentation](https://alisayyah.github.io/django-urlconfchecks/usage/).\n\n## Features\n\nUsing this package, URL pattern types will automatically be matched with associated views, and in case of mismatch, an\nerror will be raised.\n\nExample:\n\n```python\n# urls.py\nfrom django.urls import path\n\nfrom . import views\n\nurlpatterns = [\n    path('articles/\u003cstr:year\u003e/', views.year_archive),\n    path('articles/\u003cint:year\u003e/\u003cint:month\u003e/', views.month_archive),\n    path('articles/\u003cint:year\u003e/\u003cint:month\u003e/\u003cslug:slug\u003e/', views.article_detail),\n]\n```\n\n```python\n# views.py\n\ndef year_archive(request, year: int):\n    pass\n\n\ndef month_archive(request, year: int, month: int):\n    pass\n\n\ndef article_detail(request, year: int, month: int, slug: str):\n    pass\n```\n\noutput will be:\n\n```\n(urlchecker.E002) For parameter `year`, annotated type int does not match expected `str` from urlconf\n```\n\n* TODO:\n    - Handle type checking parameterized generics e.g. `typing.List[int]`, `list[str]` etc.\n    - Should only warn for each unhandled Converter once.\n    - Regex patterns perhaps? (only RoutePattern supported at the moment).\n\n## Credits\n\n- [Luke Plant](https://github.com/spookylukey) for providing the idea and the initial code.\n- This package was created with [Cookiecutter](https://github.com/audreyr/cookiecutter) and\n  the [waynerv/cookiecutter-pypackage](https://github.com/waynerv/cookiecutter-pypackage) project template.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falisayyah%2Fdjango-urlconfchecks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falisayyah%2Fdjango-urlconfchecks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falisayyah%2Fdjango-urlconfchecks/lists"}