Skip to content
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

This makes the HTMX Component a pydantic.BaseModel #14

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

edelvalle
Copy link
Owner

@edelvalle edelvalle commented Oct 21, 2021

The implications are:

  • Rename Component.template_name -> Component._template_name
  • Move the logic Component.__init__ -> Component.mount
    The __init__ is now handled by pydantic

@mvaled
Copy link
Collaborator

mvaled commented Nov 17, 2021

I like the idea, because now when I create a base HTMX component I have to repeat its __init__ arguments in all subclasses. So, +1; however, this is breaking change, so I would make it another Component class and deprecate the current one.

I will work on this proposal.

@mvaled mvaled force-pushed the components-as-pydantic-models branch 4 times, most recently from 9c65cc0 to b762c99 Compare November 22, 2021 16:57
@edelvalle
Copy link
Owner Author

The README needs to be updated.

@mvaled mvaled force-pushed the components-as-pydantic-models branch from b762c99 to 78c8f86 Compare November 23, 2021 20:38
@mvaled
Copy link
Collaborator

mvaled commented Nov 23, 2021

The README needs to be updated.

I'm on the process of doing all of this. I went for the breaking change version, but even breaking the import which I find more dev-friendly because it won't even allow you to run the server while developing because an ImportError.

This is still not ready yet. It will take some time to complete.

@mvaled mvaled force-pushed the components-as-pydantic-models branch from ca49d08 to 1371db2 Compare November 23, 2021 20:44
edelvalle and others added 3 commits November 23, 2021 21:45
This is a breaking change.  To avoid issues I have changed the name of the
base Component to HTMXComponent, so errors are harder to get to production
unnoticed.
We using syntax which is not available in Python 3.6, 3.7 nor 3.9.  For
instance, the union operator for dicts.
@mvaled mvaled force-pushed the components-as-pydantic-models branch from 1371db2 to e817da4 Compare November 23, 2021 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants