Skip to content

Commit

Permalink
Restore bagit-python 1.8.1
Browse files Browse the repository at this point in the history
A direct dependency on 5b772435 worked locally but PyPI rejected it with the
following error:

WARNING  Error during upload. Retry with the --verbose option for more details.
ERROR    HTTPError: 400 Bad Request from https://upload.pypi.org/legacy/
         Can't have direct dependency: bagit@
         git+https://github.com/LibraryOfCongress/bagit-python. See
         https://packaging.python.org/specifications/core-metadata for more
         information.
  • Loading branch information
sevein committed Apr 20, 2024
1 parent 649825c commit 1a2b586
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 8 deletions.
5 changes: 0 additions & 5 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ Changed
- Replace ``pip``, ``pip-tools`` and ``virtualenv`` with ``uv``.
- Update dependencies.

Removed
-------

- Remove ``shim_pkg_resources`` (bagit-python now uses ``importlib.metadata``).

.. _changelog-0.7.10:

0.7.10 — 2024-03-21
Expand Down
28 changes: 28 additions & 0 deletions a3m/cli/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import sys
from importlib.metadata import version


def shim_pkg_resources():
"""Injects a pkg_resources fake needed by bagit-python in Python 3.12.
The underlying error is only reproducible if setuptools is not installed.
"""

class Distribution:
def __init__(self, name):
self.version = version(name)

class FakeDistributionNotFound(Exception):
pass

def fake_get_distribution(_, name):
return Distribution(name)

class PkgResources:
DistributionNotFound = FakeDistributionNotFound
get_distribution = fake_get_distribution

sys.modules["pkg_resources"] = PkgResources() # type: ignore


shim_pkg_resources()
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies = [
# Used by client modules
"ammcpc~=0.1",
"metsrw~=0.4",
"bagit @ git+https://github.com/LibraryOfCongress/bagit-python",
"bagit~=1.8",
"lxml~=4.9",
"unidecode~=1.3",
"pygfried~=0.6",
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ attrs==23.2.0
# scriv
babel==2.14.0
# via sphinx
bagit @ git+https://github.com/LibraryOfCongress/bagit-python@5b7724356d8c5c3a3be9120814d4d996574485a9
bagit==1.8.1
boto3==1.34.87
botocore==1.34.87
# via
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ attrs==23.2.0
# via
# jsonschema
# referencing
bagit @ git+https://github.com/LibraryOfCongress/bagit-python@5b7724356d8c5c3a3be9120814d4d996574485a9
bagit==1.8.1
boto3==1.34.87
botocore==1.34.87
# via
Expand Down

0 comments on commit 1a2b586

Please sign in to comment.