Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pyproject.toml for tooling, add isort management of imports #32

Merged
merged 3 commits into from
Feb 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
@@ -1,2 +1,4 @@
# Commit that added in black formatting support
d299cefe07cf4ff03e88bc74e371bcb7df90328d
# Commit for isort formatting changes
1c93a5de86f6339029ddbe6cfa55a4a223e19d15
7 changes: 4 additions & 3 deletions octodns_powerdns/__init__.py
Expand Up @@ -2,13 +2,14 @@
#
#

from requests import HTTPError, Session
from operator import itemgetter
import logging
from operator import itemgetter

from requests import HTTPError, Session

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

from .record import PowerDnsLuaRecord

Expand Down
2 changes: 1 addition & 1 deletion octodns_powerdns/record.py
@@ -1,5 +1,5 @@
from octodns.record import Record, ValuesMixin
from octodns.equality import EqualityTupleMixin
from octodns.record import Record, ValuesMixin


class _PowerDnsLuaValue(EqualityTupleMixin, dict):
Expand Down
14 changes: 14 additions & 0 deletions pyproject.toml
@@ -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_powerdns"
known_octodns="octodns"
line_length=80
sections="FUTURE,STDLIB,THIRDPARTY,OCTODNS,FIRSTPARTY,LOCALFOLDER"

[tool.pytest.ini_options]
pythonpath = "."
53 changes: 27 additions & 26 deletions requirements-dev.txt
@@ -1,41 +1,42 @@
# 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.8.0
Pygments==2.14.0
attrs==22.2.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
coverage==6.5.0
cmarkgfm==2022.10.27
coverage==7.1.0
docutils==0.19
exceptiongroup==1.0.0rc9
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.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
packaging==21.3
pathspec==0.10.1
pep517==0.13.0
pkginfo==1.8.3
platformdirs==2.5.2
mypy-extensions==1.0.0
packaging==23.0
pathspec==0.11.0
pkginfo==1.9.6
platformdirs==2.6.2
pluggy==1.0.0
pycodestyle==2.9.1
pycodestyle==2.10.0
pycparser==2.21
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
readme-renderer==37.2
pytest==7.2.1
readme-renderer==37.3
requests-mock==1.10.0
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
8 changes: 4 additions & 4 deletions requirements.txt
@@ -1,13 +1,13 @@
# DO NOT EDIT THIS FILE DIRECTLY - use ./script/update-requirements to update
PyYAML==6.0
certifi==2022.12.7
charset-normalizer==2.1.1
dnspython==2.2.1
charset-normalizer==3.0.1
dnspython==2.3.0
fqdn==1.5.1
idna==3.4
natsort==8.2.0
octodns==0.9.21
python-dateutil==2.8.2
requests==2.28.1
requests==2.28.2
six==1.16.0
urllib3==1.26.12
urllib3==1.26.14
2 changes: 0 additions & 2 deletions script/coverage
Expand Up @@ -38,8 +38,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
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
Expand Up @@ -30,6 +30,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
@@ -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',
'pycodestyle>=2.6.0',
'pyflakes>=2.2.0',
'readme_renderer[md]>=26.0',
Expand Down
12 changes: 6 additions & 6 deletions tests/test_octodns_provider_powerdns.py
Expand Up @@ -2,13 +2,15 @@
#
#

from json import loads, dumps
from json import dumps, loads
from logging import getLogger
from os.path import dirname, join
from requests import HTTPError
from requests_mock import ANY, mock as requests_mock
from unittest import TestCase

from requests import HTTPError
from requests_mock import ANY
from requests_mock import mock as requests_mock

from octodns.provider import ProviderException
from octodns.provider.yaml import YamlProvider
from octodns.record import Record, ValidationError
Expand All @@ -19,7 +21,7 @@
PowerDnsProvider,
_escape_unescaped_semicolons,
)
from octodns_powerdns.record import _PowerDnsLuaValue, PowerDnsLuaRecord
from octodns_powerdns.record import PowerDnsLuaRecord, _PowerDnsLuaValue

EMPTY_TEXT = '''
{
Expand Down Expand Up @@ -115,7 +117,6 @@ def test_provider_version_detection(self):
self.assertEqual(provider.powerdns_version, [4, 5, 0])

def test_provider_version_config(self):

# Test version 4.1.0
with requests_mock() as mock:
mock.get(
Expand Down Expand Up @@ -223,7 +224,6 @@ def test_managed_attribute_validation(self):
)

def test_provider(self):

# Test version detection
with requests_mock() as mock:
mock.get(
Expand Down