This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients Arfrever, Borisd13, Claudiu.Popa, brett.cannon, eric.snow, martin.panter, ncoghlan, nikicat, srittau
Date 2021-11-08.00:51:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1636332682.29.0.166795258435.issue21436@roundup.psfhosted.org>
In-reply-to
Content
FWIW, I think it would be desirable to retain/restore some form of API that allows the creation of modules from files without requiring the user to know about module specs (or loaders, or anything else).

My current preference would be for a "module_from_file_location" counterpart to "spec_from_file_location" that implements Brett's recipe from above. That code is visually short, but conceptually very dense,and hence far from being obvious to most people trying to make the "path to module" leap.

Such a function could also cross-reference runpy.run_path for cases where don't want a module at all, just the top level namespace.
History
Date User Action Args
2021-11-08 00:51:22ncoghlansetrecipients: + ncoghlan, brett.cannon, srittau, Arfrever, Claudiu.Popa, eric.snow, Borisd13, martin.panter, nikicat
2021-11-08 00:51:22ncoghlansetmessageid: <1636332682.29.0.166795258435.issue21436@roundup.psfhosted.org>
2021-11-08 00:51:22ncoghlanlinkissue21436 messages
2021-11-08 00:51:22ncoghlancreate