need opinions for dependencies for some Pyramid related code

57 views
Skip to first unread message

Iain Duncan

unread,
Feb 10, 2012, 1:22:06 PM2/10/12
to pylons-...@googlegroups.com
Hi folks, I want to publish/release some of our internal work this year. Right now we have a lot of dependencies that can maybe be trimmed as we started this stuff ages ago first on Pylons and then Repoze.bfg. I know that a bad dependency choice can really hamper uptake, and that Pyramid has done some rewrites/wrapping of some dependencies that turned out to be not well maintained.

Could I get framework developers opinions on the whether it's a good plan to use the following or should we pick alternatives? If replacing one is a good idea, I'd rather do it before we document and publish the tools using them, even though I don't relish the idea of changing any!

- Tempita: our form/field generating system uses tempita as a light fast template language for tiny templates, this could be replaced

- PasteScript: we have a bunch of code generation utilities that are done using PasteScript.  

- FormEncode: we use it a lot for validation, (not html filling or generation). I really like the FormEncode encoding approach for multi input fields ( variableencode )

- PyQuery

- BeautifulSoup

Thanks
Iain

Jason

unread,
Feb 10, 2012, 3:49:27 PM2/10/12
to pylons-...@googlegroups.com
Tempita and PasteScript:  I use these for project templates. I assume there is a new way to do scaffolding in Pyramid, but I don't see a reason to translate my project templates (they aren't generic enough to be useful to anyone else).

FormEncode: I really like FormEncode for validation. The documentation might not be as thorough as it could be -- sometimes requires browsing the source to learn a technique -- but it works well once you figure it out. I use it when I need nested forms or multiple forms per page. The validation errors also map extremely well to JSON for asynchronous form validation. I haven't found anything that does nested/multi-row forms as nicely.

BeautifulSoup: I use lxml.html for HTML parsing , but I haven't used BeautifulSoup enough to know the difference.

Everything you're using I've heard recommendations for in the past, so it's not like you are using obscure dependencies that may disappear without warning. I don't think you need to change anything -- even if you change the dependency, people that have problems with dependencies will still dislike the fact that it's there.

-- Jason

Chris McDonough

unread,
Feb 11, 2012, 6:58:49 AM2/11/12
to pylons-...@googlegroups.com
On Fri, 2012-02-10 at 10:22 -0800, Iain Duncan wrote:
> Hi folks, I want to publish/release some of our internal work this
> year. Right now we have a lot of dependencies that can maybe be
> trimmed as we started this stuff ages ago first on Pylons and then
> Repoze.bfg. I know that a bad dependency choice can really hamper
> uptake, and that Pyramid has done some rewrites/wrapping of some
> dependencies that turned out to be not well maintained.
>
>
> Could I get framework developers opinions on the whether it's a good
> plan to use the following or should we pick alternatives? If replacing
> one is a good idea, I'd rather do it before we document and publish
> the tools using them, even though I don't relish the idea of changing
> any!
>
>
> - Tempita: our form/field generating system uses tempita as a light
> fast template language for tiny templates, this could be replaced

Almost any other templating system would be better here as tempita is
unmaintained. Any of Mako, Jinja2 or Chameleon would work; each is Py3
compat.

> - PasteScript: we have a bunch of code generation utilities that are
> done using PasteScript.

If it's only about creating Pyramid scaffolding, Pyramid now has code
generation facilities built in to it. See
http://docs.pylonsproject.org/projects/pyramid/en/1.3-branch/narr/scaffolding.html

> - FormEncode: we use it a lot for validation, (not html filling or
> generation). I really like the FormEncode encoding approach for multi
> input fields ( variableencode )

FormEncode has picked up a maintainer, so this is probably safe.
Although I don't think it's Py3 compat, not sure if that's on the radar.

> - PyQuery

Haven't used it.

> - BeautifulSoup

This got a release recently which is Py3 compat.

- C

Chris Lambacher

unread,
Feb 11, 2012, 11:40:44 AM2/11/12
to pylons-...@googlegroups.com


On Sat, Feb 11, 2012 at 6:58 AM, Chris McDonough <chr...@plope.com> wrote:
FormEncode has picked up a maintainer, so this is probably safe.
Although I don't think it's Py3 compat, not sure if that's on the radar.

That's me(the new maintainer -- also David Stanek). Py3 compatibility is on the radar, but we haven't had time to get fully through the bug or the docs backlog. We will be at Pycon and we are planning on sprinting:  https://us.pycon.org/2012/community/sprints/projects/ 

I'll likely be contributing to pyramid_simpleform as well since that is what my projects use.

-Chris

--
Christopher Lambacher
ch...@kateandchris.net

Iain Duncan

unread,
Feb 11, 2012, 3:55:23 PM2/11/12
to pylons-...@googlegroups.com
>
> - Tempita: our form/field generating system uses tempita as a light
> fast template language for tiny templates, this could be replaced

Almost any other templating system would be better here as tempita is
unmaintained.  Any of Mako, Jinja2 or Chameleon would work; each is Py3
compat.


Thanks Chris, that's exactly the kind of feedback I was looking for. I chose Tempita because in this case I'm using something really simple and lightweight for super small templating, I guess maybe I should switch to using the built in tmpl facilities, a 'real' templating language is likely to be overkill for this particular use. hmmm,

 
> - PasteScript: we have a bunch of code generation utilities that are
> done using PasteScript.

If it's only about creating Pyramid scaffolding, Pyramid now has code
generation facilities built in to it.  See
http://docs.pylonsproject.org/projects/pyramid/en/1.3-branch/narr/scaffolding.html


Is this api compatible with pastescript code generation or will it require a fair bit of retooling?  I gather you are replacing pastescript because of the maintenance/documentation/python3 situation?
 
> - FormEncode: we use it a lot for validation, (not html filling or
> generation). I really like the FormEncode encoding approach for multi
> input fields ( variableencode )

FormEncode has picked up a maintainer, so this is probably safe.
Although I don't think it's Py3 compat, not sure if that's on the radar.


Cool. I'm using the nested form funtionality heavily for auto generated subforms so I don't relish replacing that. That's good news at least.
 
> - PyQuery

Haven't used it.


It's built in to Webtest as a dependency. Does pyramid include webtest or have plans for the webtest api?
 
> - BeautifulSoup

This got a release recently which is Py3 compat.

Thanks again

Iain Duncan

unread,
Feb 11, 2012, 3:56:19 PM2/11/12
to pylons-...@googlegroups.com
On Sat, Feb 11, 2012 at 6:58 AM, Chris McDonough <chr...@plope.com> wrote:
FormEncode has picked up a maintainer, so this is probably safe.
Although I don't think it's Py3 compat, not sure if that's on the radar.

That's me(the new maintainer -- also David Stanek). Py3 compatibility is on the radar, but we haven't had time to get fully through the bug or the docs backlog. We will be at Pycon and we are planning on sprinting:  https://us.pycon.org/2012/community/sprints/projects/ 


Awesome! Is there a wiki or trac or what not for the new developments? Glad it's been picked up!

Iain

Mike Orr

unread,
Feb 11, 2012, 4:00:35 PM2/11/12
to pylons-...@googlegroups.com
On Fri, Feb 10, 2012 at 12:49 PM, Jason <ja...@deadtreepages.com> wrote:
> BeautifulSoup: I use lxml.html for HTML parsing , but I haven't used
> BeautifulSoup enough to know the difference.

BeautifulSoup can handle bad HTML better. If your HTML files are
coming from a third party and you can't control their quality, it may
be better to use BeautifulSoup than get an exception. I have an
application with an online glossary, and the glossary is maintained by
another person using some visual tool. So when I get an update, I use
BeautifulSoup to parse it.

--
Mike Orr <slugg...@gmail.com>

Iain Duncan

unread,
Feb 11, 2012, 4:03:30 PM2/11/12
to pylons-...@googlegroups.com
BeautifulSoup is freaking magical for that. It's awesome. We use it for making sure clients can't break things sticking in totally mangled html.

iain

Chris McDonough

unread,
Feb 11, 2012, 4:11:15 PM2/11/12
to pylons-...@googlegroups.com
On Sat, 2012-02-11 at 12:55 -0800, Iain Duncan wrote:
> >
> > - Tempita: our form/field generating system uses tempita as
> a light
> > fast template language for tiny templates, this could be
> replaced
>
>
> Almost any other templating system would be better here as
> tempita is
> unmaintained. Any of Mako, Jinja2 or Chameleon would work;
> each is Py3
> compat.
>
>
>
>
> Thanks Chris, that's exactly the kind of feedback I was looking for. I
> chose Tempita because in this case I'm using something really simple
> and lightweight for super small templating, I guess maybe I should
> switch to using the built in tmpl facilities, a 'real' templating
> language is likely to be overkill for this particular use. hmmm,

Not sure what you're trying to optimize for. What does "lightweight"
mean in this (or really any) context? If lightweight means "fast",
there's no way tempita is appreciably faster than any of mako,
chameleon, or jinja2, and it's likely much slower.



> > - PasteScript: we have a bunch of code generation utilities
> that are
> > done using PasteScript.
>
>
> If it's only about creating Pyramid scaffolding, Pyramid now
> has code
> generation facilities built in to it. See
> http://docs.pylonsproject.org/projects/pyramid/en/1.3-branch/narr/scaffolding.html
>
>
>
>
> Is this api compatible with pastescript code generation or will it
> require a fair bit of retooling? I gather you are replacing
> pastescript because of the maintenance/documentation/python3
> situation?

Yes. It's pretty close to compatible. The docs explain what needs to
change.

- C

Mike Orr

unread,
Feb 11, 2012, 4:12:16 PM2/11/12
to pylons-...@googlegroups.com
On Sat, Feb 11, 2012 at 1:00 PM, Mike Orr <slugg...@gmail.com> wrote:
> I have an
> application with an online glossary, and the glossary is maintained by
> another person using some visual tool. So when I get an update, I use
> BeautifulSoup to parse it.

The way the glossary works, in case anyone is interested, is I parse
the terms and definitions out of the HTML file and put them in a data
structure (currently a pickle file, but I think the next version will
have a database table). I sort them into first-letter groups
(capitalized), and make a page for each letter.

The definitions sometimes contain cross-references to other terms. I
got the maintainer to use an agreed format for cross-reference anchors
(<a href="LETTER#term-lowercase-with-hyphens"> I think), and then I
just keep the anchors in the definitions.


--
Mike Orr <slugg...@gmail.com>

Iain Duncan

unread,
Feb 12, 2012, 10:00:39 PM2/12/12
to pylons-...@googlegroups.com
On Sat, Feb 11, 2012 at 1:11 PM, Chris McDonough <chr...@plope.com> wrote:
On Sat, 2012-02-11 at 12:55 -0800, Iain Duncan wrote:
>         >
>         > - Tempita: our form/field generating system uses tempita as
>         a light
>         > fast template language for tiny templates, this could be
>         replaced
>
>
>         Almost any other templating system would be better here as
>         tempita is
>         unmaintained.  Any of Mako, Jinja2 or Chameleon would work;
>         each is Py3
>         compat.

Thanks Chris. I guess in this case I meant "easy to integrate". A lot of the templates are like, 2 lines long, and are embedded in a dictionary in the consuming class. it was just really easy to add tempita when I decided that standard string subbing wasn't going to cut it. I'll look into using chameleon or mako instead. Mako might be better for this use even though I use Chameleon normally.

Thanks for the input.
>         If it's only about creating Pyramid scaffolding, Pyramid now
>         has code
>         generation facilities built in to it.  See
>         http://docs.pylonsproject.org/projects/pyramid/en/1.3-branch/narr/scaffolding.html
>
>
>
>
> Is this api compatible with pastescript code generation or will it
> require a fair bit of retooling?  I gather you are replacing
> pastescript because of the maintenance/documentation/python3
> situation?

Yes.  It's pretty close to compatible.  The docs explain what needs to
change.

Awesome, thanks for this addition. I love PasteScript, but don't love it's maintenance situation.

iain

Benjamin Sims

unread,
Feb 13, 2012, 2:26:37 PM2/13/12
to pylons-...@googlegroups.com
On the other hand, while I love Beautiful Soup and used it for many years, I have found that lxml is considerably faster if you are looking to do heavy duty scraping/extraction, so it may be worth consideration depending on what your particular needs are.


--
You received this message because you are subscribed to the Google Groups "pylons-discuss" group.
To post to this group, send email to pylons-...@googlegroups.com.
To unsubscribe from this group, send email to pylons-discus...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.


Reply all
Reply to author
Forward
0 new messages