Install & Compatibility
Where this runs
tested against v0.1.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 134.7MB
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 6.0s · import 0.000s · 133MB
134MB installed
● package 134MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
FilterSet
✓ from django_filters_stubs import FilterSet
✗ from django_filters_stubs import FilterSet
To use `django-filter-stubs`, simply install the package. Mypy will automatically discover and use the type stubs for `django-filter` and its submodules (like `django_filters.rest_framework`) during its static analysis pass. No explicit imports from `django_filter_stubs` are required. Ensure your Mypy configuration is set up correctly for Django projects, ideally using `django-stubs` if available, to handle Django's runtime 'magic'.
# mypy.ini or pyproject.toml
# For mypy.ini:
[mypy]
plugins = mypy_django_plugin.main # If using django-stubs
# For pyproject.toml:
[tool.mypy]
plugins = ["mypy_django_plugin.main"] # If using django-stubs
# In your Django project's Python code:
# This code would benefit from django-filter-stubs for type checking
from django import forms
from django_filters import FilterSet, CharFilter
from django.db import models
class Product(models.Model):
name = models.CharField(max_length=255)
description = models.TextField()
class Meta:
app_label = 'myapp'
class ProductFilter(FilterSet):
name = CharFilter(field_name='name', lookup_expr='icontains')
class Meta:
model = Product
fields = ['name']
def get_filtered_products(request, queryset):
product_filter = ProductFilter(request.GET, queryset=queryset)
return product_filter.qs
Debug
Known issues
breakingThe `django-filter-stubs` project has been officially archived by its maintainers. This means no further development, bug fixes, or compatibility updates are expected.fixConsider migrating to `types-django-filter` (from typeshed, installed via `pip install types-django-filter`), which is actively maintained and provides current stubs for `django-filter`.
affects: 0.2.0 and later
breakingVersion 0.2.0 of `django-filter-stubs` dropped support for Python 3.7. Attempting to use this version with Python 3.7 may lead to unexpected errors or missing type information.fixUpgrade your Python environment to 3.8 or newer. Python 3.7 has reached its end-of-life.
affects: 0.2.0
gotchaDue to the project's archived status, the provided type stubs may become outdated quickly and might not accurately reflect the latest APIs or features of newer `django-filter` or Django versions. This can result in false positives or missed type errors in Mypy.fixIf encountering type issues, manually inspect the `django-filter` source code or consider switching to the actively maintained `types-django-filter` package for up-to-date type definitions.
affects: 0.2.0 (all versions, due to lack of maintenance)
Upgrade
Version history
0.1.3latest on PyPI · released Mar 28, 2023
Audit
Dependencies
django-filterrequiredProvides type stubs for this library.
djangorequiredImplicit dependency for any Django project using django-filter.
mypyrequiredRequired for static type checking to utilize these stubs.