Skip to content

Commit

Permalink
Upgrade dependencies
Browse files Browse the repository at this point in the history
* Upgrade pre-commit dependencies
* Upgrade Python requirements
* Run test CI jobs in Ubuntu 24.04
  • Loading branch information
replaceafill authored Jan 13, 2025
1 parent 00e6719 commit 2955aee
Show file tree
Hide file tree
Showing 13 changed files with 64 additions and 76 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
jobs:
integration:
name: "Integration ${{ matrix.ubuntu-version }} with ${{ matrix.python-version }}"
runs-on: "ubuntu-22.04"
runs-on: "ubuntu-24.04"
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
tox:
name: "Tox ${{ matrix.toxenv }}"
runs-on: "ubuntu-22.04"
runs-on: "ubuntu-24.04"
strategy:
fail-fast: false
matrix:
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
17 changes: 9 additions & 8 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ asgiref==3.8.1
# django
bagit==1.8.1
# via -r requirements.txt
boto3==1.35.92
boto3==1.35.97
# via -r requirements.txt
botocore==1.35.92
botocore==1.35.97
# via
# -r requirements.txt
# boto3
Expand Down Expand Up @@ -141,15 +141,15 @@ lxml==5.3.0
# metsrw
# python-cas
# sword2
metsrw==0.6.0
metsrw==0.6.1
# via -r requirements.txt
mozilla-django-oidc==4.0.1
# via -r requirements.txt
msgpack==1.1.0
# via
# -r requirements.txt
# oslo-serialization
mysqlclient==2.2.6
mysqlclient==2.2.7
# via
# -r requirements.txt
# agentarchives
Expand Down Expand Up @@ -237,7 +237,7 @@ pycparser==2.22
# cffi
pyee==12.0.0
# via playwright
pyopenssl==24.3.0
pyopenssl==25.0.0
# via
# -r requirements.txt
# josepy
Expand Down Expand Up @@ -279,7 +279,7 @@ python-dateutil==2.9.0.post0
# -r requirements.txt
# botocore
# django-tastypie
python-gnupg==0.5.3
python-gnupg==0.5.4
# via -r requirements.txt
python-keystoneclient==5.5.0
# via -r requirements.txt
Expand Down Expand Up @@ -355,6 +355,7 @@ typing-extensions==4.12.2
# dj-database-url
# keystoneauth1
# pyee
# pyopenssl
# tox
tzdata==2024.2
# via
Expand All @@ -372,7 +373,7 @@ wheel==0.45.1
# via pip-tools
whitenoise==6.8.2
# via -r requirements.txt
wrapt==1.17.0
wrapt==1.17.1
# via
# -r requirements.txt
# debtcollector
Expand All @@ -393,7 +394,7 @@ zope-interface==7.2
# 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
# -r requirements.txt
# pip-tools
Expand Down
17 changes: 9 additions & 8 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ asgiref==3.8.1
# via django
bagit==1.8.1
# via -r requirements.in
boto3==1.35.92
boto3==1.35.97
# via -r requirements.in
botocore==1.35.92
botocore==1.35.97
# via
# boto3
# s3transfer
Expand Down Expand Up @@ -89,13 +89,13 @@ lxml==5.3.0
# metsrw
# python-cas
# sword2
metsrw==0.6.0
metsrw==0.6.1
# via -r requirements.in
mozilla-django-oidc==4.0.1
# via -r requirements.in
msgpack==1.1.0
# via oslo-serialization
mysqlclient==2.2.6
mysqlclient==2.2.7
# via agentarchives
netaddr==1.3.0
# via
Expand Down Expand Up @@ -143,7 +143,7 @@ pyasn1-modules==0.4.1
# via python-ldap
pycparser==2.22
# via cffi
pyopenssl==24.3.0
pyopenssl==25.0.0
# via josepy
pyparsing==3.2.1
# via
Expand All @@ -155,7 +155,7 @@ python-dateutil==2.9.0.post0
# via
# botocore
# django-tastypie
python-gnupg==0.5.3
python-gnupg==0.5.4
# via -r requirements.in
python-keystoneclient==5.5.0
# via -r requirements.in
Expand Down Expand Up @@ -203,6 +203,7 @@ typing-extensions==4.12.2
# asgiref
# dj-database-url
# keystoneauth1
# pyopenssl
tzdata==2024.2
# via
# oslo-serialization
Expand All @@ -213,7 +214,7 @@ urllib3==1.26.20
# requests
whitenoise==6.8.2
# via -r requirements.in
wrapt==1.17.0
wrapt==1.17.1
# via debtcollector
zipp==3.21.0
# via importlib-resources
Expand All @@ -223,7 +224,7 @@ zope-interface==7.2
# via gevent

# The following packages are considered to be unsafe in a requirements file:
setuptools==75.6.0
setuptools==75.8.0
# via
# zope-event
# zope-interface
11 changes: 5 additions & 6 deletions storage_service/common/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,11 @@ class LoginRequiredMiddleware(MiddlewareMixin):
"""

def process_request(self, request):
assert hasattr(request, "user"), "The Login Required middleware\
requires authentication middleware to be installed. Edit your\
MIDDLEWARE setting to insert\
'django.contrib.auth.middlware.AuthenticationMiddleware'. If that doesn't\
work, ensure your TEMPLATES setting includes\
'django.core.context_processors.auth'."
assert hasattr(request, "user"), (
"The Login Required middleware requires authentication middleware to be installed. "
"Edit your MIDDLEWARE setting to insert 'django.contrib.auth.middlware.AuthenticationMiddleware'. "
"If that doesn't work, ensure your TEMPLATES setting includes 'django.core.context_processors.auth'."
)
if not request.user.is_authenticated:
path = request.path_info.lstrip("/")
if not any(m.match(path) for m in EXEMPT_URLS):
Expand Down
2 changes: 1 addition & 1 deletion storage_service/common/premis.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def create_replication_validation_event(
f" {master_aip_uuid} to replica AIP {replica_package_uuid}"
)
if fixity_report:
detail += " by performing a BagIt fixity check and by comparing" " checksums"
detail += " by performing a BagIt fixity check and by comparing checksums"
outcome_detail_note = "{}\n{}".format(
fixity_report["message"], checksum_report["message"]
)
Expand Down
7 changes: 3 additions & 4 deletions storage_service/locations/models/dataverse.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ class Dataverse(URLMixin, models.Model):
max_length=50,
verbose_name=_("API key"),
help_text=_(
"API key for Dataverse instance. Eg. "
"b84d6b87-7b1e-4a30-a374-87191dbbbe2d"
"API key for Dataverse instance. Eg. b84d6b87-7b1e-4a30-a374-87191dbbbe2d"
),
)
agent_name = models.CharField(
Expand All @@ -46,7 +45,7 @@ class Dataverse(URLMixin, models.Model):
max_length=256,
verbose_name=_("Agent identifier"),
help_text=_(
"URI agent identifier for premis:agentIdentifierValue " "in Archivematica"
"URI agent identifier for premis:agentIdentifierValue in Archivematica"
),
)
# FIXME disallow string in space.path
Expand Down Expand Up @@ -198,7 +197,7 @@ def move_to_storage_service(self, src_path, dest_path, dest_space):
# Verify src_path has to be a number
if not src_path.isdigit():
storage_err = _(
"Invalid value for src_path: %(value)s. Must be a numeric " "entity_id"
"Invalid value for src_path: %(value)s. Must be a numeric entity_id"
) % {"value": src_path}
raise StorageException(storage_err)
# Fetch dataset info
Expand Down
17 changes: 6 additions & 11 deletions storage_service/locations/models/dspace_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,13 @@ class DSpaceREST(models.Model):
ds_dip_collection = models.CharField(
max_length=64,
verbose_name=_("Default DSpace DIP collection id"),
help_text=_(
"UUID of default DSpace collection for the DIP to be" " deposited to"
),
help_text=_("UUID of default DSpace collection for the DIP to be deposited to"),
)

ds_aip_collection = models.CharField(
max_length=64,
verbose_name=_("Default DSpace AIP collection id"),
help_text=_(
"UUID of default DSpace collection for the AIP to be" " deposited to"
),
help_text=_("UUID of default DSpace collection for the AIP to be deposited to"),
)

as_url = models.URLField(
Expand Down Expand Up @@ -126,7 +122,7 @@ class DSpaceREST(models.Model):
blank=True,
default=True,
verbose_name=_("Verify SSL certificates?"),
help_text=_("If checked, HTTPS requests will verify the SSL" " certificates"),
help_text=_("If checked, HTTPS requests will verify the SSL certificates"),
)

upload_to_tsm = models.BooleanField(
Expand Down Expand Up @@ -208,8 +204,7 @@ def _analyze_md_els(self, mets_el, dmdids, metadata, repos, package_title):
namespaces=utils.NSMAP,
)
other_metadata = mets_el.find(
f'mets:dmdSec[@ID="{dmdid}"]/mets:mdWrap[@MDTYPE="OTHER"]/'
"mets:xmlData",
f'mets:dmdSec[@ID="{dmdid}"]/mets:mdWrap[@MDTYPE="OTHER"]/mets:xmlData',
namespaces=utils.NSMAP,
)
if other_metadata is not None:
Expand Down Expand Up @@ -249,7 +244,7 @@ def _get_metadata(self, input_path, aip_uuid, package_type):
package_type, output_dir, input_path, dirname, aip_uuid
)
root_objects_el = mets_el.find(
"//mets:structMap[@TYPE='physical']" "/mets:div/mets:div[@LABEL='objects']",
"//mets:structMap[@TYPE='physical']/mets:div/mets:div[@LABEL='objects']",
namespaces=utils.NSMAP,
)
if root_objects_el is None:
Expand Down Expand Up @@ -511,7 +506,7 @@ def _upload_to_tsm(source_path):

def move_from_storage_service(self, source_path, destination_path, package=None):
LOGGER.info(
"source_path: %s, destination_path: %s, package: %s, verify" " SSL: %s",
"source_path: %s, destination_path: %s, package: %s, verify SSL: %s",
source_path,
destination_path,
package,
Expand Down
10 changes: 3 additions & 7 deletions storage_service/locations/models/gpg.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def _gpg_encrypt(path, key_fingerprint):
if tar_created:
utils.extract_tar(path)
fail_msg = _(
"An error occured when attempting to encrypt" " %(path)s" % {"path": path}
"An error occured when attempting to encrypt %(path)s" % {"path": path}
)
LOGGER.error(fail_msg)
raise GPGException(fail_msg)
Expand All @@ -263,14 +263,10 @@ def _encr_path2key_fingerprint(encr_path):
model must have a GPG fingerprint.
"""
sql = (
"SELECT * FROM locations_package WHERE %s LIKE CONCAT('%%',"
" current_path, '%%')"
"SELECT * FROM locations_package WHERE %s LIKE CONCAT('%%', current_path, '%%')"
)
if _db_engine() == "sqlite":
sql = (
'SELECT * FROM locations_package WHERE %s LIKE "%" ||'
' current_path || "%"'
)
sql = 'SELECT * FROM locations_package WHERE %s LIKE "%" || current_path || "%"'
matches = list(Package.objects.raw(sql, [encr_path]))
try:
return matches[0].encryption_key_fingerprint
Expand Down
14 changes: 6 additions & 8 deletions storage_service/locations/models/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ class Package(models.Model):
null=True,
default=None,
help_text=_(
"The fingerprint of the GPG key used to encrypt the"
" package, if applicable"
"The fingerprint of the GPG key used to encrypt the package, if applicable"
),
)
replicated_package = models.ForeignKey(
Expand Down Expand Up @@ -800,8 +799,7 @@ def should_have_pointer_file(self, package_full_path=None, package_type=None):
if not ret:
if not isfile:
LOGGER.info(
"Package should not have a pointer file because %s"
" is not a file",
"Package should not have a pointer file because %s is not a file",
package_full_path,
)
if not isaip:
Expand Down Expand Up @@ -2655,12 +2653,12 @@ def _validate_pipelines_for_reingest(self):
"reingest_pipeline"
):
LOGGER.info(
"Reingest: Received pipeline %s did not match expected" " pipeline %s",
"Reingest: Received pipeline %s did not match expected pipeline %s",
self.origin_pipeline.uuid,
self.misc_attributes.get("reingest_pipeline"),
)
raise Exception(
_("%(uuid)s did not match the pipeline this AIP was reingested" " on.")
_("%(uuid)s did not match the pipeline this AIP was reingested on.")
% {"uuid": self.origin_pipeline.uuid}
)
self.misc_attributes.update({"reingest_pipeline": None})
Expand Down Expand Up @@ -2839,7 +2837,7 @@ def _move_rein_updated_to_final_dest(
# Delete old copy of AIP if different
if self.current_path != dest_path or self.current_location != reingest_location:
LOGGER.info(
"Old copy of reingested AIP is at a different location." " Deleting %s",
"Old copy of reingested AIP is at a different location. Deleting %s",
self.full_path,
)
self.current_location.space.delete_path(self.full_path)
Expand Down Expand Up @@ -3020,7 +3018,7 @@ def _extract_rein_aip(internal_location, rein_aip_internal_path):
except (subprocess.CalledProcessError, ValueError):
bname = os.path.splitext(os.path.basename(rein_aip_internal_path))[0]
LOGGER.warning(
"Unable to parse base directory from package," " using basename %s",
"Unable to parse base directory from package, using basename %s",
bname,
)
else:
Expand Down
Loading

0 comments on commit 2955aee

Please sign in to comment.