From ec4ade4865073e748757802ef538d446003d1f9e Mon Sep 17 00:00:00 2001 From: Anna Shamray Date: Tue, 9 Apr 2024 16:58:46 +0200 Subject: [PATCH 1/4] :arrow_up: bump django to 4.2, update python to 3.10 --- .github/workflows/ci.yml | 4 ++-- .github/workflows/code_quality.yml | 2 +- drc_cmis/client_builder.py | 2 +- setup.cfg | 3 ++- tox.ini | 15 ++++++++------- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 358993a..5df97a4 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: diff --git a/.github/workflows/code_quality.yml b/.github/workflows/code_quality.yml index 9d9eff5..a88c284 100644 --- a/.github/workflows/code_quality.yml +++ b/.github/workflows/code_quality.yml @@ -24,7 +24,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: - python-version: '3.7' + python-version: '3.10' - name: Install dependencies run: pip install tox - run: tox 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/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 \ From 175da2add82311243b2322983d1e99b2a3fd4bc4 Mon Sep 17 00:00:00 2001 From: Anna Shamray Date: Tue, 9 Apr 2024 17:08:02 +0200 Subject: [PATCH 2/4] :construction_worker: update gh action versions --- .github/workflows/ci.yml | 16 ++++++++-------- .github/workflows/code_quality.yml | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5df97a4..a4760be 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 a88c284..f171c7f 100644 --- a/.github/workflows/code_quality.yml +++ b/.github/workflows/code_quality.yml @@ -21,8 +21,8 @@ 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.10' - name: Install dependencies From c5856180e41d4b8e36f6900e6fc9c348a15ac5c8 Mon Sep 17 00:00:00 2001 From: Anna Shamray Date: Tue, 9 Apr 2024 17:08:38 +0200 Subject: [PATCH 3/4] :green_heart: make flake8 happy --- drc_cmis/utils/convert.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 From 2cd76d3aeaaeb4a3c56cfce58661c8372a4b91a8 Mon Sep 17 00:00:00 2001 From: Anna Shamray Date: Tue, 9 Apr 2024 17:22:15 +0200 Subject: [PATCH 4/4] :green_heart: black --- drc_cmis/browser/client.py | 6 +++--- drc_cmis/notifications.py | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) 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/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