Howdy,
I'd like to announce a beta release of django-synth, a Python package that
enables the seamless use of Synth <https://github.com/ajg/synth> in Django
<https://www.djangoproject.com/> projects. Synth is a template parser and
renderer written in C++ that features a complete, standalone implementation
of Django's template system, with experimental support for custom tags and
filters.
You can install it as follows:
pip install pip --upgrade # Ensure wheel support
pip install django-synth
Then require it (e.g. django-synth>=0.7.0) and add it to your settings:
TEMPLATE_LOADERS = (
'django_synth.loaders.FilesystemLoader',
'django_synth.loaders.AppDirectoriesLoader',
)
(Note that installation can take a while if there are no pre-built binary
wheels for the platform; also, note that the Synth bindings are designed to
work predominantly with Python 2.7 and 3.4.)
Preliminary testing suggests that the Synth implementation can be 10x to
30x faster, though take those figures with a grain of salt because
benchmarking is difficult to get right in the general case. If you're
curious, this <https://github.com/ajg/synth/blob/master/tests/timings.py> is
the relevant timing code--feel free to help improve it.
At this stage the output may not always match byte for byte, especially
when using existing custom libraries (which require a good deal of black
magic to interoperate.) For example, the blocktrans tag from Django's i18n
library is known to give some grief; regardless, the plan is to implement
all the common custom libraries (i18n, l10n, static, staticfiles, tz,
humanize and webdesign) in order to minimize use of the custom-loading
mechanism and crossing the Python/C++ boundary.
For what it's worth, besides the Django template language, django-synth
also lets you use server-side includes (SSI) and Perl's HTML::Templates
"for free" from Django, since Synth implements those too. There's a setting
that controls the default engine used, plus a few others
<https://github.com/ajg/django-synth#settings> to tweak Synth's behavior.
Anyway, is there interest in developing django-synth further?
If there is, the roadmap would include:
- Reaching a stable, fully-compatible first release
- Implementing all common custom libraries natively
- Writing a full set of documentation
- Enhancing performance: parallel parsing, speculative rendering,
aggressive caching, etc.
However, first I'd like to get a sense of whether such work would be
useful. As always, all feedback is appreciated.
Thank you!
Alvaro <http://alva.ro>
--
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-developers/a052bfe4-4106-410d-8bb4-bbf8082f7f8a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.