Skip to content

Commit

Permalink
Merge pull request #24 from octodns/isort
Browse files Browse the repository at this point in the history
Use pyproject.toml for tooling, add isort management of imports
  • Loading branch information
ross committed Feb 4, 2023
2 parents 3305ca4 + 847cb1d commit 53c334d
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 48 deletions.
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# Commit that added in black formatting support
193d643be5a79c7a8d9e64b21a901ff6c87c9501
# Commit for isort formatting changes
b8f91d189ecd95fc9d93511213e9f075861fa91f
13 changes: 6 additions & 7 deletions octodns_constellix/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@
#
#

from collections import defaultdict
from requests import Session
from base64 import b64encode, standard_b64encode
from pycountry_convert import country_alpha2_to_continent_code
import hashlib
import hmac
import logging
import time
from base64 import b64encode, standard_b64encode
from collections import defaultdict

from pycountry_convert import country_alpha2_to_continent_code
from requests import Session

from octodns.record import Record
from octodns.provider import ProviderException
from octodns.provider.base import BaseProvider
from octodns.record import Record

__VERSION__ = '0.0.3'

Expand Down Expand Up @@ -912,7 +913,6 @@ def _create_update_dynamic(self, record):
def _create_update_check(
self, pool_type, check_name, check_type, value, port, interval, sites
):

check = {
'name': check_name,
'host': value,
Expand Down Expand Up @@ -1040,7 +1040,6 @@ def _apply_Delete(self, change, domain_name):
existing.name == record['name']
and existing._type == record['type']
):

# Handle dynamic record.
if (
record.get('geolocation')
Expand Down
14 changes: 14 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[tool.black]
line-length=80
skip-string-normalization=true
skip-magic-trailing-comma=true

[tool.isort]
profile = "black"
known_first_party="octodns_constellix"
known_octodns="octodns"
line_length=80
sections="FUTURE,STDLIB,THIRDPARTY,OCTODNS,FIRSTPARTY,LOCALFOLDER"

[tool.pytest.ini_options]
pythonpath = "."
38 changes: 20 additions & 18 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
# DO NOT EDIT THIS FILE DIRECTLY - use ./script/update-requirements to update
Pygments==2.13.0
black==22.10.0
bleach==5.0.1
build==0.8.0
Pygments==2.14.0
black==23.1.0
bleach==6.0.0
build==0.10.0
cffi==1.15.1
click==8.1.3
cmarkgfm==0.8.0
commonmark==0.9.1
cmarkgfm==2022.10.27
docutils==0.19
importlib-metadata==5.0.0
importlib-metadata==6.0.0
isort==5.11.5
jaraco.classes==3.2.3
keyring==23.9.3
keyring==23.13.1
markdown-it-py==2.1.0
mdurl==0.1.2
more-itertools==9.0.0
mypy-extensions==0.4.3
pathspec==0.10.1
pep517==0.13.0
pkginfo==1.8.3
platformdirs==2.5.2
mypy-extensions==1.0.0
pathspec==0.11.0
pkginfo==1.9.6
platformdirs==2.6.2
pycparser==2.21
pyflakes==2.5.0
pyflakes==3.0.1
pyproject_hooks==1.0.0
pytest-network==0.0.1
readme-renderer==37.2
readme-renderer==37.3
requests-mock==1.10.0
requests-toolbelt==0.10.1
rfc3986==2.0.0
rich==12.6.0
twine==4.0.1
rich==13.3.1
twine==4.0.2
webencodings==0.5.1
zipp==3.10.0
zipp==3.12.0
21 changes: 10 additions & 11 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
# DO NOT EDIT THIS FILE DIRECTLY - use ./script/update-requirements to update
PyYAML==6.0
attrs==22.1.0
attrs==22.2.0
certifi==2022.12.7
charset-normalizer==2.1.1
coverage==6.5.0
dnspython==2.2.1
exceptiongroup==1.0.0rc9
charset-normalizer==3.0.1
coverage==7.1.0
dnspython==2.3.0
exceptiongroup==1.1.0
fqdn==1.5.1
idna==3.4
iniconfig==1.1.1
iniconfig==2.0.0
natsort==8.2.0
octodns==0.9.21
packaging==21.3
packaging==23.0
pluggy==1.0.0
pprintpp==0.4.0
pycountry-convert==0.7.2
pycountry==22.3.5
pyparsing==3.0.9
pytest-cov==4.0.0
pytest-mock==3.10.0
pytest==7.2.0
pytest==7.2.1
python-dateutil==2.8.2
repoze.lru==0.7
requests==2.28.1
requests==2.28.2
six==1.16.0
tomli==2.0.1
urllib3==1.26.12
urllib3==1.26.14
2 changes: 0 additions & 2 deletions script/coverage
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ grep -r -I --line-number "# pragma: +no.*cover" $SOURCE_DIR && {
exit 1
}

export PYTHONPATH=.:$PYTHONPATH

pytest \
--disable-network \
--cov-reset \
Expand Down
3 changes: 2 additions & 1 deletion script/format
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 0 additions & 2 deletions script/test
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,4 @@ if [ ! -f "$ACTIVATE" ]; then
fi
. "$ACTIVATE"

export PYTHONPATH=.:$PYTHONPATH

pytest --disable-network "$@"
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -43,6 +44,8 @@ def version():
+ (
'black>=22.3.0',
'build>=0.7.0',
# >=5.12.0 does not support python 3.7, we still do
'isort==5.11.5',
'pyflakes>=2.2.0',
'readme_renderer[md]>=26.0',
'twine>=3.4.2',
Expand Down
14 changes: 8 additions & 6 deletions tests/test_provider_constellix.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,24 @@
#
#

from os.path import dirname, join
from requests import HTTPError
import logging
from requests_mock import ANY, mock as requests_mock
from os.path import dirname, join
from unittest import TestCase
from unittest.mock import Mock, PropertyMock, call

from octodns.record import Record
from requests import HTTPError
from requests_mock import ANY
from requests_mock import mock as requests_mock

from octodns.provider import SupportsException
from octodns.provider.yaml import YamlProvider
from octodns.record import Record
from octodns.zone import Zone

from octodns_constellix import (
ConstellixProvider,
ConstellixClientBadRequest,
ConstellixClient,
ConstellixClientBadRequest,
ConstellixProvider,
)


Expand Down

0 comments on commit 53c334d

Please sign in to comment.