CyberSource / CyberSource/cybersource-rest-client-python

incompatible with Python 3.13 due to pgpy dependency using deprecated imghdr module

Open
#168 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
24
Forks
42
Avg merge
29m
Merged PRs (30d)
1

Description

The cybersource-rest-client-python package fails to initialize on Python 3.13 due to a transitive dependency issue with the pgpy package.
See also: https://github.com/SecurityInnovation/PGPy/issues/462

Environment

  • Package version: 0.0.70 (latest)
  • Python version: 3.13.x
  • Operating System: All platforms

Root Cause

  1. Python 3.13 removed the deprecated imghdr module (https://peps.python.org/pep-0594/)
  2. The pgpy package (v0.6.0) imports imghdr in its constants.py file
  3. cybersource-rest-client-python depends on pgpy (defined in setup.py)
  4. BatchUploadWithMTLSApi is imported in the top-level CyberSource/__init__.py
  5. This triggers the import chain: CyberSource → BatchUploadWithMTLSApi → PgpEncryption → pgpy → imghdr ❌
Error Traceback
  import CyberSource

  File "/site-packages/CyberSource/__init__.py", line 1559, in <module>
      from .api.o_auth_api import OAuthApi
  File "/site-packages/CyberSource/api/__init__.py", line 5, in <module>
      from .batch_upload_with_mtls_api import BatchUploadWithMTLSApi
  File "/site-packages/CyberSource/api/batch_upload_with_mtls_api.py", line 6, in <module>
      from CyberSource.utilities.pgpBatchUpload.pgp_encryption import PgpEncryption
  File "/site-packages/CyberSource/utilities/pgpBatchUpload/pgp_encryption.py", line 4, in <module>
      import pgpy
  File "/site-packages/pgpy/__init__.py", line 4, in <module>
      from .pgp import PGPKey
  File "/site-packages/pgpy/pgp.py", line 25, in <module>
      from .constants import CompressionAlgorithm
  File "/site-packages/pgpy/constants.py", line 5, in <module>
      import imghdr
  ModuleNotFoundError: No module named 'imghdr'

Impact

  • Blocks Python 3.13 adoption for all users of this package
  • Affects all users, even those not using batch upload functionality, because the import happens at package initialization

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with setup.py and the import chain through CyberSource/init.py, CyberSource/api/batch_upload_with_mtls_api.py, and CyberSource/utilities/pgpBatchUpload/pgp_encryption.py. Reproduce the top-level import on Python 3.13 and determine the smallest supported dependency or import change; done means the package initializes without the shown ModuleNotFoundError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.