Skip to content

Commit

Permalink
Drop Python 3.8 support
Browse files Browse the repository at this point in the history
* Upgrade pre-commit dependencies
* Drop Python 3.8 support
* Allow manual triggering of test workflow
  • Loading branch information
replaceafill authored Jan 3, 2025
1 parent b00282e commit 08da95b
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
name: "Test"
on:
workflow_dispatch:
pull_request:
push:
branches:
Expand All @@ -12,7 +13,6 @@ jobs:
strategy:
matrix:
python-version: [
"3.8",
"3.9",
"3.10",
"3.11",
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.1
rev: v0.8.5
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.41.0
rev: v0.43.0
hooks:
- id: markdownlint
exclude: |
Expand All @@ -22,7 +22,7 @@ repos:
(README)\.md
)
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.2
rev: v1.14.1
hooks:
- id: mypy
additional_dependencies:
Expand Down
6 changes: 2 additions & 4 deletions fixity/fixity.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@
from datetime import datetime
from datetime import timezone
from time import sleep
from typing import List
from typing import Optional
from typing import TextIO
from typing import Type
from typing import Union
from uuid import uuid4

Expand Down Expand Up @@ -311,10 +309,10 @@ def get_handler(stream, timestamps, log_level=None):


def main(
argv: Optional[List[str]] = None,
argv: Optional[list[str]] = None,
logger: Optional[logging.Logger] = None,
stream: Optional[TextIO] = None,
) -> Optional[Union[int, bool, Type[Exception]]]:
) -> Optional[Union[int, bool, type[Exception]]]:
if logger is None:
logger = get_logger()
if stream is None:
Expand Down
6 changes: 2 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dynamic = [
"readme",
]
description = "Command line tool to check fixity for AIPs stored in the Archivematica Storage Service."
requires-python = ">=3.8"
requires-python = ">=3.9"
license = {file = "LICENSE"}
dependencies = [
"requests",
Expand All @@ -34,7 +34,6 @@ classifiers = [
"License :: OSI Approved :: GNU Affero General Public License v3",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand Down Expand Up @@ -107,11 +106,10 @@ omit = [
[tool.tox]
legacy_tox_ini = """
[tox]
envlist = py{38,39,310,311,312}, linting
envlist = py{39,310,311,312}, linting
[gh-actions]
python =
3.8: py38
3.9: py39
3.10: py310
3.11: py311
Expand Down
42 changes: 21 additions & 21 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,69 +4,69 @@
#
# pip-compile --allow-unsafe --extra=dev --output-file=requirements-dev.txt pyproject.toml
#
build==1.2.1
build==1.2.2.post1
# via pip-tools
certifi==2024.7.4
certifi==2024.12.14
# via requests
charset-normalizer==3.3.2
charset-normalizer==3.4.1
# via requests
click==8.1.7
click==8.1.8
# via pip-tools
coverage[toml]==7.5.4
coverage[toml]==7.6.10
# via
# fixity (pyproject.toml)
# pytest-cov
exceptiongroup==1.2.1
exceptiongroup==1.2.2
# via pytest
greenlet==3.0.3
greenlet==3.1.1
# via sqlalchemy
idna==3.7
idna==3.10
# via requests
importlib-metadata==8.0.0
importlib-metadata==8.5.0
# via build
iniconfig==2.0.0
# via pytest
packaging==24.1
packaging==24.2
# via
# build
# pytest
pip-tools==7.4.1
# via fixity (pyproject.toml)
pluggy==1.5.0
# via pytest
pyproject-hooks==1.1.0
pyproject-hooks==1.2.0
# via
# build
# pip-tools
pytest==8.2.2
pytest==8.3.4
# via
# fixity (pyproject.toml)
# pytest-cov
pytest-cov==5.0.0
pytest-cov==6.0.0
# via fixity (pyproject.toml)
requests==2.32.3
# via fixity (pyproject.toml)
ruff==0.5.1
ruff==0.8.5
# via fixity (pyproject.toml)
sqlalchemy==2.0.31
sqlalchemy==2.0.36
# via fixity (pyproject.toml)
tomli==2.0.1
tomli==2.2.1
# via
# build
# coverage
# pip-tools
# pytest
typing-extensions==4.12.2
# via sqlalchemy
urllib3==2.2.2
urllib3==2.3.0
# via requests
wheel==0.43.0
wheel==0.45.1
# via pip-tools
zipp==3.19.2
zipp==3.21.0
# via importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
pip==24.1.2
pip==24.3.1
# via pip-tools
setuptools==70.2.0
setuptools==75.6.0
# via pip-tools
12 changes: 6 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
#
# pip-compile --allow-unsafe --output-file=requirements.txt pyproject.toml
#
certifi==2024.7.4
certifi==2024.12.14
# via requests
charset-normalizer==3.3.2
charset-normalizer==3.4.1
# via requests
greenlet==3.0.3
greenlet==3.1.1
# via sqlalchemy
idna==3.7
idna==3.10
# via requests
requests==2.32.3
# via fixity (pyproject.toml)
sqlalchemy==2.0.31
sqlalchemy==2.0.36
# via fixity (pyproject.toml)
typing-extensions==4.12.2
# via sqlalchemy
urllib3==2.2.2
urllib3==2.3.0
# via requests
19 changes: 9 additions & 10 deletions tests/test_fixity.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import uuid
from datetime import datetime
from datetime import timezone
from typing import List
from typing import TextIO
from unittest import mock

Expand Down Expand Up @@ -45,7 +44,7 @@ def environment(monkeypatch: pytest.MonkeyPatch) -> None:


@pytest.fixture
def mock_check_fixity() -> List[mock.Mock]:
def mock_check_fixity() -> list[mock.Mock]:
return [
mock.Mock(
**{
Expand All @@ -58,14 +57,14 @@ def mock_check_fixity() -> List[mock.Mock]:
]


def _assert_stream_content_matches(stream: TextIO, expected: List[str]) -> None:
def _assert_stream_content_matches(stream: TextIO, expected: list[str]) -> None:
stream.seek(0)
assert [line.strip() for line in stream.readlines()] == expected


@mock.patch("requests.get")
def test_scan(
_get: mock.Mock, environment: None, mock_check_fixity: List[mock.Mock]
_get: mock.Mock, environment: None, mock_check_fixity: list[mock.Mock]
) -> None:
_get.side_effect = mock_check_fixity
aip_id = uuid.uuid4()
Expand Down Expand Up @@ -95,7 +94,7 @@ def test_scan_if_timestamps_argument_is_passed(
_get: mock.Mock,
time: mock.Mock,
environment: None,
mock_check_fixity: List[mock.Mock],
mock_check_fixity: list[mock.Mock],
) -> None:
_get.side_effect = mock_check_fixity
aip_id = uuid.uuid4()
Expand Down Expand Up @@ -140,7 +139,7 @@ def test_scan_if_report_url_exists(
utcnow: mock.Mock,
uuid4: mock.Mock,
environment: None,
mock_check_fixity: List[mock.Mock],
mock_check_fixity: list[mock.Mock],
monkeypatch: pytest.MonkeyPatch,
) -> None:
uuid4.return_value = expected_uuid = uuid.uuid4()
Expand Down Expand Up @@ -215,7 +214,7 @@ def test_scan_handles_exceptions_if_report_url_exists(
_post: mock.Mock,
_get: mock.Mock,
environment: None,
mock_check_fixity: List[mock.Mock],
mock_check_fixity: list[mock.Mock],
monkeypatch: pytest.MonkeyPatch,
) -> None:
_get.side_effect = mock_check_fixity
Expand Down Expand Up @@ -328,7 +327,7 @@ def test_scan_message(status: bool, error_message: str) -> None:
"requests.get",
)
def test_scanall(
_get: mock.Mock, environment: None, mock_check_fixity: List[mock.Mock]
_get: mock.Mock, environment: None, mock_check_fixity: list[mock.Mock]
) -> None:
aip1_uuid = str(uuid.uuid4())
aip2_uuid = str(uuid.uuid4())
Expand Down Expand Up @@ -499,7 +498,7 @@ def test_main_handles_exceptions_if_scanall_fails(

@mock.patch("requests.get")
def test_scanall_if_sort_argument_is_passed(
_get: mock.Mock, environment: None, mock_check_fixity: List[mock.Mock]
_get: mock.Mock, environment: None, mock_check_fixity: list[mock.Mock]
) -> None:
aip1_uuid = str(uuid.uuid4())
aip2_uuid = str(uuid.uuid4())
Expand Down Expand Up @@ -640,7 +639,7 @@ def test_scanall_if_sort_argument_is_passed(

@mock.patch("requests.get")
def test_main_handles_exception_if_environment_key_is_missing(
_get: mock.Mock, mock_check_fixity: List[mock.Mock]
_get: mock.Mock, mock_check_fixity: list[mock.Mock]
) -> None:
_get.side_effect = mock_check_fixity

Expand Down

0 comments on commit 08da95b

Please sign in to comment.