Repository navigation
Conversation
…rtlib pkgutil.get_loader was removed in Python 3.14 and Loader.load_module is slated for removal in 3.15. ScriptAdapterFactory and FluxFactory used both to discover their implementations, so `import maestrowf.interfaces` -- and with it the maestro and conductor CLIs -- failed on 3.14 (llnl#486, llnl#489). Discovery now imports the package and each of its modules with importlib.import_module and still enumerates them with pkgutil.iter_modules, which is not deprecated. The old load_module() shim also re-executed a module that was already imported, so a later call could hand back classes other than the ones registered at import; import_module returns the module already in sys.modules, so discovery is idempotent now. Tests cover the discovered adapters and Flux interfaces, identity with the registered classes, and that discovery raises no DeprecationWarning. CI's pip matrix gains 3.14 and now imports the package and runs `maestro --version` after installing it. The poetry matrix cannot run on 3.14 until the locked rpds-py (0.20.0, built on PyO3 0.22, which stops at 3.13) moves; every rpds-py with 3.14 wheels needs Python >= 3.9, so that is tied to the 3.8 floor rather than to this change. Tick the dev version to 1.2.2dev1 and add the changelog fragment. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #486, closes #489.
pkgutil.get_loaderwas removed in Python 3.14, andLoader.load_module()is slated for removal in 3.15.ScriptAdapterFactory.iter_adaptersandFluxFactory._iter_fluxused both to discover their implementations, so on 3.14import maestrowf.interfacesraisesAttributeError: module 'pkgutil' has no attribute 'get_loader'and themaestroandconductorentry points die on startup (#486).On 3.12 and 3.13 the same import emits six
DeprecationWarnings for it, hidden in CI by-p no:warnings.What changed
importlib.import_moduleand still enumerates them withpkgutil.iter_modules, which is not deprecated. No change to which classes are found or how they are keyed.load_module()shim re-executes a module that is already insys.modules, so every call re-ran each adapter module (anditer_adaptersranscript/__init__.pytwice at import). A second call therefore returned classes that were not the ones registered in the factory.import_modulereturns the module already imported, so discovery is idempotent now.tests/interfaces/test_script_adapter.py): the built-in adapters are found under their keys, discovery returns the very classes the factories registered, and neither discovery raises aDeprecationWarning. The identity and warning tests fail against 1.2.1 on 3.12, and all of them fail there on 3.14.maestrowf.interfacesand runsmaestro --version, so that leg checks more than that the build backend succeeded.1.2.2dev1; scriv fragment added (Fixed + Maintenance).Why the poetry matrix stays at 3.13
poetry installfrom the current lock cannot complete on 3.14: the lockedrpds-py0.20.0 (viajsonschema) has no 3.14 wheel, and its source build fails (PyO3 0.22 stops at 3.13). Everyrpds-pyrelease that ships 3.14 wheels requires Python >= 3.9, so with a single locked version that leg is tied to the 3.8 floor rather than to this change. #487's lock refresh is the place to pick that up.Verification
pyteston Windows under Python 3.12, 3.13, 3.14 and 3.15 (pytest 8,CI=truehypothesis profile): identical results on all four, and identical to unmodifieddevelopon 3.12 apart from the new tests passing. The pre-existing failures on this box are the path-sanitiser, status-renderer and Slurm-fixture tests, which depend on POSIX paths and a scheduler.python -W 8000 default -c "import maestrowf.interfaces"on 3.12: no warnings from maestrowf (six before).maestro --versionstarts on 3.14 and 3.15.flake8clean on the changed source files; the test file keeps its two pre-existingE275s.One comment/note that was picked up during the review/work was that:
FluxInterface_0170andFluxInterface_0190are abstract ondevelop(neither implementsget_flux_urgency), soFluxFactoryregisters only0.26.0and0.49.0.I don't really have a good understanding of that nuance/relevancy but might be a useful note for other future developers
Developed/reviewed with AI assistance