Skip to content

Commit

Permalink
Updates to support isort 5.0 (#70)
Browse files Browse the repository at this point in the history
Removed `not_skip` and `recursive` from `tox.ini` to fix
TypeError: __init__() got an unexpected keyword argument 'not_skip'

* recursive
Prior to version 5.0.0, isort wouldn't automatically traverse directories. The --recursive option was necessary to tell it to do so. In 5.0.0 directories are automatically traversed for all Python files, and as such this option is no longer necessary and should simply be removed.

* not_skip
In an earlier version isort had a default skip of __init__.py. To get around that many projects wanted a way to not skip __init__.py or any other files that were automatically skipped in the future by isort. isort no longer has any default skips, so if the value here is __init__.py you can simply remove the setting.

https://timothycrosley.github.io/isort/docs/upgrade_guides/5.0.0/

* Add python_requires to setup.py

* Remove six from isort standard libraries

isort seems to have switched to `frozenset` for `known_standard_library`, which broke the way we're overriding it here to add `six`. This caused only `six` to be recognized as a standard library, and everything else as third-party. This is an explicit behavior change (see PyCQA/isort#1238).

We no longer use `six` so we can remove this setting

* Remove known_future_library line in isort config in tox.ini
  • Loading branch information
cwdavies authored Jul 14, 2020
1 parent db1f1d5 commit d220d83
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 12 deletions.
3 changes: 2 additions & 1 deletion flags/jinja2tags.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from flags.templatetags.feature_flags import flag_disabled, flag_enabled
from jinja2 import contextfunction
from jinja2.ext import Extension

from flags.templatetags.feature_flags import flag_disabled, flag_enabled


class FlagsExtension(Extension):
def __init__(self, environment):
Expand Down
1 change: 1 addition & 0 deletions flags/panels.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from django.utils.translation import gettext_lazy as _

from debug_toolbar.panels import Panel

from flags import state
from flags.sources import get_flags

Expand Down
2 changes: 0 additions & 2 deletions flags/state.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import

from django.apps import apps
from django.core.exceptions import AppRegistryNotReady

Expand Down
1 change: 1 addition & 0 deletions flags/tests/test_panels.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from django.test import RequestFactory, TestCase, override_settings

from debug_toolbar.toolbar import DebugToolbar

from flags.state import flag_state


Expand Down
8 changes: 2 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from setuptools import find_packages, setup


long_description = open("README.md", "r").read()

install_requires = ["Django>=1.11,<3.1"]

testing_extras = [
Expand All @@ -23,12 +21,13 @@
author="CFPB",
author_email="tech@cfpb.gov",
description="Feature flags for Django projects",
long_description=long_description,
long_description=open("README.md", "r", encoding="utf-8").read(),
long_description_content_type="text/markdown",
license="CC0",
version="5.0.0",
include_package_data=True,
packages=find_packages(),
python_requires=">=3.6",
install_requires=install_requires,
extras_require={"testing": testing_extras, "docs": docs_extras},
classifiers=[
Expand All @@ -39,8 +38,5 @@
"License :: Public Domain",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
],
)
4 changes: 1 addition & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ deps=
commands=
black --check flags setup.py
flake8 flags setup.py
isort --check-only --diff --recursive flags
isort --check-only --diff flags

[testenv:docs]
basepython=python3.6
Expand All @@ -52,9 +52,7 @@ lines_after_imports=2
include_trailing_comma=1
multi_line_output=3
skip=.tox,migrations
not_skip=__init__.py
use_parentheses=1
known_django=django
known_future_library=future,six
default_section=THIRDPARTY
sections=FUTURE,STDLIB,DJANGO,THIRDPARTY,FIRSTPARTY,LOCALFOLDER

0 comments on commit d220d83

Please sign in to comment.