From dc720acb3324f6fd88accb88ad8d342a9483f985 Mon Sep 17 00:00:00 2001 From: Rob Dennis Date: Wed, 18 Jan 2023 17:06:44 -0500 Subject: [PATCH 1/3] #230 - allow importing validate directly to still work --- setup.py | 6 +++--- src/tests/test_validate.py | 11 +++++++++++ src/validate/__init__.py | 21 +++++++++++++++++++++ 3 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 src/validate/__init__.py diff --git a/setup.py b/setup.py index fcdecc0..f18451c 100644 --- a/setup.py +++ b/setup.py @@ -36,7 +36,7 @@ NAME = 'configobj' MODULES = [] -PACKAGES = ['configobj'] +PACKAGES = ['configobj', 'validate'] DESCRIPTION = 'Config file reading, writing and validation.' URL = 'https://github.com/DiffSK/configobj' @@ -105,7 +105,7 @@ AUTHOR = 'Rob Dennis, Eli Courtwright (Michael Foord & Nicola Larosa original maintainers)' -AUTHOR_EMAIL = 'rdennis+configobj@gmail.com, eli@courtwright.org, fuzzyman@voidspace.co.uk, nico@tekNico.net' +AUTHOR_EMAIL = 'rdennis+configobj@gmail.com, eli@courtwright.org, michael@python.org, nico@tekNico.net' KEYWORDS = "config, ini, dictionary, application, admin, sysadmin, configuration, validation".split(', ') @@ -121,7 +121,7 @@ package_dir={'': 'src'}, packages=PACKAGES, install_requires=[i.strip() for i in REQUIRES.splitlines() if i.strip()], - python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*', + python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*', classifiers=CLASSIFIERS, keywords=KEYWORDS, license='BSD (2 clause)', diff --git a/src/tests/test_validate.py b/src/tests/test_validate.py index 07c1de7..2a19cc8 100644 --- a/src/tests/test_validate.py +++ b/src/tests/test_validate.py @@ -5,6 +5,17 @@ from configobj.validate import Validator, VdtValueTooSmallError +class TestImporting(object): + def test_top_level(self): + import validate + + def test_within_configobj_using_from(self): + from configobj import validate + + def test_within_configobj(self): + import configobj.validate + + class TestBasic(object): def test_values_too_small(self, val): config = ''' diff --git a/src/validate/__init__.py b/src/validate/__init__.py new file mode 100644 index 0000000..c3bbcd3 --- /dev/null +++ b/src/validate/__init__.py @@ -0,0 +1,21 @@ +""" +This is a backwards compatibility-shim to support: + + ``` + import validate + ``` + + in a future release, we'd expect this to no longer work and + instead using: + + ``` + import configobj.validate + ``` + + or: + + ``` + from configobj import validate + ``` +""" +import configobj.validate as validate From 17ff246e028c32ff23d85a04962b8e82ab33b32b Mon Sep 17 00:00:00 2001 From: Rob Dennis Date: Wed, 18 Jan 2023 17:17:28 -0500 Subject: [PATCH 2/3] #230 - changed how validate shim import is done and the associated unit test --- src/configobj/validate.py | 1 - src/tests/test_validate.py | 11 +++++++---- src/validate/__init__.py | 3 ++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/configobj/validate.py b/src/configobj/validate.py index b7a964c..9267a3f 100644 --- a/src/configobj/validate.py +++ b/src/configobj/validate.py @@ -158,7 +158,6 @@ 'is_ip_addr_list', 'is_mixed_list', 'is_option', - '__docformat__', ) diff --git a/src/tests/test_validate.py b/src/tests/test_validate.py index 2a19cc8..2d72821 100644 --- a/src/tests/test_validate.py +++ b/src/tests/test_validate.py @@ -6,14 +6,17 @@ class TestImporting(object): - def test_top_level(self): + def test_top_level(self, val): import validate - - def test_within_configobj_using_from(self): + assert val.__class__ is validate.Validator + + def test_within_configobj_using_from(self, val): from configobj import validate + assert val.__class__ is validate.Validator - def test_within_configobj(self): + def test_within_configobj(self, val): import configobj.validate + assert val.__class__ is configobj.validate.Validator class TestBasic(object): diff --git a/src/validate/__init__.py b/src/validate/__init__.py index c3bbcd3..7a88747 100644 --- a/src/validate/__init__.py +++ b/src/validate/__init__.py @@ -18,4 +18,5 @@ from configobj import validate ``` """ -import configobj.validate as validate +from configobj.validate import * + From 97325b9f65cdc2883ab36e305778fdb58205d4ce Mon Sep 17 00:00:00 2001 From: Rob Dennis Date: Wed, 18 Jan 2023 17:23:53 -0500 Subject: [PATCH 3/3] #230 - prepping for a 5.0.8 tag --- CHANGES.rst | 6 ++++++ docs/configobj.rst | 6 ++++++ setup.cfg | 4 ++-- src/configobj/_version.py | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 86e4fb1..a39a1d4 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,12 @@ Changelog --------- +Release 5.0.8 +""""""""""""" + +* fixing/test for a regression introduced in 5.0.7 that prevented ``import validate`` from working + + Release 5.0.7 """"""""""""" diff --git a/docs/configobj.rst b/docs/configobj.rst index 66005d3..1463bd7 100644 --- a/docs/configobj.rst +++ b/docs/configobj.rst @@ -2383,6 +2383,12 @@ CHANGELOG This is an abbreviated changelog showing the major releases up to version 4. From version 4 it lists all releases and changes. +2023/01/18 - Version 5.0.8 +-------------------------- + +* fixing/test for a regression introduced in 5.0.7 that prevented ``import validate`` from working + + 2023/01/17 - Version 5.0.7 -------------------------- diff --git a/setup.cfg b/setup.cfg index fccba36..a94f058 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,12 +3,12 @@ # [egg_info] -tag_build = .dev0 +#tag_build = .dev0 tag_date = false [sdist] -formats = zip, gztar +formats = gztar [bdist_wheel] diff --git a/src/configobj/_version.py b/src/configobj/_version.py index 3379d0a..f9d71a5 100644 --- a/src/configobj/_version.py +++ b/src/configobj/_version.py @@ -1 +1 @@ -__version__ = '5.0.7' \ No newline at end of file +__version__ = '5.0.8' \ No newline at end of file