From d1f24e38c535b9a3026bb8a41ee559e58e97ff5f Mon Sep 17 00:00:00 2001 From: Ross McFarland Date: Fri, 20 Jan 2023 13:11:03 -0800 Subject: [PATCH 1/6] Add isort, use pyproject.toml for isort and black --- script/format | 3 ++- setup.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/script/format b/script/format index 446c075..211bd4a 100755 --- a/script/format +++ b/script/format @@ -6,4 +6,5 @@ SOURCES=$(find *.py octodns_* tests -name "*.py") . env/bin/activate -black --line-length=80 --skip-string-normalization --skip-magic-trailing-comma "$@" $SOURCES +isort "$@" $SOURCES +black "$@" $SOURCES diff --git a/setup.py b/setup.py index fdc9aec..e832005 100644 --- a/setup.py +++ b/setup.py @@ -43,6 +43,7 @@ def version(): + ( 'black>=22.3.0', 'build>=0.7.0', + 'isort>=5.11.4', 'pyflakes>=2.2.0', 'readme_renderer[md]>=26.0', 'twine>=3.4.2', From 79494e75dc20226d130e27d638108f8d96fd7873 Mon Sep 17 00:00:00 2001 From: Ross McFarland Date: Fri, 20 Jan 2023 13:11:16 -0800 Subject: [PATCH 2/6] isort formatting --- octodns_ns1/__init__.py | 6 +++--- setup.py | 3 ++- tests/test_provider_ns1.py | 3 ++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/octodns_ns1/__init__.py b/octodns_ns1/__init__.py index 6cda30e..b7d19b5 100644 --- a/octodns_ns1/__init__.py +++ b/octodns_ns1/__init__.py @@ -6,17 +6,17 @@ from collections.abc import Mapping from itertools import chain from logging import getLogger +from time import sleep +from uuid import uuid4 + from ns1 import NS1 from ns1.rest.errors import RateLimitException, ResourceException from pycountry_convert import country_alpha2_to_continent_code -from time import sleep -from uuid import uuid4 from octodns.provider import ProviderException from octodns.provider.base import BaseProvider from octodns.record import Record, Update - __VERSION__ = '0.0.2' diff --git a/setup.py b/setup.py index e832005..be708b0 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,8 @@ from os import environ -from setuptools import find_packages, setup from subprocess import CalledProcessError, check_output +from setuptools import find_packages, setup + def descriptions(): with open('README.md') as fh: diff --git a/tests/test_provider_ns1.py b/tests/test_provider_ns1.py index 83ab1fe..9996a64 100644 --- a/tests/test_provider_ns1.py +++ b/tests/test_provider_ns1.py @@ -4,10 +4,11 @@ from collections import defaultdict from logging import getLogger -from ns1.rest.errors import AuthException, RateLimitException, ResourceException from unittest import TestCase from unittest.mock import call, patch +from ns1.rest.errors import AuthException, RateLimitException, ResourceException + from octodns.provider.plan import Plan from octodns.record import Delete, Record, Update from octodns.zone import Zone From e5e802f09ec7fdf2842ddd88356bcb8b152501d1 Mon Sep 17 00:00:00 2001 From: Ross McFarland Date: Fri, 20 Jan 2023 13:12:08 -0800 Subject: [PATCH 3/6] ignore isort commit in blame --- .git-blame-ignore-revs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index a99a930..f6a3856 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -1,2 +1,4 @@ # Commit that added in black formatting support 98ce05a9ebb46033cbbc993ad6b2134c9d9e476f +# Commit that added in isort formatting support +79494e75dc20226d130e27d638108f8d96fd7873 From 76b3a4b50b345c8f691e51e52a5899381d7482c8 Mon Sep 17 00:00:00 2001 From: Ross McFarland Date: Fri, 20 Jan 2023 13:17:05 -0800 Subject: [PATCH 4/6] include isort in requirements-dev.txt --- requirements-dev.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements-dev.txt b/requirements-dev.txt index 34bea24..9a1558d 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -9,6 +9,7 @@ cmarkgfm==0.8.0 commonmark==0.9.1 docutils==0.19 importlib-metadata==5.0.0 +isort==5.11.4 jaraco.classes==3.2.3 keyring==23.9.3 more-itertools==9.0.0 From 31aad9268c882219180d63a2d31e3a9e1af9933d Mon Sep 17 00:00:00 2001 From: Ross McFarland Date: Fri, 20 Jan 2023 13:20:11 -0800 Subject: [PATCH 5/6] forgot to add pyproject.toml --- pyproject.toml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..3c71488 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,11 @@ +[tool.black] +line-length=80 +skip-string-normalization=true +skip-magic-trailing-comma=true + +[tool.isort] +profile = "black" +known_first_party="octodns_ns1" +known_octodns="octodns" +line_length=80 +sections="FUTURE,STDLIB,THIRDPARTY,OCTODNS,FIRSTPARTY,LOCALFOLDER" From 5bb142905b51b0a94d04ade65175fff2bd781577 Mon Sep 17 00:00:00 2001 From: Ross McFarland Date: Fri, 20 Jan 2023 15:59:05 -0800 Subject: [PATCH 6/6] pyproject.toml pytest include . --- pyproject.toml | 3 +++ script/coverage | 2 -- script/test | 2 -- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 3c71488..0b7c8e1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,3 +9,6 @@ known_first_party="octodns_ns1" known_octodns="octodns" line_length=80 sections="FUTURE,STDLIB,THIRDPARTY,OCTODNS,FIRSTPARTY,LOCALFOLDER" + +[tool.pytest.ini_options] +pythonpath = "." diff --git a/script/coverage b/script/coverage index a0e0790..f6a2fa4 100755 --- a/script/coverage +++ b/script/coverage @@ -22,8 +22,6 @@ grep -r -I --line-number "# pragma: +no.*cover" $SOURCE_DIR && { exit 1 } -export PYTHONPATH=.:$PYTHONPATH - pytest \ --disable-network \ --cov-reset \ diff --git a/script/test b/script/test index d5b8787..ff1ab56 100755 --- a/script/test +++ b/script/test @@ -14,6 +14,4 @@ if [ ! -f "$ACTIVATE" ]; then fi . "$ACTIVATE" -export PYTHONPATH=.:$PYTHONPATH - pytest --disable-network "$@"