-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
Require reflexes to be defined in a reflex.py module or a reflexes package for simpler discovery. #62
base: master
Are you sure you want to change the base?
Conversation
1. Update requirements_dev.txt to include base requirements, as these are necessary for starting the server and performing any tests. 2. Use Reflex.__subclasses__() rather than name checking for reflex subclass detection, which will be more consistent and allow users to name their reflexes whatever they want. 3. Clear falsey values from the filepaths detected in the load_reflexes_from_config function, which is a tenuous solution to not including vim-generated dotfiles in the module loading process. undo style changes
…package for ease of discovery. flake8 errors
The current scaffolding system generates a blank I appreciate the idiomatic change, but having to remember to fill out the |
I can fix the scaffolding change, thanks for bringing that to my attention. Personally, given that this paradigm is already established in Django, and it's as close to basic python as it gets, I'd rather not do anything terribly magical in I think my preference would be to have the default scaffolding generate a |
I think if we're going for a breaking change here it could be interesting to use a registering logic. There's less chance that you'd forget about that since you'd need to do it in the same file, just above the reflex class. Think the same as what is done in django admin -> |
I like the discussion here and Indeed I think I would prefer something simple and explicit as the registration @jonathan-s suggests. I dont know enough python / django to comment on the discussion of @mekhami and @DamnedScholar who seem to be more in the matter. |
And just as a side note.. i came across the problem, that I wanted to check againt a "registry" if a reflex class / method is available (the idea is to check if a given template tag references a valid reflex). So I think it would definetly be good to make a registry somewhat standalone (currently its pretty implicit in the consumer). |
I like a registry. It also fits a Django idiom and gives you a chance to have your view functions check for functionality that might make or break the view. It would also allow for multiple organization strategies, including the magic folder and having a Reflex class living in the same file as other classes that define the same functionality. |
Type of PR (feature, enhancement, bug fix, etc.)
Enhancement
Description
Please include a summary of the change and which issue is fixed.
load_reflexes_from_config
now looks for a reflexes.py module or a reflexes package which exposes its package members directly, instead of walking the filepath. This will be more stable in the long run, and adheres to idioms from the Django framework.