From 0514259e7e5cafec7caf08e02ec26335917d9cff Mon Sep 17 00:00:00 2001 From: Christoph Ladurner Date: Sat, 30 Nov 2024 16:28:40 +0100 Subject: [PATCH 1/5] setup: bump major dependencies --- setup.cfg | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/setup.cfg b/setup.cfg index 440f3491..89329f13 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,7 +3,7 @@ # This file is part of Invenio. # Copyright (C) 2015-2022 CERN. # Copyright (C) 2021 TU Wien. -# Copyright (C) 2022 Graz University of Technology. +# Copyright (C) 2022-2024 Graz University of Technology. # # Invenio is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. @@ -29,8 +29,8 @@ python_requires = >=3.7 zip_safe = False install_requires = arrow>=0.16.0 - invenio-celery>=1.2.4,<2.0.0 - invenio-i18n>=2.0.0,<3.0.0 + invenio-celery>=2.0.0,<3.0.0 + invenio-i18n>=3.0.0,<4.0.0 jsonpatch>=1.26 jsonref>=0.2 jsonresolver>=0.3.1 @@ -38,19 +38,19 @@ install_requires = [options.extras_require] tests = - pytest-black>=0.3.0 + pytest-black-ng>=0.4.0 invenio-admin>=1.4.0,<2.0.0 - pytest-invenio>=2.1.0,<3.0.0 + pytest-invenio>=3.0.0,<4.0.0 pytest-mock>=1.6.0 sphinx>=4.5.0 admin = invenio-admin>=1.2.1,<2.0.0 mysql = - invenio-db[mysql,versioning]>=1.0.14,<2.0.0 + invenio-db[mysql,versioning]>=2.0.0,<3.0.0 postgresql = - invenio-db[postgresql,versioning]>=1.0.14,<2.0.0 + invenio-db[postgresql,versioning]>=2.0.0,<3.0.0 sqlite = - invenio-db[versioning]>=1.0.14,<2.0.0 + invenio-db[versioning]>=2.0.0,<3.0.0 docs = # Kept for backwards compatibility From 03f61861c4ac7c9595238385e4b2bd54a9fcc118 Mon Sep 17 00:00:00 2001 From: Christoph Ladurner Date: Wed, 4 Dec 2024 23:43:37 +0100 Subject: [PATCH 2/5] setup: change to reusable workflows --- .github/workflows/pypi-publish.yml | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index f548c54e..68d519ff 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -7,26 +7,7 @@ on: jobs: Publish: - runs-on: ubuntu-20.04 - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: 3.7 - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel babel - - name: Build package - run: | - python setup.py compile_catalog sdist bdist_wheel - - name: Publish on PyPI - uses: pypa/gh-action-pypi-publish@v1.3.1 - with: - user: __token__ - # The token is provided by the inveniosoftware organization - password: ${{ secrets.pypi_token }} + uses: inveniosoftware/workflows/.github/workflows/pypi-publish.yml@master + secrets: inherit + with: + babel-compile-catalog: true From 0d41da181f0c9f5cdfe789b080a844dd21bed19e Mon Sep 17 00:00:00 2001 From: Christoph Ladurner Date: Thu, 5 Dec 2024 13:57:41 +0100 Subject: [PATCH 3/5] fix: IndexError: negative indexes not allowed * IndexError: negative indexes are not accepted by SQL index / slice operators * sqlalchemy >= 2.0.0 removed the possibility to have negative indices --- invenio_records/api.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/invenio_records/api.py b/invenio_records/api.py index 0fce2bb0..c19de11e 100644 --- a/invenio_records/api.py +++ b/invenio_records/api.py @@ -544,7 +544,7 @@ def revert(self, revision_id): if self.model is None: raise MissingModelError() - revision = self.revisions[revision_id] + revision = list(self.revisions)[revision_id] with db.session.begin_nested(): if self.send_signals: @@ -635,7 +635,7 @@ def __getitem__(self, revision_id): instances having to be updated.) """ if revision_id < 0: - return RecordRevision(self.model.versions[revision_id]) + return RecordRevision(list(self.model.versions)[revision_id]) try: return RecordRevision( self.model.versions.filter_by(version_id=revision_id + 1).one() @@ -654,4 +654,9 @@ def __contains__(self, revision_id): def __reversed__(self): """Allows to use reversed operator.""" for version_index in range(self.model.versions.count()): - yield RecordRevision(self.model.versions[-(version_index + 1)]) + versions = ( + list(self.model.versions) + if -(version_index + 1) < 0 + else self.model.versions + ) + yield RecordRevision(versions[-(version_index + 1)]) From 70df098a66dbe628e21517fb503b44e105ca4c28 Mon Sep 17 00:00:00 2001 From: Christoph Ladurner Date: Thu, 5 Dec 2024 14:09:50 +0100 Subject: [PATCH 4/5] fix: docs reference target not found --- docs/conf.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 1af0dcbc..5cb6cb5a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -2,7 +2,7 @@ # # This file is part of Invenio. # Copyright (C) 2015-2018 CERN. -# Copyright (C) 2022 Graz University of Technology. +# Copyright (C) 2022-2024 Graz University of Technology. # # Invenio is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. @@ -337,5 +337,8 @@ ( "py:class", "invenio_records.systemfields.relations.modelrelations.ModelRelationResult", - ), # noqa + ), + ("py:class", "t.ClassVar"), + ("py:class", "Query"), + ("py:attr", "query_class"), # noqa ] From 35582bffe957353eb3573f0b5f9b7d9ff8dba5cc Mon Sep 17 00:00:00 2001 From: Christoph Ladurner Date: Thu, 5 Dec 2024 13:58:57 +0100 Subject: [PATCH 5/5] release: v3.0.0 --- CHANGES.rst | 7 +++++++ invenio_records/__init__.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 90f5a3ed..12cf9a16 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,7 @@ .. This file is part of Invenio. Copyright (C) 2015-2024 CERN. + Copyright (C) 2024 Graz University of Technology. Invenio is free software; you can redistribute it and/or modify it under the terms of the MIT License; see LICENSE file for more details. @@ -8,6 +9,12 @@ Changes ======= +Version 3.0.0 (released 2024-12-05) + +- fix: IndexError: negative indexes not allowed +- setup: change to reusable workflows +- setup: bump major dependencies + Version v2.4.1 (released 2024-11-05) - model: make forward compatible to sqlalchemy >= 2 diff --git a/invenio_records/__init__.py b/invenio_records/__init__.py index 3e52f8c2..22a61292 100644 --- a/invenio_records/__init__.py +++ b/invenio_records/__init__.py @@ -332,7 +332,7 @@ from .api import Record from .ext import InvenioRecords -__version__ = "2.4.1" +__version__ = "3.0.0" __all__ = ( "InvenioRecords",