diff --git a/analytical/templatetags/analytical.py b/analytical/templatetags/analytical.py
index bc9c262..f9ca446 100644
--- a/analytical/templatetags/analytical.py
+++ b/analytical/templatetags/analytical.py
@@ -3,14 +3,13 @@ Analytical template tags and filters.
"""
import logging
+from importlib import import_module
from django import template
from django.template import Node, TemplateSyntaxError
-from importlib import import_module
from analytical.utils import AnalyticalException
-
TAG_LOCATIONS = ['head_top', 'head_bottom', 'body_top', 'body_bottom']
TAG_POSITIONS = ['first', None, 'last']
TAG_MODULES = [
diff --git a/analytical/templatetags/chartbeat.py b/analytical/templatetags/chartbeat.py
index 1bdb9ab..6ab7b84 100644
--- a/analytical/templatetags/chartbeat.py
+++ b/analytical/templatetags/chartbeat.py
@@ -9,8 +9,7 @@ from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.template import Library, Node, TemplateSyntaxError
-from analytical.utils import is_internal_ip, disable_html, get_required_setting
-
+from analytical.utils import disable_html, get_required_setting, is_internal_ip
USER_ID_RE = re.compile(r'^\d+$')
INIT_CODE = """"""
diff --git a/analytical/templatetags/clickmap.py b/analytical/templatetags/clickmap.py
index 2cdaf80..16ec133 100644
--- a/analytical/templatetags/clickmap.py
+++ b/analytical/templatetags/clickmap.py
@@ -6,8 +6,7 @@ import re
from django.template import Library, Node, TemplateSyntaxError
-from analytical.utils import is_internal_ip, disable_html, get_required_setting
-
+from analytical.utils import disable_html, get_required_setting, is_internal_ip
CLICKMAP_TRACKER_ID_RE = re.compile(r'^\w+$')
TRACKING_CODE = """
diff --git a/analytical/templatetags/clicky.py b/analytical/templatetags/clicky.py
index 71d5fba..2401a4c 100644
--- a/analytical/templatetags/clicky.py
+++ b/analytical/templatetags/clicky.py
@@ -7,9 +7,12 @@ import re
from django.template import Library, Node, TemplateSyntaxError
-from analytical.utils import get_identity, is_internal_ip, disable_html, \
- get_required_setting
-
+from analytical.utils import (
+ disable_html,
+ get_identity,
+ get_required_setting,
+ is_internal_ip,
+)
SITE_ID_RE = re.compile(r'^\d+$')
TRACKING_CODE = """
diff --git a/analytical/templatetags/crazy_egg.py b/analytical/templatetags/crazy_egg.py
index 5ad8a5a..49338b3 100644
--- a/analytical/templatetags/crazy_egg.py
+++ b/analytical/templatetags/crazy_egg.py
@@ -6,8 +6,7 @@ import re
from django.template import Library, Node, TemplateSyntaxError
-from analytical.utils import is_internal_ip, disable_html, get_required_setting
-
+from analytical.utils import disable_html, get_required_setting, is_internal_ip
ACCOUNT_NUMBER_RE = re.compile(r'^\d+$')
SETUP_CODE = '"""
diff --git a/analytical/templatetags/performable.py b/analytical/templatetags/performable.py
index 39e6c16..de84bcf 100644
--- a/analytical/templatetags/performable.py
+++ b/analytical/templatetags/performable.py
@@ -7,9 +7,12 @@ import re
from django.template import Library, Node, TemplateSyntaxError
from django.utils.safestring import mark_safe
-from analytical.utils import is_internal_ip, disable_html, get_identity, \
- get_required_setting
-
+from analytical.utils import (
+ disable_html,
+ get_identity,
+ get_required_setting,
+ is_internal_ip,
+)
API_KEY_RE = re.compile(r'^\w+$')
SETUP_CODE = """
diff --git a/analytical/templatetags/piwik.py b/analytical/templatetags/piwik.py
index 8855a61..88adb9c 100644
--- a/analytical/templatetags/piwik.py
+++ b/analytical/templatetags/piwik.py
@@ -2,17 +2,20 @@
Piwik template tags and filters.
"""
+import re
+import warnings
from collections import namedtuple
from itertools import chain
-import re
from django.conf import settings
from django.template import Library, Node, TemplateSyntaxError
-from analytical.utils import (is_internal_ip, disable_html,
- get_required_setting, get_identity)
-
-import warnings
+from analytical.utils import (
+ disable_html,
+ get_identity,
+ get_required_setting,
+ is_internal_ip,
+)
# domain name (characters separated by a dot), optional port, optional URI path, no slash
DOMAINPATH_RE = re.compile(r'^(([^./?#@:]+\.)*[^./?#@:]+)+(:[0-9]+)?(/[^/?#@:]+)*$')
diff --git a/analytical/templatetags/rating_mailru.py b/analytical/templatetags/rating_mailru.py
index c7b050a..bdcb444 100644
--- a/analytical/templatetags/rating_mailru.py
+++ b/analytical/templatetags/rating_mailru.py
@@ -6,9 +6,7 @@ import re
from django.template import Library, Node, TemplateSyntaxError
-from analytical.utils import is_internal_ip, disable_html, \
- get_required_setting
-
+from analytical.utils import disable_html, get_required_setting, is_internal_ip
COUNTER_ID_RE = re.compile(r'^\d{7}$')
COUNTER_CODE = """
diff --git a/analytical/templatetags/spring_metrics.py b/analytical/templatetags/spring_metrics.py
index d402846..06814fc 100644
--- a/analytical/templatetags/spring_metrics.py
+++ b/analytical/templatetags/spring_metrics.py
@@ -6,9 +6,12 @@ import re
from django.template import Library, Node, TemplateSyntaxError
-from analytical.utils import get_identity, is_internal_ip, disable_html, \
- get_required_setting
-
+from analytical.utils import (
+ disable_html,
+ get_identity,
+ get_required_setting,
+ is_internal_ip,
+)
TRACKING_ID_RE = re.compile(r'^[0-9a-f]+$')
TRACKING_CODE = """
diff --git a/analytical/templatetags/uservoice.py b/analytical/templatetags/uservoice.py
index 1e64e38..a7ae920 100644
--- a/analytical/templatetags/uservoice.py
+++ b/analytical/templatetags/uservoice.py
@@ -7,8 +7,8 @@ import re
from django.conf import settings
from django.template import Library, Node, TemplateSyntaxError
-from analytical.utils import get_required_setting, get_identity
+from analytical.utils import get_identity, get_required_setting
WIDGET_KEY_RE = re.compile(r'^[a-zA-Z0-9]*$')
TRACKING_CODE = """
diff --git a/analytical/templatetags/yandex_metrica.py b/analytical/templatetags/yandex_metrica.py
index b269c89..209514b 100644
--- a/analytical/templatetags/yandex_metrica.py
+++ b/analytical/templatetags/yandex_metrica.py
@@ -8,9 +8,7 @@ import re
from django.conf import settings
from django.template import Library, Node, TemplateSyntaxError
-from analytical.utils import is_internal_ip, disable_html, \
- get_required_setting
-
+from analytical.utils import disable_html, get_required_setting, is_internal_ip
COUNTER_ID_RE = re.compile(r'^\d{8}$')
COUNTER_CODE = """
diff --git a/analytical/utils.py b/analytical/utils.py
index 45e0fcf..be70b70 100644
--- a/analytical/utils.py
+++ b/analytical/utils.py
@@ -5,7 +5,6 @@ Utility function for django-analytical.
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
-
HTML_COMMENT = ""
diff --git a/setup.cfg b/setup.cfg
index 72285af..93945f8 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -8,3 +8,6 @@ upload-dir = build/docs/html
[tool:pytest]
DJANGO_SETTINGS_MODULE = tests.testproject.settings
+
+[isort]
+profile = black
diff --git a/tests/testproject/templatetags/dummy.py b/tests/testproject/templatetags/dummy.py
index 4bca645..a267c39 100644
--- a/tests/testproject/templatetags/dummy.py
+++ b/tests/testproject/templatetags/dummy.py
@@ -6,7 +6,6 @@ from django.template import Library, Node, TemplateSyntaxError
from analytical.templatetags.analytical import TAG_LOCATIONS
-
register = Library()
diff --git a/tests/unit/test_tag_analytical.py b/tests/unit/test_tag_analytical.py
index e037afc..037c08e 100644
--- a/tests/unit/test_tag_analytical.py
+++ b/tests/unit/test_tag_analytical.py
@@ -3,9 +3,9 @@ Tests for the generic template tags and filters.
"""
from django.template import Context, Template
+from utils import TagTestCase
from analytical.templatetags import analytical
-from utils import TagTestCase
class AnalyticsTagTestCase(TagTestCase):
diff --git a/tests/unit/test_tag_chartbeat.py b/tests/unit/test_tag_chartbeat.py
index c5e6493..f22f663 100644
--- a/tests/unit/test_tag_chartbeat.py
+++ b/tests/unit/test_tag_chartbeat.py
@@ -4,17 +4,15 @@ Tests for the Chartbeat template tags and filters.
import re
+import pytest
from django.http import HttpRequest
from django.template import Context
from django.test import TestCase
from django.test.utils import override_settings
-
-from analytical.templatetags.chartbeat import ChartbeatTopNode, \
- ChartbeatBottomNode
from utils import TagTestCase
-from analytical.utils import AnalyticalException
-import pytest
+from analytical.templatetags.chartbeat import ChartbeatBottomNode, ChartbeatTopNode
+from analytical.utils import AnalyticalException
@override_settings(CHARTBEAT_USER_ID='12345')
diff --git a/tests/unit/test_tag_clickmap.py b/tests/unit/test_tag_clickmap.py
index b6049eb..8be58cf 100644
--- a/tests/unit/test_tag_clickmap.py
+++ b/tests/unit/test_tag_clickmap.py
@@ -2,16 +2,15 @@
Tests for the Clickmap template tags and filters.
"""
+import pytest
from django.http import HttpRequest
from django.template import Context
from django.test.utils import override_settings
+from utils import TagTestCase
from analytical.templatetags.clickmap import ClickmapNode
-from utils import TagTestCase
from analytical.utils import AnalyticalException
-import pytest
-
@override_settings(CLICKMAP_TRACKER_ID='12345ABC')
class ClickmapTagTestCase(TagTestCase):
diff --git a/tests/unit/test_tag_clicky.py b/tests/unit/test_tag_clicky.py
index 2be16c8..8b40766 100644
--- a/tests/unit/test_tag_clicky.py
+++ b/tests/unit/test_tag_clicky.py
@@ -4,17 +4,16 @@ Tests for the Clicky template tags and filters.
import re
-from django.contrib.auth.models import User, AnonymousUser
+import pytest
+from django.contrib.auth.models import AnonymousUser, User
from django.http import HttpRequest
from django.template import Context
from django.test.utils import override_settings
+from utils import TagTestCase
from analytical.templatetags.clicky import ClickyNode
-from utils import TagTestCase
from analytical.utils import AnalyticalException
-import pytest
-
@override_settings(CLICKY_SITE_ID='12345678')
class ClickyTagTestCase(TagTestCase):
diff --git a/tests/unit/test_tag_crazy_egg.py b/tests/unit/test_tag_crazy_egg.py
index f2cab47..993f74a 100644
--- a/tests/unit/test_tag_crazy_egg.py
+++ b/tests/unit/test_tag_crazy_egg.py
@@ -2,13 +2,13 @@
Tests for the Crazy Egg template tags and filters.
"""
+import pytest
from django.http import HttpRequest
from django.template import Context
from django.test.utils import override_settings
-import pytest
+from utils import TagTestCase
from analytical.templatetags.crazy_egg import CrazyEggNode
-from utils import TagTestCase
from analytical.utils import AnalyticalException
diff --git a/tests/unit/test_tag_facebook_pixel.py b/tests/unit/test_tag_facebook_pixel.py
index 2020257..374fa95 100644
--- a/tests/unit/test_tag_facebook_pixel.py
+++ b/tests/unit/test_tag_facebook_pixel.py
@@ -1,17 +1,19 @@
"""
Tests for the Facebook Pixel template tags.
"""
+import pytest
from django.http import HttpRequest
from django.template import Context, Template, TemplateSyntaxError
from django.test import override_settings
+from utils import TagTestCase
from analytical.templatetags.analytical import _load_template_nodes
-from analytical.templatetags.facebook_pixel import FacebookPixelHeadNode, FacebookPixelBodyNode
-from utils import TagTestCase
+from analytical.templatetags.facebook_pixel import (
+ FacebookPixelBodyNode,
+ FacebookPixelHeadNode,
+)
from analytical.utils import AnalyticalException
-import pytest
-
expected_head_html = """\