diff --git a/.travis.yml b/.travis.yml index d7e53f1..8bd615b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,11 @@ language: python python: - - 2.7 - - 3.4 - 3.5 - 3.6 + - 3.7 + - 3.8 env: - - DJANGO_VERSION=1.11 + - DJANGO_VERSION=2.2 install: - pip install -q Django==$DJANGO_VERSION - pip install -e .[flake8,tests] diff --git a/README.md b/README.md index 3a67942..da14dfb 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://travis-ci.org/roverdotcom/django-inlinecss.png?branch=master)](https://travis-ci.org/roverdotcom/django-inlinecss) +[![Build Status](https://travis-ci.org/roverdotcom/django-inlinecss.svg?branch=master)](https://travis-ci.org/roverdotcom/django-inlinecss) ## About @@ -14,8 +14,8 @@ template language. - BeautifulSoup - cssutils -- Python 2.7+,3.4+ -- Django 1.11+ +- Python 3.5+ +- Django 2.2+ #### Step 2: Install django_inlinecss diff --git a/django_inlinecss/conf.py b/django_inlinecss/conf.py index dc0448e..eea6976 100644 --- a/django_inlinecss/conf.py +++ b/django_inlinecss/conf.py @@ -1,9 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals - - try: import importlib except ImportError: diff --git a/django_inlinecss/css_loaders.py b/django_inlinecss/css_loaders.py index 3021874..9ca636e 100644 --- a/django_inlinecss/css_loaders.py +++ b/django_inlinecss/css_loaders.py @@ -1,13 +1,8 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals - from django.contrib.staticfiles import finders from django.contrib.staticfiles.storage import staticfiles_storage -class BaseCSSLoader(object): +class BaseCSSLoader: def __init__(self): pass diff --git a/django_inlinecss/engines.py b/django_inlinecss/engines.py index 55ab018..8de801d 100644 --- a/django_inlinecss/engines.py +++ b/django_inlinecss/engines.py @@ -1,14 +1,7 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals - -from builtins import object - import pynliner -class EngineBase(object): +class EngineBase: def __init__(self, html, css): self.html = html self.css = css diff --git a/django_inlinecss/templatetags/inlinecss.py b/django_inlinecss/templatetags/inlinecss.py index c778ddf..70a4bde 100644 --- a/django_inlinecss/templatetags/inlinecss.py +++ b/django_inlinecss/templatetags/inlinecss.py @@ -1,10 +1,5 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals - from django import template -from django.utils.encoding import smart_text +from django.utils.encoding import smart_str from django_inlinecss import conf @@ -23,7 +18,7 @@ def render(self, context): for expression in self.filter_expressions: path = expression.resolve(context, True) if path is not None: - path = smart_text(path) + path = smart_str(path) css_loader = conf.get_css_loader()() css = ''.join((css, css_loader.load(path))) diff --git a/django_inlinecss/tests/test_css_loaders.py b/django_inlinecss/tests/test_css_loaders.py index f79a1c2..fe969c3 100644 --- a/django_inlinecss/tests/test_css_loaders.py +++ b/django_inlinecss/tests/test_css_loaders.py @@ -1,11 +1,6 @@ """ Test CSS loaders """ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals - from django.conf import settings from django.test import TestCase from django.test import override_settings @@ -18,7 +13,7 @@ class StaticfilesFinderCSSLoaderTestCase(TestCase): def setUp(self): self.loader = StaticfilesFinderCSSLoader() - super(StaticfilesFinderCSSLoaderTestCase, self).setUp() + super().setUp() def test_loads_existing_css_file(self): css = self.loader.load('bar.css') @@ -34,7 +29,7 @@ def test_load_file_does_not_exist(self): class StaticfilesStorageCSSLoaderTestCase(TestCase): def setUp(self): self.loader = StaticfilesStorageCSSLoader() - super(StaticfilesStorageCSSLoaderTestCase, self).setUp() + super().setUp() def test_loads_existing_css_file(self): css = self.loader.load('bar.css') diff --git a/django_inlinecss/tests/test_templatetags.py b/django_inlinecss/tests/test_templatetags.py index 06d6227..9d127e8 100644 --- a/django_inlinecss/tests/test_templatetags.py +++ b/django_inlinecss/tests/test_templatetags.py @@ -4,11 +4,6 @@ The actual CSS inlining displayed here is extremely simple: tests of the CSS selector functionality is independent. """ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals - import os from django.conf import settings @@ -21,7 +16,7 @@ class InlinecssTests(TestCase): def setUp(self): - super(InlinecssTests, self).setUp() + super().setUp() def assert_foo_and_bar_rendered(self, rendered): foo_div_regex = ( diff --git a/setup.py b/setup.py index c1ff0c5..3ab79b6 100644 --- a/setup.py +++ b/setup.py @@ -1,9 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals - import io import os import sys @@ -21,14 +15,13 @@ URL = 'https://github.com/roverdotcom/django-inlinecss' EMAIL = 'philip@rover.com' AUTHOR = 'Philip Kimmey' -REQUIRES_PYTHON = '>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <3.7' +REQUIRES_PYTHON = '>=3.5' VERSION = None # What packages are required for this module to be executed? REQUIRED = [ - 'Django>=1.11', + 'Django>=2.2', 'pynliner', - 'future>=0.16.0', ] # What packages are required only for tests? @@ -41,7 +34,7 @@ # What packages are optional? EXTRAS = { 'flake8': [ - 'flake8==3.6.0', + 'flake8==3.8.0', 'flake8-isort==2.6.0', 'isort==4.3.4', 'testfixtures==6.3.0', @@ -55,12 +48,6 @@ # Import the README and use it as the long-description. # Note: this will only work if 'README.md' is present in your MANIFEST.in file! -try: - # Python 3 will raise FileNotFoundError instead of IOError - FileNotFoundError = IOError -except NameError: - pass - try: with io.open(os.path.join(here, 'README.md'), encoding='utf-8') as f: long_description = '\n' + f.read() @@ -134,12 +121,11 @@ def run(self): 'License :: OSI Approved :: MIT License', 'Operating System :: OS Independent', 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', 'Topic :: Communications :: Email', 'Topic :: Text Processing :: Markup :: HTML', ], diff --git a/test_settings.py b/test_settings.py index 08b5b85..0a91aa4 100644 --- a/test_settings.py +++ b/test_settings.py @@ -9,11 +9,6 @@ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.11/ref/settings/ """ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals - import os