Skip to content

Commit

Permalink
Update docs, remove future imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Qu4tro committed Jun 17, 2022
1 parent 5a3392c commit 7ed8f00
Show file tree
Hide file tree
Showing 70 changed files with 395 additions and 328 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/updaterelease.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: changerelease
on:
workflow_dispatch: {}
push:
paths: [CHANGELOG.md]
tags: ["*"]

jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: dropseed/changerelease@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
changelog: CHANGELOG.md
29 changes: 19 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,24 @@ repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
hooks:
- id: check-added-large-files
args: [--maxkb=1024]
- id: check-byte-order-marker
- id: debug-statements
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: trailing-whitespace
- id: check-builtin-literals
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-json
- id: pretty-format-json
args: [--autofix, --indent=2]
- id: check-merge-conflict
- id: check-xml
- id: check-yaml
args: [--allow-multiple-documents]
- id: debug-statements
- id: end-of-file-fixer
- id: fix-encoding-pragma
- id: mixed-line-ending
- id: trailing-whitespace
- id: check-added-large-files
args: [--maxkb=1024]
- id: pretty-format-json
args: [--autofix, --indent=2]

- repo: https://github.com/pycqa/flake8
rev: '4.0.1'
Expand All @@ -37,3 +36,13 @@ repos:
rev: '22.3.0'
hooks:
- id: black

- repo: https://github.com/python-poetry/poetry
rev: '1.2.0b1'
hooks:
- id: poetry-check

- repo: https://github.com/mschmieder/python-kacl
rev: 'v0.2.24'
hooks:
- id: kacl-verify
13 changes: 13 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2

build:
os: "ubuntu-20.04"
tools:
python: "3.9"

sphinx:
configuration: docs/conf.py

python:
install:
- requirements: docs/requirements.txt
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ with Django REST Framework but it can be used without DRF (see below).

::

from django_ufilter.integrations.drf import DjangoFilterBackend
from django_ufilter.integrations.drf import DRFFilterBackend


class UserViewSet(ModelViewSet):
Expand Down
5 changes: 1 addition & 4 deletions django_ufilter/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals

__version__ = "0.4.0"
__version__ = "0.3.99"
2 changes: 0 additions & 2 deletions django_ufilter/backends/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
3 changes: 0 additions & 3 deletions django_ufilter/backends/base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals

import abc

import six
Expand Down
3 changes: 0 additions & 3 deletions django_ufilter/backends/django.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals

from django.core.exceptions import FieldDoesNotExist
from django.db.models.constants import LOOKUP_SEP

Expand Down
3 changes: 0 additions & 3 deletions django_ufilter/backends/plain.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals

import re

from ..utils import dictify
Expand Down
3 changes: 0 additions & 3 deletions django_ufilter/constants.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals

import enum


Expand Down
4 changes: 0 additions & 4 deletions django_ufilter/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals


class SkipFilter(Exception):
"""
Exception to be used when any particular filter
Expand Down
3 changes: 0 additions & 3 deletions django_ufilter/fields.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals

from django import forms

from .validators import MaxLengthValidator, MinLengthValidator
Expand Down
3 changes: 0 additions & 3 deletions django_ufilter/filters.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals

import abc
import re
from functools import wraps
Expand Down
3 changes: 0 additions & 3 deletions django_ufilter/filtersets/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals

from .base import * # noqa
from .django import * # noqa
3 changes: 0 additions & 3 deletions django_ufilter/filtersets/base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals

import abc
import re
from collections import defaultdict
Expand Down
5 changes: 1 addition & 4 deletions django_ufilter/filtersets/django.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals

import operator

from django import forms
Expand Down Expand Up @@ -33,7 +30,7 @@

class DjangoModelFilterSetOptions(ModelFilterSetOptions):
"""
Custom options for ``FilterSet``s used for Django models.
Custom options for FilterSets used for Django models.
Attributes
----------
Expand Down
3 changes: 0 additions & 3 deletions django_ufilter/filtersets/plain.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals

from datetime import date, datetime, time
from decimal import Decimal

Expand Down
13 changes: 5 additions & 8 deletions django_ufilter/integrations/drf.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals

from django.core.exceptions import ValidationError as DjangoValidationError
from rest_framework.exceptions import ValidationError
from rest_framework.filters import BaseFilterBackend

from ..filtersets import ModelFilterSet


class DjangoFilterBackend(BaseFilterBackend):
class DRFFilterBackend(BaseFilterBackend):
"""
DRF filter backend which integrates with ``django-ufilter``
Expand All @@ -17,15 +14,15 @@ class DjangoFilterBackend(BaseFilterBackend):
# settings.py
REST_FRAMEWORK = {
'DEFAULT_FILTER_BACKENDS': [
'django_ufilter.integrations.drf.DjangoFilterBackend',
'django_ufilter.integrations.drf.DRFFilterBackend',
]
}
Alternatively filter backend can be specified per view/viewset bases::
class MyViewSet(ModelViewSet):
queryset = MyModel.objects.all()
filter_backends = [DjangoFilterBackend]
filter_backends = [DRFFilterBackend]
filter_fields = ['field1', 'field2']
The following attributes can be specified on the view:
Expand Down Expand Up @@ -62,7 +59,7 @@ def get_filter_class(self, view, queryset=None):
----------
view : View
DRF view/viewset where this filter backend is being used.
Please refer to :class:`.DjangoFilterBackend` documentation
Please refer to :class:`.DRFFilterBackend` documentation
for list of attributes which can be supplied in view
to customize how filterset will be determined.
queryset
Expand Down Expand Up @@ -163,4 +160,4 @@ def filter_queryset(self, request, queryset, view):
return queryset


URLFilterBackend = DjangoFilterBackend
URLFilterBackend = DRFFilterBackend
5 changes: 1 addition & 4 deletions django_ufilter/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals

import inspect
from contextlib import contextmanager

Expand All @@ -27,7 +24,7 @@ class FilterSpec(object):
to be used in filtering of the queryset.
For example lookup config with key
``user__profile__email`` will have components of
``['user', 'profile', 'email'].
``['user', 'profile', 'email']``.
lookup : str
Name of the lookup how final key/attribute from
:attr:`.components` should be compared.
Expand Down
3 changes: 0 additions & 3 deletions django_ufilter/validators.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals

from django.core.validators import MaxLengthValidator as _MaxLengthValidator
from django.core.validators import MinLengthValidator as _MinLengthValidator
from django.utils.deconstruct import deconstructible
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
url\_filter.backends.base module
================================
django_ufilter.backends.base module
============================================

.. automodule:: django_ufilter.backends.base
:members:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
url\_filter.backends.django module
==================================
django_ufilter.backends.django module
==============================================

.. automodule:: django_ufilter.backends.django
:members:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
url\_filter.backends.plain module
=================================
django_ufilter.backends.plain module
=============================================

.. automodule:: django_ufilter.backends.plain
:members:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
url\_filter.backends package
============================
django_ufilter.backends package
==================================

.. automodule:: django_ufilter.backends
:members:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
url\_filter.exceptions module
=============================
django_ufilter.exceptions module
=========================================

.. automodule:: django_ufilter.exceptions
:members:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
url\_filter.fields module
=========================
django_ufilter.fields module
=====================================

.. automodule:: django_ufilter.fields
:members:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
url\_filter.filters module
==========================
django_ufilter.filters module
======================================

.. automodule:: django_ufilter.filters
:members:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
url\_filter.filtersets.base module
==================================
django_ufilter.filtersets.base module
==============================================

.. automodule:: django_ufilter.filtersets.base
:members:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
url\_filter.filtersets.django module
====================================
django_ufilter.filtersets.django module
=============================================

.. automodule:: django_ufilter.filtersets.django
:members:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
url\_filter.filtersets.plain module
===================================
django_ufilter.filtersets.plain module
===============================================

.. automodule:: django_ufilter.filtersets.plain
:members:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
url\_filter.filtersets package
==============================
django_ufilter.filtersets package
==========================================

.. automodule:: django_ufilter.filtersets
:members:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
url\_filter.integrations.drf module
===================================
django_ufilter.integrations.drf module
===============================================

.. automodule:: django_ufilter.integrations.drf
:members:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
url\_filter.integrations package
================================
django_ufilter.integrations package
============================================

.. automodule:: django_ufilter.integrations
:members:
Expand Down
5 changes: 2 additions & 3 deletions docs/api/url_filter.rst → docs/api/django_ufilter.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
url\_filter package
===================
django_ufilter package
===============================

.. automodule:: django_ufilter
:members:
Expand All @@ -20,7 +20,6 @@ Submodules

.. toctree::

django_ufilter.constants
django_ufilter.exceptions
django_ufilter.fields
django_ufilter.filters
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
url\_filter.utils module
========================
django_ufilter.utils module
====================================

.. automodule:: django_ufilter.utils
:members:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
url\_filter.validators module
=============================
django_ufilter.validators module
=========================================

.. automodule:: django_ufilter.validators
:members:
Expand Down
2 changes: 1 addition & 1 deletion docs/api/modules.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
django_ufilter
==========
===================

.. toctree::
:maxdepth: 4
Expand Down
Loading

0 comments on commit 7ed8f00

Please sign in to comment.