twidi / mixt Goto Github PK
View Code? Open in Web Editor NEWWrite html components directly in python and you have a beautiful but controversial MIXTure
Home Page: https://twidi.github.io/mixt/
License: MIT License
Write html components directly in python and you have a beautiful but controversial MIXTure
Home Page: https://twidi.github.io/mixt/
License: MIT License
I found no way to leave feedback, so I just use this issue tracker. I hope this is ok for you.
Do you know htmx?
I think mixt and htmx could work together very well.
Hello, thanks for this amazing package.
When trying to run this using python 3.10 I first get some errors about collections.Iterator that are easily fixed, but then I got this :
$ python -m mixt.examples.simple
Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 187, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/usr/lib/python3.10/runpy.py", line 157, in _get_module_details
code = loader.get_code(mod_name)
File "<frozen importlib._bootstrap_external>", line 1017, in get_code
File "<frozen importlib._bootstrap_external>", line 947, in source_to_code
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/home/max/projects/mixt/src/mixt/examples/simple.py", line 29
print(render_example())
SyntaxError: invalid syntax
I like to use the Django forms library. But I am not happy with django templates or format_html()
Django has the concept of SafeString so that unsafe data gets escaped, and html does not get escaped twice.
Does mixt support/detect SafeString, so I can create form with the django forms library, and then use the safestring containing the form with mixt?
Running mixt-post-install
, gives the following stacktrace:
Traceback (most recent call last):
File "/home/myname/project/venv/bin/mixt-post-install", line 6, in <module>
from mixt.scripts.mixt_post_install import main
File "/home/myname/project/venv/lib/python3.7/site-packages/mixt/__init__.py", line 8, in <module>
from . import exceptions, html as h # noqa: F401
File "/home/myname/project/venv/lib/python3.7/site-packages/mixt/html.py", line 24, in <module>
from .internal.html import ( # noqa: F401 # pylint: disable=unused-import
File "/home/myname/project/venv/lib/python3.7/site-packages/mixt/internal/html.py", line 7, in <module>
from .base import ( # noqa: F401 # isort: skip # pylint: disable=unused-import
File "/home/myname/project/venv/lib/python3.7/site-packages/mixt/internal/base.py", line 9, in <module>
from .proptypes import BasePropTypes
File "/home/myname/project/venv/lib/python3.7/site-packages/mixt/internal/proptypes.py", line 7, in <module>
import enforce # we use "enforce" to check complex types
File "/home/myname/project/venv/lib/python3.7/site-packages/enforce/__init__.py", line 1, in <module>
from .decorators import runtime_validation
File "/home/myname/project/venv/lib/python3.7/site-packages/enforce/decorators.py", line 11, in <module>
from .enforcers import apply_enforcer, Parameters, GenericProxy
File "/home/myname/project/venv/lib/python3.7/site-packages/enforce/enforcers.py", line 10, in <module>
from .validator import init_validator, Validator
File "/home/myname/project/venv/lib/python3.7/site-packages/enforce/validator.py", line 4, in <module>
from .parsers import get_parser
File "/home/myname/project/venv/lib/python3.7/site-packages/enforce/parsers.py", line 225, in <module>
typing.TupleMeta: _parse_tuple,
AttributeError: module 'typing' has no attribute 'TupleMeta'
See:
It is very interesting project. However, I'd like to translate to a dictionary node than a class object.
How should I look into?
I mean:
<Hello name = "World" />
could translate to
{ 'type':Hello, 'props': { 'name': "World", } }
Why I need this is because it can be lighter than class object.
I can use it for VDOM diff directly.
or translate to a node object.
Node(type=Hello, props = {'name': "World"})
Thanks for the great package, I much prefer writing components over wrangler templates. I was wondering if there was any interest in allowing the parsing of CSS within the html scope. Ideally, I'd like to write.
from mixt import html, Element, Required
class Hello(Element):
class PropTypes:
name: Required[str]
def render(self, context):
return (
<div>
<style>
body {
background: blue;
}
</style>
<div>Hello, {self.name}</div>
</div>
)
That fails with background: blue; SyntaxError: invalid syntax
. I figure I could put the css in a string and assign it outside the html scope but that feels a little awkward. Ultimately I'd like to write the css in the component and have it scoped to that component similar to how styled-jsx works, but this would be a nice first step. What do you think?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.