Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
sevein committed Oct 23, 2023
1 parent 18a713f commit 8292aef
Show file tree
Hide file tree
Showing 21 changed files with 501 additions and 456 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ jobs:
fail-fast: false
matrix:
include:
- {name: Python 3.9, python: '3.9', os: ubuntu-latest, tox: pytest, codecov: true}
- {name: Lint, python: '3.9', os: ubuntu-latest, tox: lint, codecov: false}
- {name: Type, python: '3.9', os: ubuntu-latest, tox: type, codecov: false}
- {name: Pylint, python: '3.9', os: ubuntu-latest, tox: pylint, codecov: false}
- {name: Vulture, python: '3.9', os: ubuntu-latest, tox: vulture, codecov: false}
- {name: Bandit, python: '3.9', os: ubuntu-latest, tox: bandit, codecov: false}
- {name: Python 3.11, python: '3.11', os: ubuntu-latest, tox: pytest, codecov: true}
- {name: Lint, python: '3.11', os: ubuntu-latest, tox: lint, codecov: false}
- {name: Type, python: '3.11', os: ubuntu-latest, tox: type, codecov: false}
- {name: Pylint, python: '3.11', os: ubuntu-latest, tox: pylint, codecov: false}
- {name: Vulture, python: '3.11', os: ubuntu-latest, tox: vulture, codecov: false}
- {name: Bandit, python: '3.11', os: ubuntu-latest, tox: bandit, codecov: false}
steps:
- name: Check out source code
uses: actions/checkout@v2
Expand Down
31 changes: 25 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,50 +1,68 @@
ci:
skip:
- pip-compile # network access is unavailable in pre-commit.ci runners

default_language_version:
python: python3.9
python: python3.11

repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: pretty-format-json
args: [--no-ensure-ascii, --autofix]
args:
- "--no-ensure-ascii"
- "--autofix"
files: |
(?x)^(
a3m/assets/.*\.json|
tests/server/fixtures/workflow-integration-test.json
)
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
hooks:
- id: pyupgrade
args: [--py39-plus]
args:
- "--py311-plus"

- repo: https://github.com/asottile/reorder-python-imports
rev: v3.12.0
hooks:
- id: reorder-python-imports
args: ["--application-directories=.:src", "--py39-plus"]
args:
- "--application-directories=.:src"
- "--py311-plus"

- repo: https://github.com/adamchainz/django-upgrade
rev: "1.15.0"
hooks:
- id: django-upgrade
args: [--target-version, "3.2"]
args:
- "--target-version=3.2"

- repo: https://github.com/psf/black
rev: "23.9.1"
hooks:
- id: black
args: [--safe, --quiet]
args:
- "--safe"
- "--quiet"

- repo: https://github.com/pycqa/flake8
rev: "6.1.0"
hooks:
- id: flake8

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.1
hooks:
- id: ruff
args:
- "--fix"
- "--exit-non-zero-on-fix"

- repo: https://github.com/jazzband/pip-tools
rev: 7.3.0
hooks:
Expand All @@ -57,6 +75,7 @@ repos:
args:
- "--output-file=requirements.txt"
- "setup.py"

- repo: https://github.com/jazzband/pip-tools
rev: 7.3.0
hooks:
Expand Down
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
extension-pkg-whitelist=lxml

[MESSAGES CONTROL]
disable=C, F, I, R, W, E1101, E1133
disable=C, F, I, R, W, E1101, E1133, E0611
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.9.18
3.11.6
4 changes: 2 additions & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version: 2
build:
os: "ubuntu-20.04"
os: "ubuntu-22.04"
tools:
python: "3.9"
python: "3.11"
sphinx:
configuration: "docs/conf.py"
python:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ ARG DJANGO_SETTINGS_MODULE=a3m.settings.common
ENV DJANGO_SETTINGS_MODULE=${DJANGO_SETTINGS_MODULE}
ENV PYENV_ROOT="/home/a3m/.pyenv"
ENV PATH=$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH
ARG PYTHON_VERSION=3.9.18
ARG PYTHON_VERSION=3.11.6
ARG REQUIREMENTS=/a3m/requirements-dev.txt

RUN set -ex \
Expand Down
3 changes: 1 addition & 2 deletions a3m/cli/client/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import datetime
import logging
import sys
from typing import Optional

import click
from django.conf import settings
Expand Down Expand Up @@ -89,7 +88,7 @@ def main(ctx, uri, name, address, processing_config, wait_for_ready, no_input):
click.secho("Processing completed successfully!", fg="green")


def _to_int(value: str) -> Optional[int]:
def _to_int(value: str) -> int | None:
try:
return int(value)
except ValueError:
Expand Down
5 changes: 2 additions & 3 deletions a3m/client/clientScripts/identify_file_format.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import argparse
import logging
import uuid
from typing import Optional

import pygfried
from django.db import transaction
Expand Down Expand Up @@ -30,7 +29,7 @@ def write_file_format_version(file_obj: File, format_version_id: str):


def write_identification_event(
file_id: str, puid: Optional[str] = None, success: bool = True
file_id: str, puid: str | None = None, success: bool = True
):
event_detail_text = 'program="{}"; version="{}"'.format(
TOOL_DESCRIPTION, TOOL_VERSION
Expand Down Expand Up @@ -81,7 +80,7 @@ def main(file_path: str, file_id: str, disable_reidentify: bool) -> int:
)
return 0

puid: Optional[str] = None
puid: str | None = None
try:
puid = pygfried.identify(file_path)
except Exception as err:
Expand Down
3 changes: 1 addition & 2 deletions a3m/client/clientScripts/normalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import os
import traceback
import uuid
from typing import Optional

from django.db import transaction
from django.utils import timezone
Expand Down Expand Up @@ -35,7 +34,7 @@ class Executor:
This class used to be in a module called transcoder, moved here as-is.
"""

exit_code: Optional[int]
exit_code: int | None

def __init__(
self, job, command: Command, replacement_dict, on_success=None, opts=None
Expand Down
3 changes: 1 addition & 2 deletions a3m/client/clientScripts/transcribe_file.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
from typing import Optional
from uuid import uuid4

from django.db import transaction
Expand Down Expand Up @@ -69,7 +68,7 @@ def fetch_rules_for(file_obj) -> list[Rule]:
return FPR.get_file_rules(file_obj, purpose=RulePurpose.TRANSCRIPTION)


def fetch_rules_for_derivatives(file_obj) -> tuple[Optional[File], list[Rule]]:
def fetch_rules_for_derivatives(file_obj) -> tuple[File | None, list[Rule]]:
derivs = Derivation.objects.filter(source_file=file_obj)
for deriv in derivs:
derived_file = deriv.derived_file
Expand Down
Loading

0 comments on commit 8292aef

Please sign in to comment.