Repository: django-compressor/django-compressor

Issue:
Drop slimit
https://github.com/django-compressor/django-compressor/runs/4690546430?check_suite_focus=true

Only 3.6 builds seem to be passing, rest are failing with:

```
======================================================================
ERROR: test_slimit_filter (compressor.tests.test_filters.SlimItTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/django-compressor/django-compressor/compressor/filters/base.py", line 84, in __init__
    func = getattr(import_module(mod_name), func_name)
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/runner/work/django-compressor/django-compressor/.tox/py37-2.2.X/lib/python3.7/site-packages/slimit/__init__.py", line 27, in <module>
    from minifier import minify
ModuleNotFoundError: No module named 'minifier'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/runner/work/django-compressor/django-compressor/compressor/tests/test_filters.py", line 210, in test_slimit_filter
    self.assertEqual(output, SlimItFilter(content).output())
  File "/home/runner/work/django-compressor/django-compressor/compressor/filters/base.py", line 96, in __init__
    "correctly installed." % (self.callback, warning))
django.core.exceptions.ImproperlyConfigured: The callback slimit.minify couldn't be imported. Make sure the dependency (slimit) is correctly installed.
```


Discussion:
slimit hasn't had a release for a very long time. If people want to keep using it they can easily write the 3 lines to do that themselves. I'm going to deprecate it and remove the tests in the meantime.

Resolving patch:
diff --git a/compressor/filters/jsmin/__init__.py b/compressor/filters/jsmin/__init__.py
--- a/compressor/filters/jsmin/__init__.py
+++ b/compressor/filters/jsmin/__init__.py
@@ -1,3 +1,5 @@
+import warnings
+
 from django.core.exceptions import ImproperlyConfigured
 
 from compressor.filters import FilterBase, CallbackOutputFilter
@@ -6,9 +8,7 @@
 class rJSMinFilter(CallbackOutputFilter):
     callback = "rjsmin.jsmin"
     dependencies = ["rjsmin"]
-    kwargs = {
-        "keep_bang_comments": True
-    }
+    kwargs = {"keep_bang_comments": True}
 
 
 # This is for backwards compatibility
@@ -22,6 +22,14 @@ class SlimItFilter(CallbackOutputFilter):
         "mangle": True,
     }
 
+    def __init__(self, *args, **kwargs):
+        warnings.warn(
+            "SlimItFilter is broken in Python 3.6+ and will be removed in "
+            "django-compressor 3.3.",
+            DeprecationWarning,
+        )
+        super().__init__(*args, **kwargs)
+
 
 class CalmjsFilter(FilterBase):
     def __init__(self, *args, **kwargs):
@@ -39,7 +47,8 @@ def __init__(self, *args, **kwargs):
         except ImportError:
             raise ImproperlyConfigured(
                 "The module calmjs.parse couldn't be imported. "
-                "Make sure it is correctly installed.")
+                "Make sure it is correctly installed."
+            )
         if self._parser is None:
             self._parser = calmjs.parse.es5
         if self._unparser is None:


Test patch:
diff --git a/compressor/tests/test_filters.py b/compressor/tests/test_filters.py
--- a/compressor/tests/test_filters.py
+++ b/compressor/tests/test_filters.py
@@ -2,7 +2,7 @@
 import os
 import sys
 from collections import defaultdict
-from unittest import mock
+from unittest import mock, skipIf
 
 from django.conf import settings
 from django.test import override_settings, TestCase
@@ -202,6 +202,7 @@ def test_jsmin_filter(self):
         self.assertEqual(output, rJSMinFilter(content).output())
 
 
+@skipIf(sys.version_info >= (3, 7), reason="Unsupported in Python 3.7+")
 class SlimItTestCase(TestCase):
     def test_slimit_filter(self):
         content = """