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 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/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 ] 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", 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)]) 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