From 8e713505f51053c148ce95fda7923eb4232f0df1 Mon Sep 17 00:00:00 2001 From: Tom Morrell Date: Mon, 8 Jul 2024 09:21:51 +0200 Subject: [PATCH 1/3] ci: update ci pipeline --- .github/workflows/tests.yml | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 477f0fe..8fc21b0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,9 +1,10 @@ # -*- coding: utf-8 -*- # -# This file is part of Invenio. -# Copyright (C) 2020 CERN. +# Copyright (C) 2020-2024 CERN. +# Copyright (C) 2020 Northwestern University. +# Copyright (C) 2022 Graz University of Technology. # -# Invenio is free software; you can redistribute it and/or modify it +# Datacite is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. name: CI @@ -15,21 +16,21 @@ on: branches: master schedule: # * is a special character in YAML so you have to quote this string - - cron: '0 3 * * 6' + - cron: "0 3 * * 6" workflow_dispatch: inputs: reason: - description: 'Reason' + description: "Reason" required: false - default: 'Manual trigger' + default: "Manual trigger" jobs: Tests: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: - python-version: [3.8, 3.9] - requirements-level: [pypi] + python-version: [3.9, 3.12] steps: - name: Checkout @@ -39,24 +40,15 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - - name: Generate dependencies - run: | - pip install wheel requirements-builder - requirements-builder -e all --level=${{ matrix.requirements-level }} setup.py > .${{ matrix.requirements-level }}-${{ matrix.python-version }}-requirements.txt - - - name: Cache pip - uses: actions/cache@v4 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('.${{ matrix.requirements-level }}-${{ matrix.python-version }}-requirements.txt') }} + cache: pip + cache-dependency-path: setup.cfg - name: Install dependencies run: | - pip install -r .${{ matrix.requirements-level }}-${{ matrix.python-version }}-requirements.txt pip install .[all] pip freeze - name: Run tests - run: | - ./run-tests.sh + run: ./run-tests.sh + + From 97b0990f3aa16195f3d76c98014f19fe9f1e215e Mon Sep 17 00:00:00 2001 From: Tom Morrell Date: Mon, 8 Jul 2024 09:41:50 +0200 Subject: [PATCH 2/3] package: replace pkg_resources with importlib --- datacite/schema31.py | 5 +++-- datacite/schema40.py | 5 +++-- datacite/schema41.py | 5 +++-- datacite/schema42.py | 5 +++-- datacite/schema43.py | 5 +++-- setup.cfg | 1 + 6 files changed, 16 insertions(+), 10 deletions(-) diff --git a/datacite/schema31.py b/datacite/schema31.py index cc5a054..acc0354 100644 --- a/datacite/schema31.py +++ b/datacite/schema31.py @@ -10,7 +10,8 @@ """DataCite v3.1 JSON to XML transformations.""" -import pkg_resources +import importlib.resources as importlib_resources + from lxml import etree from lxml.builder import E @@ -37,7 +38,7 @@ } validator = validator_factory( - pkg_resources.resource_filename("datacite", "schemas/datacite-v3.1.json") + importlib_resources.files("datacite") / "schemas/datacite-v3.1.json" ) diff --git a/datacite/schema40.py b/datacite/schema40.py index e19927b..baae170 100644 --- a/datacite/schema40.py +++ b/datacite/schema40.py @@ -10,7 +10,8 @@ """DataCite v4.0 JSON to XML transformations.""" -import pkg_resources +import importlib.resources as importlib_resources + from lxml import etree from lxml.builder import E @@ -37,7 +38,7 @@ } validator = validator_factory( - pkg_resources.resource_filename("datacite", "schemas/datacite-v4.0.json") + importlib_resources.files("datacite") / "schemas/datacite-v4.0.json" ) diff --git a/datacite/schema41.py b/datacite/schema41.py index 66fd165..6f26b59 100644 --- a/datacite/schema41.py +++ b/datacite/schema41.py @@ -10,7 +10,8 @@ """DataCite v4.1 JSON to XML transformations.""" -import pkg_resources +import importlib.resources as importlib_resources + from lxml import etree from lxml.builder import E @@ -37,7 +38,7 @@ } validator = validator_factory( - pkg_resources.resource_filename("datacite", "schemas/datacite-v4.1.json") + importlib_resources.files("datacite") / "schemas/datacite-v4.1.json" ) diff --git a/datacite/schema42.py b/datacite/schema42.py index bb57476..9a245ed 100644 --- a/datacite/schema42.py +++ b/datacite/schema42.py @@ -11,7 +11,8 @@ """DataCite v4.2 JSON to XML transformations.""" -import pkg_resources +import importlib.resources as importlib_resources + from lxml import etree from lxml.builder import E @@ -38,7 +39,7 @@ } validator = validator_factory( - pkg_resources.resource_filename("datacite", "schemas/datacite-v4.2.json") + importlib_resources.files("datacite") / "schemas/datacite-v4.2.json" ) diff --git a/datacite/schema43.py b/datacite/schema43.py index 5bef9f0..19511f8 100644 --- a/datacite/schema43.py +++ b/datacite/schema43.py @@ -11,7 +11,8 @@ """DataCite v4.3 JSON to XML transformations.""" -import pkg_resources +import importlib.resources as importlib_resources + from lxml import etree from lxml.builder import E @@ -38,7 +39,7 @@ } validator = validator_factory( - pkg_resources.resource_filename("datacite", "schemas/datacite-v4.3.json") + importlib_resources.files("datacite") / "schemas/datacite-v4.3.json" ) diff --git a/setup.cfg b/setup.cfg index eabb17b..3fbbebb 100644 --- a/setup.cfg +++ b/setup.cfg @@ -34,6 +34,7 @@ install_requires = lxml>=4.5.2 requests>=2.12.2 idutils>=1.0.0 + importlib-metadata>=6.11.0 [options.extras_require] tests = From eb31d24981e60acf79f19482ec8e6bb00f5e7c08 Mon Sep 17 00:00:00 2001 From: Tom Morrell Date: Tue, 6 Aug 2024 08:00:09 -0700 Subject: [PATCH 3/3] Update .github/workflows/tests.yml Co-authored-by: Alex Ioannidis --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8fc21b0..94a5f0b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -30,7 +30,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.9, 3.12] + python-version: ["3.9", "3.12"] steps: - name: Checkout