From 92899d632e40ba6b4f829a295fa3efb88ad5cf4a Mon Sep 17 00:00:00 2001 From: Sevy Harris Date: Wed, 14 Jan 2026 09:39:47 -0500 Subject: [PATCH 1/2] Replace deprecated imp.load_source call imp is deprecated and is getting removed in Python 3.12. documentation here shows the official suggestion for replacing imp.load_source calls: https://docs.python.org/3/whatsnew/3.12.html#imp --- rmgpy/data/kinetics/database.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rmgpy/data/kinetics/database.py b/rmgpy/data/kinetics/database.py index 02edef5e8a..efba47476b 100644 --- a/rmgpy/data/kinetics/database.py +++ b/rmgpy/data/kinetics/database.py @@ -138,11 +138,14 @@ def load_recommended_families(self, filepath): Both styles can be loaded by this method. """ - import imp + import importlib # Load the recommended.py file as a module try: - rec = imp.load_source('rec', filepath) + loader = importlib.machinery.SourceFileLoader('rec', filepath) + spec = importlib.util.spec_from_file_location('rec', filepath, loader=loader) + rec = importlib.util.module_from_spec(spec) + loader.exec_module(rec) except Exception as e: raise DatabaseError('Unable to load recommended.py file for kinetics families: {0!s}'.format(e)) From 148131f31459e26d74fd470ea036e01ecdb34061 Mon Sep 17 00:00:00 2001 From: Sevy Harris <30695172+sevyharris@users.noreply.github.com> Date: Fri, 16 Jan 2026 08:37:36 -0500 Subject: [PATCH 2/2] Update rmgpy/data/kinetics/database.py Add link to documentation showing recommended way to replace imp.load_source Co-authored-by: Jackson Burns <33505528+JacksonBurns@users.noreply.github.com> --- rmgpy/data/kinetics/database.py | 1 + 1 file changed, 1 insertion(+) diff --git a/rmgpy/data/kinetics/database.py b/rmgpy/data/kinetics/database.py index efba47476b..e92b3df3c9 100644 --- a/rmgpy/data/kinetics/database.py +++ b/rmgpy/data/kinetics/database.py @@ -142,6 +142,7 @@ def load_recommended_families(self, filepath): # Load the recommended.py file as a module try: + # https://docs.python.org/3/whatsnew/3.12.html#imp loader = importlib.machinery.SourceFileLoader('rec', filepath) spec = importlib.util.spec_from_file_location('rec', filepath, loader=loader) rec = importlib.util.module_from_spec(spec)