diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f1723d7772df9d8b0ad5fe6c0551619aebb38da5..aafc3d28746043e09d343dd85a27db17b51297ee 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,6 @@ # Official language image. Look for the different tagged releases at: # https://hub.docker.com/r/library/python/tags/ -image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/python:3.6 +image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/python:latest # Change pip's cache directory to be inside the project directory since we can # only cache local items. @@ -15,7 +15,6 @@ variables: cache: paths: - .cache/pip - - venv/ before_script: - pip install virtualenv @@ -26,14 +25,57 @@ before_script: stages: # List of stages for jobs, and their order of execution - test + - check-warnings - build - deploy -unit-test-job: +unit-test-job: + stage: test + script: + - make test 2>&1 | tee errors.log + artifacts: + when: always + paths: + - errors.log + reports: + junit: nose2-junit.xml + +unit-test-2.7-job: + image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/python:2.7 stage: test script: - make test +unit-test-3.7-job: + image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/python:3.7 + stage: test + script: + - make test 2>&1 | tee errors-3.7.log + artifacts: + when: always + paths: + - errors-3.7.log + +unit-test-3.8-job: + image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/python:3.8 + stage: test + script: + - make test 2>&1 | tee errors-3.8.log + artifacts: + when: always + paths: + - errors-3.8.log + +unit-test-3.9-job: + image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/python:3.9 + stage: test + script: + - make test 2>&1 | tee errors-3.9.log + artifacts: + when: always + paths: + - errors-3.9.log + pylint-test-job: stage: test script: @@ -44,6 +86,34 @@ pyflakes-test-job: script: - make pyflakes +check-deprecation-warnings: + before_script: [] + stage: check-warnings + script: + - "if [[ $(grep DeprecationWarning errors.log) ]]; then cat errors.log; exit 1; fi" + allow_failure: true + +check-deprecation-warnings-3.7: + before_script: [] + stage: check-warnings + script: + - "if [[ $(grep DeprecationWarning errors-3.7.log) ]]; then cat errors-3.7.log; exit 1; fi" + allow_failure: true + +check-deprecation-warnings-3.8: + before_script: [] + stage: check-warnings + script: + - "if [[ $(grep DeprecationWarning errors-3.8.log) ]]; then cat errors-3.8.log; exit 1; fi" + allow_failure: true + +check-deprecation-warnings-3.9: + before_script: [] + stage: check-warnings + script: + - "if [[ $(grep DeprecationWarning errors-3.9.log) ]]; then cat errors-3.9.log; exit 1; fi" + allow_failure: true + build-job: stage: build script: @@ -105,4 +175,4 @@ pages: - public only: - master - - devel \ No newline at end of file + - devel diff --git a/Makefile b/Makefile index 119d038fa7e4901144fceafdbe5ba76eb6995149..6a07d0874e900a5099cdccd5a0c3179f65d630f1 100644 --- a/Makefile +++ b/Makefile @@ -98,7 +98,7 @@ help: show-version: FORCE - @PYTHONPATH=lib python3 -c "import typedcols; print(typedcols.__version__);" + @PYTHONPATH=lib python -c "import typedcols; print(typedcols.__version__);" #------------------------------------------------------------------------------- @@ -108,13 +108,13 @@ deps: deps-python deps-python-dev deps-python-dev: FORCE @echo "\n$(GREEN)*** Installing Python development dependencies ***$(NC)\n" - @pip3 --version - @pip3 install -r requirements-dev.pip + @pip --version + @pip install -r requirements-dev.pip deps-python: FORCE @echo "\n${GREEN}*** Installing Python dependencies ***${NC}\n" @echo "\nThis project does not have any dependencies, nothing to do here...\n" - @#pip3 install -r requirements.pip --upgrade + @#pip install -r requirements.pip --upgrade #------------------------------------------------------------------------------- @@ -138,11 +138,11 @@ pyflakes: pyflakes-lib: FORCE @echo "\n${GREEN}*** Checking code with pyflakes ***${NC}\n" - -@python3 -m pyflakes typedcols.py + -@python -m pyflakes typedcols.py pyflakes-test: FORCE @echo "\n${GREEN}*** Checking test files with pyflakes ***${NC}\n" - -@python3 -m pyflakes test_typedcols.py + -@python -m pyflakes test_typedcols.py #pylint: pylint-lib pylint-test pylint: @@ -150,15 +150,15 @@ pylint: pylint-lib: FORCE @echo "\n${GREEN}*** Checking code with pylint ***${NC}\n" - -@python3 -m pylint typedcols.py --rcfile .pylintrc-lib + -@python -m pylint typedcols.py --rcfile .pylintrc-lib pylint-test: FORCE @echo "\n${GREEN}*** Checking test files with pylint ***${NC}\n" - -@python3 -m pylint test_typedcols.py --rcfile .pylintrc-test + -@python -m pylint test_typedcols.py --rcfile .pylintrc-test test: FORCE @echo "\n${GREEN}*** Checking code with nosetests ***${NC}\n" - @nosetests test_typedcols.py + @python -W always::DeprecationWarning -m nose2 --junit-xml #------------------------------------------------------------------------------- @@ -172,11 +172,11 @@ archive: FORCE bdist: FORCE @echo "\n${GREEN}*** Building Python packages ***${NC}\n" - @python3 setup.py sdist bdist_wheel --universal + @python setup.py sdist bdist_wheel --universal install: FORCE @echo "\n${GREEN}*** Performing local installation ***${NC}\n" - @pip3 install dist/typedcols*.whl --upgrade + @pip install dist/typedcols*.whl --upgrade deploy: FORCE @echo "\n${GREEN}*** Deploying packages to PyPI ***${NC}\n" diff --git a/README.rst b/README.rst index 24b42bdc15fc84f11dcc2c1d633062985eae5dc2..1c0de2b53590ab6579ce8534709f1e34afb4f51b 100644 --- a/README.rst +++ b/README.rst @@ -22,3 +22,18 @@ Copyright | Author: Pavel Kácha <pavel.kacha@cesnet.cz> | Use of this package is governed by the ISC license, see LICENSE file. | + + +Changelog +-------------------------------------------------------------------------------- + + +Version 0.1.14 +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Released 2022-06-27 + +- Added a config file for GitLab CI/CD. +- Fixed deprecation warnings for Python 3.7+ regarding ``collections.abc`` +- Updated the repository information. +- Updated packages versions. diff --git a/nose2.cfg b/nose2.cfg new file mode 100644 index 0000000000000000000000000000000000000000..a7850f000fd8fb9a4b96d43d4bb81e8122cdc388 --- /dev/null +++ b/nose2.cfg @@ -0,0 +1,2 @@ +[unittest] +plugins = nose2.plugins.junitxml diff --git a/requirements-dev.pip b/requirements-dev.pip index e92d9cb3c7fc873c0b1fe2936e839410bac9f1ed..67caa2415dccb8ca41123a036f0e606d547b4c1d 100644 --- a/requirements-dev.pip +++ b/requirements-dev.pip @@ -2,8 +2,8 @@ setuptools wheel twine docutils<0.18 -nose==1.3.7 -pyflakes==2.1.0 -pylint==2.2.2 -sphinx==1.8.4 -sphinx-rtd-theme==0.4.2 +nose2 +pyflakes +pylint +sphinx +sphinx-rtd-theme diff --git a/setup.py b/setup.py index a3a333c20a1a59a80208d0c3cf186ab37c2800fa..e13dfcc201623142dc1807496b87cfcf908c0fde 100644 --- a/setup.py +++ b/setup.py @@ -46,14 +46,14 @@ setup( 'Programming Language :: Python', ], keywords = 'library', - url = 'https://homeproj.cesnet.cz/git/typedcols.git', + project_urls={ + 'Documentation': 'https://709.gitlab-pages.cesnet.cz/warden/typedcols/master/html/manual.html', + 'Source': 'https://gitlab.cesnet.cz/709/warden/typedcols', + 'Tracker': 'https://gitlab.cesnet.cz/709/warden/typedcols/-/issues', + }, author = 'Pavel Kacha', author_email = 'pavel.kacha@cesnet.cz', license = 'ISC', py_modules = ['typedcols'], - test_suite = 'nose.collector', - tests_require = [ - 'nose' - ], zip_safe = True ) diff --git a/typedcols.py b/typedcols.py index 30ebccd3b2cff8612e23c90700f37433613a98f0..9db4dd70728e486bb96dfdeb7e299b08dd808135 100644 --- a/typedcols.py +++ b/typedcols.py @@ -10,10 +10,15 @@ Defines TypedDict and TypedList, which enforce inserted types based on simple type definition. """ -__version__ = '0.1.13' +__version__ = '0.1.14' __author__ = 'Pavel Kácha <pavel.kacha@cesnet.cz>' -import collections +try: # Python 2 + from collections.abc import MutableMapping + from collections.abc import MutableSequence +except ImportError: # Python 3 + from collections import MutableMapping + from collections import MutableSequence import abc @@ -61,7 +66,7 @@ class TypedDictMetaclass(abc.ABCMeta): dictify_typedef(cls.typedef) -class TypedDict(collections.MutableMapping): +class TypedDict(MutableMapping): """ Dictionary type abstract class, which supports checking of inserted types, based on simple type definition. @@ -222,7 +227,7 @@ class TypedDict(collections.MutableMapping): TypedDict = TypedDictMetaclass("TypedDict", (TypedDict,), {}) -class TypedList(collections.MutableSequence): +class TypedList(MutableSequence): """ List type abstract class, which supports checking of inserted items type.