-
-
Notifications
You must be signed in to change notification settings - Fork 22
Make django_idom an installable app #3
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
Conversation
attempt re-adding tag stuff styling fix
Hey @rmorshea Ideas:
|
@Archmonger so I came up with a simpler idea, we'll look for a module With this import idom
__all__ = ["MyComponent"]
@idom.component
def MyComponent():
... or it could look like this: from .my_component import MyComponent
from .my_other_component import MyOtherComponent
__all__ = ["MyComponent", "MyOtherComponent", ...] No need for a standardized naming convention. Just list your component in the |
Managed to get the |
Utilizing An alternative could just be a named array. For example, for HTTP views Django uses For example, instead of using our If we aren't targeting auto discovery, then this would be the next option that fits the Django design style. |
The problem with @component
def Demo1():
...
@component
def Demo2():
...
components = [Demo1, Demo2] To avoid this, the components would need to be referenced by name instead of by value. Meaning, it would have to be strings components = ["x", "y", ...]
__all__ = components Let me know your thoughts on this reasoning though, I'm open to using something like |
Also, just to clarify, taking this approach does not preclude the possibility of a
Where from .my_component import MyComponent
from .my_other_component import MyOtherComponent
__all__ = ["MyComponent", "MyOtherComponent"] |
We wouldn't actually need to define components at the end of the file. Take a look at the Django design patterns and using The user could define their IDOM components in any file they want. I personally would argue we tell the user to reuse Django's own User should import Using |
I'm not sure we'll ever need from .my_component import MyComponent
from .my_other_component import MyOtherComponent
...
components = [MyComponent, MyOtherComponent, ...] Do other projects do this sort of thing? That is, require users to create top-level config files? |
That's pretty much what Django's So I suppose by the notion of Channels, then kind of. But channels doesn't rely on any particular file being within each Django sub-app though. |
I guess you're right, this is pretty much just a different form of |
I think appropriate filenames for us could potentially be
And for the array could be
Also, we have the option of mandating tuples within the array, if there's some other piece of information you'd like to pass through. For example, In the occasion we need more than two pieces of information, we could create a |
Also on the note of For example, check out Django is from 2005 which hasn't changed it's design syntax since. Some design decisions can feel weird due to that. |
I like |
I just had an idea while thinking about Django Channels. We could mandate the user to centralize all components into one file similar to how Channels does it. Basically, in For example: Then Thinking about it, Django's root |
So basically, the file where the components need to be declared would be configurable? |
f246b1f
to
cc9ee42
Compare
Yeah, configurable but it's all centralized to one file. For us, that would be far less annoying than checking each individual app. |
cc9ee42
to
b4f256b
Compare
Ah, I see. I think that might break things since in the template you have to reference the component via |
Checking each app for an |
f65a7d4
to
536968a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Weird, your review doesn't satisfy the merge requirements. Lemme see what's going on there... |
It's because I don't have write access to the repo. "At least 1 approving review is required by reviewers with write access." |
I'll give that to you. |
And we're all green finally! |
I'll make a release later this evening. |
Released! |
👍🍻 I'll begin Conreq integration soon. Would you have time to discuss Conreq design decisions this weekend? I want to make sure it's well aligned with IDOM for interoperability. |
I'll be away from my computer, but I may be able to just voice chat. I'd be able to do a normal video chat Friday afternoon or next week. |
Friday afternoon works with me. I don't have anything scheduled for Friday so I'll add something on your calendar. |
No description provided.