-
Notifications
You must be signed in to change notification settings - Fork 67
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
Automatic registration of co-installed 3rd party library types #10
Comments
If glom is in INSTALLED_APPS, then it will import the app in glom.default_app_config, for example with glom.default_app_config = 'glom.django.app.AppConfig' then this allows AppConfig to do the registration in ready(). |
@jpic that's some good detailed info! Interestingly that would involve making glom into a django app, even if not directly depending on django as an installation requirement. Am I understanding that correctly? Definitely worth a think, even if it doesn't answer the question for SQLAlchemy and other libraries with interesting types. |
Well, there will be a conflict if another library that's not compatible with Django decides to use glom.default_app_config, load the module it contains as a string, and expect anything else than a Django App, otherwise, everything will be fine. |
Forgot to show example django app auto discovery for registration: https://github.com/yourlabs/crudlfap/blob/master/src/crudlfap/apps.py |
We already have a snippet documented for automatic Django ORM type iteration. Should this behavior happen automatically if glom and Django are in the same env?
If so, I think we may want to make an environment variable disabling this behavior, for those who wish to avoid the runtime import overhead. Right now
glom.core
depends on nothing but the stdlib and represents a very lightweight import. That won't stay true if it tries importing from a bunch of paths and either failing or loading large codebases that aren't even necessarily used. (see also: mahmoud/ashes#31)The text was updated successfully, but these errors were encountered: