diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 358993a..a4760be 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,8 +15,8 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: ['3.7', '3.8', '3.9', '3.10'] - django: ['3.2'] + python: ['3.10', '3.11'] + django: ['3.2', '4.2'] binding: ['BROWSER', 'WEBSERVICE'] cmisurlmapping: [ 'False', 'True' ] exclude: @@ -26,8 +26,8 @@ jobs: name: Tests (Py${{ matrix.python }}, Django ${{ matrix.django }}, ${{ matrix.binding }}, URL mapping = ${{ matrix.cmisurlmapping }}) steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} @@ -56,18 +56,18 @@ jobs: if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: - python-version: '3.8' + python-version: '3.10' - name: Build sdist and wheel run: | - pip install pip setuptools wheel --upgrade - python setup.py sdist bdist_wheel + pip install build --upgrade + python -m build - name: Publish a Python distribution to PyPI - uses: pypa/gh-action-pypi-publish@v1.4.1 + uses: pypa/gh-action-pypi-publish@release/v1 with: user: __token__ password: ${{ secrets.PYPI_TOKEN }} diff --git a/.github/workflows/code_quality.yml b/.github/workflows/code_quality.yml index 9d9eff5..f171c7f 100644 --- a/.github/workflows/code_quality.yml +++ b/.github/workflows/code_quality.yml @@ -21,10 +21,10 @@ jobs: matrix: toxenv: [isort, black, flake8] steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: - python-version: '3.7' + python-version: '3.10' - name: Install dependencies run: pip install tox - run: tox diff --git a/drc_cmis/browser/client.py b/drc_cmis/browser/client.py index 81c377c..82b3e74 100644 --- a/drc_cmis/browser/client.py +++ b/drc_cmis/browser/client.py @@ -304,9 +304,9 @@ def create_content_object( if "cmis:objectTypeId" in properties.keys(): json_data["propertyValue[2]"] = properties.pop("cmis:objectTypeId") else: - json_data[ - "propertyValue[2]" - ] = f"{self.get_object_type_id_prefix(object_type)}drc:{object_type}" + json_data["propertyValue[2]"] = ( + f"{self.get_object_type_id_prefix(object_type)}drc:{object_type}" + ) prop_count = 3 for prop_key, prop_value in properties.items(): diff --git a/drc_cmis/client_builder.py b/drc_cmis/client_builder.py index 77a91da..ad4abc6 100644 --- a/drc_cmis/client_builder.py +++ b/drc_cmis/client_builder.py @@ -12,7 +12,7 @@ try: from zgw_consumers.client import get_client_class -except ImportError: +except (ImportError, RuntimeError): def get_client_class() -> Type[Client]: return Client diff --git a/drc_cmis/notifications.py b/drc_cmis/notifications.py index f66072c..986f3f4 100644 --- a/drc_cmis/notifications.py +++ b/drc_cmis/notifications.py @@ -1,6 +1,7 @@ """ Listen to the notifications that are send by the NRC """ + from vng_api_common.notifications.handlers import RoutingHandler, default from drc_cmis.client_builder import get_cmis_client, get_zds_client diff --git a/drc_cmis/utils/convert.py b/drc_cmis/utils/convert.py index 3cbb109..2717d6e 100644 --- a/drc_cmis/utils/convert.py +++ b/drc_cmis/utils/convert.py @@ -37,9 +37,9 @@ def parseDateTimeValue(value): """ Utility function to return a datetime from a string. """ - if type(value) == str: + if isinstance(value, str): return iso8601.parse_date(value) - elif type(value) == int: + elif isinstance(value, int): return datetime.fromtimestamp(value / 1000) else: return None diff --git a/setup.cfg b/setup.cfg index dc39a27..6beb6fa 100644 --- a/setup.cfg +++ b/setup.cfg @@ -12,6 +12,7 @@ classifiers = Development Status :: 5 - Production/Stable Framework :: Django Framework :: Django :: 3.2 + Framework :: Django :: 4.2 Intended Audience :: Developers Operating System :: Unix Operating System :: MacOS @@ -30,7 +31,7 @@ zip_safe = False include_package_data = True packages = find: install_requires = - django>=3.2.0,<4.0 + django>=3.2.0 cmislib-maykin >= 0.7.2.dev0 django-solo iso8601 diff --git a/tox.ini b/tox.ini index 303bca7..402d415 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist = - py{37,38,39,310}-django32-{browser,webservice,urlmapping} + py{310,311}-django{32,42}-{browser,webservice,urlmapping} isort black flake8 @@ -9,22 +9,21 @@ skip_missing_interpreters = true [gh-actions] python = - 3.7: py37 - 3.8: py38 - 3.9: py39 3.10: py310 + 3.11: py311 [gh-actions:env] DJANGO = 3.2: django32 + 4.2: django42 CMIS_BINDING = BROWSER: browser WEBSERVICE: webservice - WEBSERVICE: py{37,38,39,310}-django32-urlmapping + WEBSERVICE: py{310,311}-django{32,42}-urlmapping CMIS_URL_MAPPING_ENABLED = - True: py{37,38,39,310}-django32-urlmapping + True: py{310,311}-django{32,42}-urlmapping [testenv] passenv = @@ -38,12 +37,13 @@ extras = coverage deps = django32: Django~=3.2.0 + django42: Django~=4.2.0 commands = py.test tests/ \ --cov=drc_cmis --cov-report xml:reports/coverage-{envname}.xml \ {posargs} -[testenv:py{37,38,39,310}-django32-urlmapping] +[testenv:py{310,311}-django{32,42}-urlmapping] passenv = CI CMIS_BINDING @@ -56,6 +56,7 @@ extras = coverage deps = django32: Django~=3.2.0 + django42: Django~=4.2.0 commands = py.test tests/ \ --cov=drc_cmis --cov-report xml:reports/coverage-{envname}.xml \