Skip to content

Commit

Permalink
Merge pull request #48 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 1a0538d + 301c15d commit 1a97ea3
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 59 deletions.
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
dc71ea8cadec76038b020d9d57bfcfd42e2974e7
# Commit for isort formatting changes
b85e156ee887ef9d8237a0008b023c3538e42cb8
16 changes: 7 additions & 9 deletions octodns_azure/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,33 @@
from functools import reduce
from logging import getLogger

from azure.core.pipeline.policies import RetryPolicy
from azure.identity import ClientSecretCredential
from azure.mgmt.dns import DnsManagementClient
from azure.mgmt.trafficmanager import TrafficManagerManagementClient
from azure.core.pipeline.policies import RetryPolicy

from azure.mgmt.dns.models import (
ARecord,
AaaaRecord,
ARecord,
CaaRecord,
CnameRecord,
MxRecord,
SrvRecord,
NsRecord,
PtrRecord,
SrvRecord,
TxtRecord,
Zone,
)
from azure.mgmt.trafficmanager import TrafficManagerManagementClient
from azure.mgmt.trafficmanager.models import (
Profile,
DnsConfig,
MonitorConfig,
Endpoint,
MonitorConfig,
MonitorConfigCustomHeadersItem,
Profile,
)

from octodns.record import Record, Update, GeoCodes
from octodns.provider import ProviderException
from octodns.provider.base import BaseProvider
from octodns.record import GeoCodes, Record, Update

__VERSION__ = '0.0.4'

Expand Down Expand Up @@ -245,7 +244,6 @@ def _params_for_PTR(self, data, key_name, azure_class):
return {key_name: [azure_class(ptrdname=v) for v in values]}

def _params_for_TXT(self, data, key_name, azure_class):

params = []
try: # API for TxtRecord has list of str, even for singleton
values = [v for v in azure_chunked_values(data['values'])]
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_azure"
known_octodns="octodns"
line_length=80
sections="FUTURE,STDLIB,THIRDPARTY,OCTODNS,FIRSTPARTY,LOCALFOLDER"

[tool.pytest.ini_options]
pythonpath = "."
47 changes: 24 additions & 23 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,37 +1,38 @@
# DO NOT EDIT THIS FILE DIRECTLY - use ./script/update-requirements to update
Pygments==2.13.0
attrs==22.1.0
black==22.10.0
bleach==5.0.1
build==0.9.0
Pygments==2.14.0
attrs==22.2.0
black==23.1.0
bleach==6.0.0
build==0.10.0
click==8.1.3
cmarkgfm==2022.10.27
commonmark==0.9.1
coverage==6.5.0
coverage==7.1.0
docutils==0.19
exceptiongroup==1.0.1
importlib-metadata==5.0.0
iniconfig==1.1.1
exceptiongroup==1.1.0
importlib-metadata==6.0.0
iniconfig==2.0.0
isort==5.11.5
jaraco.classes==3.2.3
keyring==23.11.0
keyring==23.13.1
markdown-it-py==2.1.0
mdurl==0.1.2
more-itertools==9.0.0
mypy-extensions==0.4.3
packaging==21.3
pathspec==0.10.1
pep517==0.13.0
pkginfo==1.8.3
platformdirs==2.5.3
mypy-extensions==1.0.0
packaging==23.0
pathspec==0.11.0
pkginfo==1.9.6
platformdirs==2.6.2
pluggy==1.0.0
pyflakes==2.5.0
pyparsing==3.0.9
pyflakes==3.0.1
pyproject_hooks==1.0.0
pytest-cov==4.0.0
pytest-network==0.0.1
pytest==7.2.0
pytest==7.2.1
readme-renderer==37.3
requests-toolbelt==0.10.1
rfc3986==2.0.0
rich==12.6.0
rich==13.3.1
tomli==2.0.1
twine==4.0.1
twine==4.0.2
webencodings==0.5.1
zipp==3.10.0
zipp==3.12.0
16 changes: 8 additions & 8 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,31 @@ PyJWT==2.6.0
PyYAML==6.0
adal==1.2.7
azure-common==1.1.28
azure-core==1.26.1
azure-core==1.26.3
azure-identity==1.7.1
azure-mgmt-core==1.3.2
azure-mgmt-dns==8.0.0
azure-mgmt-trafficmanager==1.0.0
certifi==2022.12.7
cffi==1.15.1
charset-normalizer==2.1.1
cryptography==38.0.3
dnspython==2.2.1
charset-normalizer==3.0.1
cryptography==39.0.0
dnspython==2.3.0
fqdn==1.5.1
idna==3.4
isodate==0.6.1
msal-extensions==0.3.1
msal==1.20.0
msal==1.21.0
msrest==0.7.1
msrestazure==0.6.4
natsort==8.2.0
oauthlib==3.2.2
octodns==0.9.21
portalocker==2.6.0
portalocker==2.7.0
pycparser==2.21
python-dateutil==2.8.2
requests-oauthlib==1.3.1
requests==2.28.1
requests==2.28.2
six==1.16.0
typing_extensions==4.4.0
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 @@ -27,8 +27,6 @@ export ARM_CLIENT_SECRET=
export ARM_TENANT_ID=
export ARM_SUBSCRIPTION_ID=

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 @@ -19,6 +19,4 @@ export ARM_CLIENT_SECRET=
export ARM_TENANT_ID=
export ARM_SUBSCRIPTION_ID=

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
26 changes: 13 additions & 13 deletions tests/test_provider_azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,45 @@
#

from unittest import TestCase
from unittest.mock import Mock, patch, call
from unittest.mock import Mock, call, patch

from azure.mgmt.dns.models import (
ARecord,
AaaaRecord,
ARecord,
CaaRecord,
CnameRecord,
MxRecord,
SrvRecord,
NsRecord,
PtrRecord,
TxtRecord,
RecordSet,
SoaRecord,
SrvRecord,
SubResource,
Zone as AzureZone,
TxtRecord,
)
from azure.mgmt.dns.models import Zone as AzureZone
from azure.mgmt.trafficmanager.models import (
Profile,
DnsConfig,
MonitorConfig,
Endpoint,
MonitorConfig,
MonitorConfigCustomHeadersItem,
Profile,
)
from msrestazure.azure_exceptions import CloudError

from octodns.record import Create, Update, Delete, Record
from octodns.zone import Zone
from octodns.provider.base import Plan
from octodns.record import Create, Delete, Record, Update
from octodns.zone import Zone

from octodns_azure import (
_AzureRecord,
AzureException,
AzureProvider,
_AzureRecord,
_check_endswith_dot,
_parse_azure_type,
_root_traffic_manager_name,
_get_monitor,
_parse_azure_type,
_profile_is_match,
AzureException,
_root_traffic_manager_name,
)

zone = Zone(name='unit.tests.', sub_zones=[])
Expand Down

0 comments on commit 1a97ea3

Please sign in to comment.