Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Python 3.13 #120

Merged
merged 5 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
test:
name: "Test Python ${{ matrix.python-version }}"
runs-on: "ubuntu-22.04"
runs-on: "ubuntu-24.04"
strategy:
fail-fast: false
matrix:
Expand All @@ -18,6 +18,7 @@ jobs:
"3.10",
"3.11",
"3.12",
"3.13",
]
steps:
- name: "Check out repository"
Expand All @@ -33,10 +34,10 @@ jobs:
- name: "Install tox"
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
pip install tox
- name: "Run tox"
run: |
tox -- --cov metsrw --cov-report xml:coverage.xml
tox -e py -- --cov metsrw --cov-report xml:coverage.xml
- name: "Upload coverage report"
if: github.repository == 'artefactual-labs/mets-reader-writer'
uses: "codecov/codecov-action@v4"
Expand All @@ -48,14 +49,14 @@ jobs:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
lint:
name: "Lint"
runs-on: "ubuntu-22.04"
runs-on: "ubuntu-24.04"
steps:
- name: "Check out repository"
uses: "actions/checkout@v4"
- name: "Set up Python"
uses: "actions/setup-python@v5"
with:
python-version: "3.12"
python-version: "3.x"
cache: "pip"
cache-dependency-path: |
requirements.txt
Expand All @@ -69,14 +70,14 @@ jobs:
tox -e linting
docs:
name: "Docs"
runs-on: "ubuntu-22.04"
runs-on: "ubuntu-24.04"
steps:
- name: "Check out repository"
uses: "actions/checkout@v3"
- name: "Set up Python"
uses: "actions/setup-python@v5"
with:
python-version: "3.12"
python-version: "3.x"
cache-dependency-path: |
requirements.txt
requirements-dev.txt
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.5
rev: v0.9.1
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,8 @@ METSRW can be installed with pip.

`pip install metsrw`

METSRW has been tested with:

* Python 3.9
* Python 3.10
* Python 3.11
* Python 3.12
METSRW is tested with the all the [supported versions](https://devguide.python.org/versions/#supported-versions)
of Python.

## Basic Usage

Expand Down
6 changes: 3 additions & 3 deletions metsrw/di.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
provider if it is callable.
"""
if not self.allow_replace:
assert (
feature_name not in self.providers
), f"Duplicate feature: {feature_name!r}"
assert feature_name not in self.providers, (

Check warning on line 43 in metsrw/di.py

View check run for this annotation

Codecov / codecov/patch

metsrw/di.py#L43

Added line #L43 was not covered by tests
f"Duplicate feature: {feature_name!r}"
)
if callable(provider) and not isinstance(provider, type):
self.providers[feature_name] = lambda: provider(*args, **kwargs)
else:
Expand Down
2 changes: 1 addition & 1 deletion metsrw/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ def parse(cls, root):
target = utils.urldecode(target)
except ValueError:
raise exceptions.ParseError(
f'Value "{target}" (of attribute xlink:href) is not a valid' " URL."
f'Value "{target}" (of attribute xlink:href) is not a valid URL.'
)
loctype = root.get("LOCTYPE")
if not loctype:
Expand Down
2 changes: 1 addition & 1 deletion metsrw/mets.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ def _analyze_fptr(fptr_elem, tree, entry_type):
path = utils.urldecode(path)
except ValueError:
raise exceptions.ParseError(
f'Value "{path}" (of attribute xlink:href) is not a valid' " URL."
f'Value "{path}" (of attribute xlink:href) is not a valid URL.'
)
amdids = file_elem.get("ADMID")
dmdids = file_elem.get("DMDID")
Expand Down
4 changes: 2 additions & 2 deletions metsrw/plugins/premisrw/premis.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ def compression_details(self):
event_type = self.findtext("event_type")
if event_type != "compression":
raise AttributeError(
f'PREMIS events of type "{event_type}" have no compression' " details"
f'PREMIS events of type "{event_type}" have no compression details'
)
parsed_compression_event_detail = self.parsed_event_detail
compression_program = _get_event_detail_attr(
Expand Down Expand Up @@ -435,7 +435,7 @@ def encryption_details(self):
event_type = self.findtext("event_type")
if event_type != "encryption":
raise AttributeError(
f'PREMIS events of type "{event_type}" have no encryption' " details"
f'PREMIS events of type "{event_type}" have no encryption details'
)
parsed_encryption_event_detail = self.parsed_event_detail
encryption_program = _get_event_detail_attr(
Expand Down
10 changes: 2 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
authors = [
{name = "Artefactual Systems Inc.", email = "[email protected]"}
Expand Down Expand Up @@ -106,14 +107,7 @@ omit = [
[tool.tox]
legacy_tox_ini = """
[tox]
envlist = py{39,310,311,312}, linting, docs

[gh-actions]
python =
3.9: py39
3.10: py310
3.11: py311
3.12: py312
envlist = py, linting, docs

[testenv]
skip_install = true
Expand Down
6 changes: 3 additions & 3 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pip-tools==7.4.1
# via metsrw (pyproject.toml)
pluggy==1.5.0
# via pytest
pygments==2.18.0
pygments==2.19.1
# via sphinx
pyproject-hooks==1.2.0
# via
Expand All @@ -65,7 +65,7 @@ pytest-cov==6.0.0
# via metsrw (pyproject.toml)
requests==2.32.3
# via sphinx
ruff==0.8.5
ruff==0.9.1
# via metsrw (pyproject.toml)
snowballstemmer==2.2.0
# via sphinx
Expand Down Expand Up @@ -107,5 +107,5 @@ zipp==3.21.0
# The following packages are considered to be unsafe in a requirements file:
pip==24.3.1
# via pip-tools
setuptools==75.6.0
setuptools==75.8.0
# via pip-tools
6 changes: 2 additions & 4 deletions tests/plugins/premisrw/test_premis.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def test_full_pointer_file(self):
mw.serialize(), schematron=metsrw.AM_PNTR_SCT_PATH
)
if not is_valid:
print("Pointer file is NOT" f" valid.\n{metsrw.report_string(report)}")
print(f"Pointer file is NOT valid.\n{metsrw.report_string(report)}")
assert is_valid

def test_pointer_file_read(self):
Expand All @@ -198,9 +198,7 @@ def test_pointer_file_read(self):
if pe.event_type == "compression"
][0]
outcome_detail_note = compression_event.findtext(
"event_outcome_information/"
"event_outcome_detail/"
"event_outcome_detail_note"
"event_outcome_information/event_outcome_detail/event_outcome_detail_note"
)
assert outcome_detail_note == c.EX_COMPR_EVT_OUTCOME_DETAIL_NOTE

Expand Down