-
Notifications
You must be signed in to change notification settings - Fork 684
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New submod framework #9742
base: content
Are you sure you want to change the base?
New submod framework #9742
Conversation
use `glob` to find submods use f-strings more validation fixes
more typing added `getSubmodDirectory` improved err msgs improved naming wip submod loading
The proper way of loading modules
allows to dynamically import modules for submods
Finally, an entry level increaser upgrade with great functionality! (Not sarcastic, this is awesome) |
Are there any blockers currently for this getting merged? It seems like it's mostly there aside from the 1 requested change (and even there, I can't seem to find which file needs changing, all of them appear resolved) |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
summary of latest changes:
|
Did you try to import renpy directly? We should be able to use that. If we can't, then we should use typeshed vs dummy classes. |
removed renpyspec and just imported renpy. requires having the sdk as a library to have type hints. |
Ideally should get updated after #9736 is merged.
Major refactoring of the submod framework due to Python 3 update.
Changes:
_SubmodSchema
(a dataclass-like structure for json validation)HEADER_VERSION
(version number of the json schema)_Submod
class itself (if new fields were added, for example)early
blocks will be executed at -999, but before submod init nodesgame/Submods
(sub-folders are supported)header.json
mas_submod_utils.isSubmodInstalled
andmas_submod_utils.getSubmodDirectory
are public and safe to use by submodsmas_can_import
intomas.can_import
py package0imports.rpy
) and pointed everything to the py pkgmas_threading
intomas.threading
py packagezz_threading.py
) to themas.threading
py packageAdditions:
pydantic
, a great tool for validation of arbitrary datamas_submod_utils.require
- akin to NodeJSrequire
, can import a python module from a filepath, handy for submods_mas_loader
namespace (private, if some functionality is desired, it should be imported as a public function/class):include_module
- allows "including" a renpy module to load down the init pipeline with respect to the nodes init orderdo_modules_exist
- checks if a renpy module existsimport_from_path
- import py modules from file systemmas_submod_utils.require
) to allow importing local python packages w/o interfering the global scope. For example when 2 submods need to import different versions of the same library_mas_root
namespace:is_dm_enabled
- checks if debug mode is onmas
root folder for mas-specific py packagesFixes: