Skip to main content

Django UrlConf Checks

pypi python Build Status codecov License

a python package for type checking the urls and associated views

Installation

pip install django-urlconfchecks

Usage

Add django_urlconfchecks to your INSTALLED_APPS list in your settings.py file.

INSTALLED_APPS = [
    ...
    'django_urlconfchecks',
]

Features

Using this package, URL pattern types will automatically be matched with associated views, and in case of mismatch, an error will be raised.

Example:

# urls.py
from django.urls import path

from . import views

urlpatterns = [
    path('articles/<str:year>/', views.year_archive),
    path('articles/<int:year>/<int:month>/', views.month_archive),
    path('articles/<int:year>/<int:month>/<slug:slug>/', views.article_detail),
]
# views.py

def special_case(request):
    pass


def year_archive(request, year: int):
    pass


def month_archive(request, year: int, month: int):
    pass


def article_detail(request, year: int, month: int, slug: str):
    pass

output will be:

(urlchecker.E002) For parameter `year`, annotated type int does not match expected `str` from urlconf
  • TODO
    • Fine-grained methods for silencing checks.
    • Should only warn for each unhandled Converter once
    • Regex patterns perhaps? (only RoutePattern supported at the moment)

Credits

Metadata

Release files for django-urlconfchecks 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-urlconfchecks 0.4.0
File Size Uploaded
django-urlconfchecks-0.4.0.tar.gz 20.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-urlconfchecks 0.4.0
File Interpreter ABI Platform
django_urlconfchecks-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 37.9 kB

Release files / django-urlconfchecks-0.4.0.tar.gz

Download URL django-urlconfchecks-0.4.0.tar.gz
Size 20.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3d6813493fe78a28bcab8babea70ac9d41789f11ae6201507887fb7f310ddd7d
BLAKE2b-256 checksum
How to use checksums
85a84114939bd4de7522cde29f12fbc8cf2c8555ae6b668bb3d60d2b076ee304
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

Release files / django_urlconfchecks-0.4.0-py3-none-any.whl

Download URL django_urlconfchecks-0.4.0-py3-none-any.whl
Size 17.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5820f6b85ae6957b9be423a5f0de064d4816b8cba353f3895c51d27d6b9697a0
BLAKE2b-256 checksum
How to use checksums
91895c984932472fd63f5ce984f05bd1cc3aa7ff252d9e8ba0736624b3d174b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

Release history Release notifications | RSS feed

0.13.1

2 release files

0.13.0

2 release files

0.12.0

2 release files

0.11.0

2 release files

0.10.0

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

This release

0.4.0 This release

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page