Skip to content

Compatibilitat Python 3.12: substituir ús de imp #175

@pilipilisbot

Description

@pilipilisbot

Context

En Python 3.12, imp ha desaparegut. Ara mateix la suite unitària local falla només importar destral.utils perquè el fitxer fa import imp.

Validació local:

python3 -m unittest discover tests

Resultat observat en Python 3.12:

ModuleNotFoundError: No module named 'imp'

Punt afectat:

  • destral/utils.py, funció module_exists()

Impacte

La CI actual cobreix Python 3.11 i Python 2.7, però qualsevol entorn local o runner que pugi a Python 3.12 trenca destral abans d'executar tests.

Proposta

  • Substituir imp.find_module per importlib.util.find_spec en Python 3.
  • Mantenir fallback compatible amb Python 2.7.
  • Afegir test unitari per module_exists() amb mòdul existent/inexistent.
  • Opcional: afegir Python 3.12 a la CI si es vol declarar suport formal.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions