diff --git a/requirements-dev.txt b/requirements-dev.txt index 2331aad..49b8f4c 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,10 +1,42 @@ +Pygments==2.11.2 +attrs==21.4.0 +bleach==4.1.0 build==0.7.0 -coverage -mock -pycodestyle==2.6.0 -pyflakes==2.2.0 -pytest -pytest-network -readme_renderer[md]==26.0 -requests_mock -twine==3.4.2 +certifi==2021.10.8 +cffi==1.15.0 +charset-normalizer==2.0.10 +cmarkgfm==0.6.0 +colorama==0.4.4 +coverage==6.3 +docutils==0.18.1 +idna==3.3 +importlib-metadata==4.10.1 +iniconfig==1.1.1 +keyring==23.5.0 +packaging==21.3 +pep517==0.12.0 +pkginfo==1.8.2 +pluggy==1.0.0 +pprintpp==0.4.0 +py==1.11.0 +pycodestyle==2.8.0 +pycountry-convert==0.7.2 +pycparser==2.21 +pyflakes==2.4.0 +pyparsing==3.0.7 +pytest-cov==3.0.0 +pytest-mock==3.7.0 +pytest-network==0.0.1 +pytest==6.2.5 +readme-renderer==32.0 +repoze.lru==0.7 +requests-toolbelt==0.9.1 +requests==2.27.1 +rfc3986==2.0.0 +toml==0.10.2 +tomli==2.0.0 +tqdm==4.62.3 +twine==3.7.1 +urllib3==1.26.8 +webencodings==0.5.1 +zipp==3.7.0 diff --git a/requirements.txt b/requirements.txt index 653572a..0d9b90a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,11 +1,7 @@ -PyYaml==5.4 -dnspython==1.16.0 -docutils==0.16 -fqdn==1.5.0 -jmespath==0.10.0 -natsort==6.2.1 -pycountry-convert==0.7.2 +PyYAML==6.0 +dnspython==2.2.0 +fqdn==1.5.1 +natsort==8.0.2 pycountry==22.1.10 -python-dateutil==2.8.1 -requests==2.25.1 -setuptools==60.5.0 +python-dateutil==2.8.2 +six==1.16.0 diff --git a/script/update-requirements b/script/update-requirements new file mode 100755 index 0000000..e3d9ab2 --- /dev/null +++ b/script/update-requirements @@ -0,0 +1,52 @@ +#!/usr/bin/env python + +from os.path import join +from subprocess import check_call, check_output +from tempfile import TemporaryDirectory +import re + + +def print_packages(packages, heading): + print(f'{heading}:') + print(' ', end='') + print('\n '.join(packages)) + + +# would be nice if there was a cleaner way to get this, but I've not found a +# more reliable one. +with open('setup.py') as fh: + match = re.search(r"name='(?P[\w-]+)',", fh.read()) + if not match: + raise Exception('failed to determine our package name') + our_package_name = match.group('pkg') + print(f'our_package_name: {our_package_name}') + +with TemporaryDirectory() as tmpdir: + check_call(['python3', '-m', 'venv', tmpdir]) + + # base needs + check_call([join(tmpdir, 'bin', 'pip'), 'install', '.']) + frozen = check_output([join(tmpdir, 'bin', 'pip'), 'freeze']) + frozen = set(frozen.decode('utf-8').strip().split('\n')) + + # dev additions + check_call([join(tmpdir, 'bin', 'pip'), 'install', '.[dev]']) + dev_frozen = check_output([join(tmpdir, 'bin', 'pip'), 'freeze']) + dev_frozen = set(dev_frozen.decode('utf-8').strip().split('\n')) - frozen + +# pip installs the module itself along with deps so we need to get that out of +# our list by finding the thing that was file installed during dev +frozen = sorted([p for p in frozen if not p.startswith(our_package_name)]) +dev_frozen = sorted([p for p in dev_frozen + if not p.startswith(our_package_name)]) + +print_packages(frozen, 'frozen') +print_packages(dev_frozen, 'dev_frozen') + +with open('requirements.txt', 'w') as fh: + fh.write('\n'.join(frozen)) + fh.write('\n') + +with open('requirements-dev.txt', 'w') as fh: + fh.write('\n'.join(dev_frozen)) + fh.write('\n') diff --git a/setup.py b/setup.py index 2560c0b..eb97c92 100644 --- a/setup.py +++ b/setup.py @@ -55,6 +55,11 @@ def long_description(): return buf.getvalue() +tests_require = ( + 'pytest>=6.2.5', + 'pytest-network>=0.0.1', +) + setup( author='Ross McFarland', author_email='rwmcfa1@gmail.com', @@ -62,26 +67,31 @@ setup( entry_points={ 'console_scripts': console_scripts, }, - install_requires=[ + extras_require={ + 'dev': tests_require + ( + 'build>=0.7.0', + 'pycodestyle>=2.6.0', + 'pycountry-convert>=0.7.2', + 'pyflakes>=2.2.0', + 'readme_renderer[md]>=26.0', + 'twine>=3.4.2', + ), + }, + install_requires=( 'PyYaml>=4.2b1', 'dnspython>=1.15.0', 'fqdn>=1.5.0', 'natsort>=5.5.0', 'pycountry>=19.8.18', - 'pycountry-convert>=0.7.2', 'python-dateutil>=2.8.1', - 'requests>=2.20.0' - ], + ), license='MIT', long_description=long_description(), long_description_content_type='text/markdown', name='octodns', packages=find_packages(), python_requires='>=3.6', + tests_require=tests_require, url='https://github.com/octodns/octodns', version=octodns.__VERSION__, - tests_require=( - 'pytest', - 'pytest-network', - ), ) diff --git a/tests/test_octodns_manager.py b/tests/test_octodns_manager.py index ce171bd..06ec7ca 100644 --- a/tests/test_octodns_manager.py +++ b/tests/test_octodns_manager.py @@ -15,8 +15,8 @@ from octodns.record import Create, Delete, Record from octodns.yaml import safe_load from octodns.zone import Zone -from mock import MagicMock, patch from unittest import TestCase +from unittest.mock import MagicMock, patch from helpers import DynamicProvider, GeoProvider, NoSshFpProvider, \ PlannableProvider, SimpleProvider, TemporaryDirectory diff --git a/tests/test_octodns_provider_base.py b/tests/test_octodns_provider_base.py index 7f4be9e..bd6c361 100644 --- a/tests/test_octodns_provider_base.py +++ b/tests/test_octodns_provider_base.py @@ -6,8 +6,8 @@ from __future__ import absolute_import, division, print_function, \ unicode_literals from logging import getLogger -from mock import MagicMock, call from unittest import TestCase +from unittest.mock import MagicMock, call from octodns.processor.base import BaseProcessor from octodns.provider import SupportsException diff --git a/tests/test_octodns_source_axfr.py b/tests/test_octodns_source_axfr.py index 5a01ca5..9e34d06 100644 --- a/tests/test_octodns_source_axfr.py +++ b/tests/test_octodns_source_axfr.py @@ -8,10 +8,10 @@ from __future__ import absolute_import, division, print_function, \ import dns.zone from dns.exception import DNSException -from mock import patch from os.path import exists from shutil import copyfile from unittest import TestCase +from unittest.mock import patch from octodns.source.axfr import AxfrSource, AxfrSourceZoneTransferFailed, \ ZoneFileSource, ZoneFileSourceLoadFailure diff --git a/tests/test_octodns_source_envvar.py b/tests/test_octodns_source_envvar.py index f752821..775b541 100644 --- a/tests/test_octodns_source_envvar.py +++ b/tests/test_octodns_source_envvar.py @@ -1,5 +1,5 @@ -from mock import patch from unittest import TestCase +from unittest.mock import patch from octodns.source.envvar import EnvVarSource from octodns.source.envvar import EnvironmentVariableNotFoundException