youknowone / python-deadlib

Python dead batteries. See PEP 594.
8 stars 1 forks source link

crypt module missing dependency _crypt in python 3.13 #19

Open lucas42 opened 4 days ago

lucas42 commented 4 days ago

The crypt module has a dependency an internal library _crypt, which isn't included here. Both were removed in python 3.13. Presumably _crypt wasn't copied here as it isn't a pure python module.

Traceback (most recent call last):
  File "/crypt/crypt/__init__.py", line 6, in <module>
    import _crypt
ModuleNotFoundError: No module named '_crypt'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/crypt/tests/test_crypt.py", line 9, in <module>
    crypt = warnings_helper.import_deprecated("crypt")
  File "/root/.pyenv/versions/3.13.0/lib/python3.13/test/support/warnings_helper.py", line 13, in import_deprecated
    return importlib.import_module(name)
           ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/root/.pyenv/versions/3.13.0/lib/python3.13/importlib/__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 1022, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/crypt/crypt/__init__.py", line 11, in <module>
    raise ImportError("The required _crypt module was not built as part of CPython")
ImportError: The required _crypt module was not built as part of CPython

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/root/.pyenv/versions/3.13.0/lib/python3.13/unittest/__main__.py", line 18, in <module>
    main(module=None)
    ~~~~^^^^^^^^^^^^^
  File "/root/.pyenv/versions/3.13.0/lib/python3.13/unittest/main.py", line 103, in __init__
    self.parseArgs(argv)
    ~~~~~~~~~~~~~~^^^^^^
  File "/root/.pyenv/versions/3.13.0/lib/python3.13/unittest/main.py", line 142, in parseArgs
    self.createTests()
    ~~~~~~~~~~~~~~~~^^
  File "/root/.pyenv/versions/3.13.0/lib/python3.13/unittest/main.py", line 153, in createTests
    self.test = self.testLoader.loadTestsFromNames(self.testNames,
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
                                                   self.module)
                                                   ^^^^^^^^^^^^
  File "/root/.pyenv/versions/3.13.0/lib/python3.13/unittest/loader.py", line 207, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
              ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
  File "/root/.pyenv/versions/3.13.0/lib/python3.13/unittest/loader.py", line 137, in loadTestsFromName
    module = __import__(module_name)
  File "/crypt/tests/test_crypt.py", line 13, in <module>
    raise unittest.SkipTest(str(ex))
unittest.case.SkipTest: The required _crypt module was not built as part of CPython
lucas42 commented 3 days ago

Not sure it's worth putting a lot of effort into fixing this. The official python docs point towards https://passlib.readthedocs.io/en/stable/ as a replacement for the crypt module.