Opened at 2013-05-03T21:41:24Z
Closed at 2019-11-25T14:53:57Z
#1963 closed enhancement (duplicate)
replace nevow with twisted.web.template
Reported by: | zooko | Owned by: | daira |
---|---|---|---|
Priority: | normal | Milestone: | eventually |
Component: | code-frontend-web | Version: | 1.10.0 |
Keywords: | nevow templates | Cc: | nejucomo@… |
Launchpad Bug: |
Description (last modified by zooko)
Users still occasionally have problems with the nevow dependency:
https://github.com/twisted/nevow/issues/7 (see #2032)
Also, Nevow is unmaintained -- there has been no release since 2009. But it turns out (thanks to Daira for pointing this out to me) that twisted.web.template is the successor to nevow!
http://twistedmatrix.com/documents/current/web/howto/twisted-templates.html
So, we can reduce our dependencies by one, by using twisted.web.template instead of Nevow!
Change History (31)
comment:1 Changed at 2013-05-03T22:26:24Z by daira
- Description modified (diff)
- Summary changed from replace nevow with twisted.web.templates to replace nevow with twisted.web.template
comment:2 Changed at 2013-05-03T22:26:59Z by daira
- Component changed from unknown to code-frontend-web
- Owner changed from davidsarah to daira
comment:3 Changed at 2013-07-20T20:36:48Z by nejucomo
- Description modified (diff)
I've filed #2032 specifically for the installation issue, which I consider separate from this dependency issue.
comment:4 Changed at 2013-07-21T19:51:16Z by nejucomo
- Cc nejucomo@… added
comment:5 Changed at 2014-01-06T00:06:40Z by daira
- Description modified (diff)
comment:6 Changed at 2014-01-06T00:07:39Z by daira
- Description modified (diff)
comment:7 Changed at 2014-01-06T04:03:10Z by daira
I made a start on a branch to replace Nevow with twisted.web[.template] at https://github.com/tahoe-lafs/tahoe-lafs/commits/1963-replace-nevow.
comment:8 Changed at 2014-01-06T04:05:09Z by daira
- Status changed from new to assigned
comment:9 Changed at 2014-01-06T04:06:15Z by daira
- Milestone changed from undecided to eventually
comment:10 Changed at 2014-03-14T18:55:25Z by remyroy
- Owner changed from daira to remyroy
- Status changed from assigned to new
I'll have a look at this.
comment:11 Changed at 2014-03-14T18:55:50Z by remyroy
- Status changed from new to assigned
comment:12 Changed at 2014-03-15T15:05:25Z by daira
The idea behind the branch is to first perform a refactoring that means we still use Nevow, but we import its code indirectly via allmydata.web.common.
I also added a dummy @renderer decorator that will be needed for twisted.web (see this doc), but currently does nothing.
Once it's been made to work that way, we can switch the imports in allmydata.web.common to the equivalent twisted.web.template ones in cases where Twisted has a direct equivalent, and add new classes that inherit from or delegate to the Twisted ones to replace any Nevow-specific functionality.
The current state of the branch is that most of the imports in non-test code have been changed, and the @renderer decorator has been added in some of the cases where twisted.web would need it.
comment:13 Changed at 2014-03-15T15:07:12Z by daira
BTW, please feel free to approach this differently if you see a better way of doing it, @remyroy.
comment:14 Changed at 2014-03-15T15:09:42Z by daira
Incidentally, pyflakes is your friend when checking consistency of imports.
comment:15 follow-up: ↓ 17 Changed at 2014-03-17T21:00:34Z by remyroy
From my understanding, Nevow is more than just templating. Replacing Nevow with twisted.web.template is not going to work if the goal is to totally remove Nevow. It would not make much sense to replace just the templating part of Nevow and keep the rest of it.
The big question is what part of Nevow are we using that is not templating and can twisted.web fulfill this in an easy and straightforward way?
This is what we are using from Nevow that is not templating related:
- nevow.appserver
- nevow.appserver.NevowRequest
- nevow.appserver.NevowSite
- nevow.resource_filename
and whatever is under those including idioms and conventions from Nevow. There seems to be a lot of Nevow code under those from my quick reading of Nevow source code.
I've been reading the twisted.web documentation and it feels quite different from how it's done with Nevow. twisted.web.template might have been inspired by the templating system from Nevow but the rest of twisted.web not so much. I also feels like twisted.web is a third world "web framework" coming from something like Flask.
If we are to replace Nevow with something quite different, I would feel uncomfortable to replace it with twisted.web . I'd prefer to use a battle tested modern minimalist WSGI based "web framework" with twisted.web.wsgi.WSGIResource . I like Flask but I know there are also some nice alternatives. We could still keep using the twisted.web.template to minimize the amount of changes with templates if it makes sense.
I'll keep investigating how twisted.web can be *plugged in* and check out if there are other *big projects* who made the switch from Nevow.
Some feedback on this would be appreciated.
Sorry for the long comment.
comment:16 Changed at 2014-03-17T21:18:41Z by zooko
A big desideratum would be to not add new dependencies to Tahoe-LAFS, and in fact to remove dependencies if possible. Twisted is the one major dependency that we know we can't live without, so it is okay to depend on all features of Twisted, but it is a big issue to add a dependency on any other library.
Someone who knows a lot about this topic is dreid! I'll see if I can get him to comment.
comment:17 in reply to: ↑ 15 ; follow-up: ↓ 18 Changed at 2014-03-17T21:24:58Z by daira
Replying to remyroy:
The big question is what part of Nevow are we using that is not templating and can twisted.web fulfill this in an easy and straightforward way?
Yes.
This is what we are using from Nevow that is not templating related:
- nevow.appserver
- nevow.appserver.NevowRequest?
- nevow.appserver.NevowSite?
- nevow.resource_filename
and whatever is under those including idioms and conventions from Nevow. There seems to be a lot of Nevow code under those from my quick reading of Nevow source code.
I've been reading the twisted.web documentation and it feels quite different from how it's done with Nevow.
I think you're probably overestimating the differences. We actually only use a small subset of Nevow, and that subset has almost direct equivalents in twisted.web.
comment:18 in reply to: ↑ 17 Changed at 2014-03-17T21:27:03Z by remyroy
Replying to daira:
I think you're probably overestimating the differences. We actually only use a small subset of Nevow, and that subset has almost direct equivalents in twisted.web.
Great, I'll keep digging deeper.
comment:19 follow-up: ↓ 22 Changed at 2014-03-17T22:01:53Z by dreid
Last I checked tahoe-lafs made extensive use of nevow:pattern a concept which is not supported by twisted.web.template.
The other differences, like locateChild vs getChild and render_* being able to return Deferreds are relatively minor.
comment:20 follow-up: ↓ 21 Changed at 2014-03-18T20:45:34Z by remyroy
- Owner changed from remyroy to daira
- Status changed from assigned to new
I'm sorry but this ticket is overwhelming me. I'll pass it back to Daira.
I wish I could be of more help.
comment:21 in reply to: ↑ 20 Changed at 2014-03-18T23:43:44Z by daira
- Status changed from new to assigned
Replying to remyroy:
I'm sorry but this ticket is overwhelming me. I'll pass it back to Daira.
No problem; it's better to pass it to someone else than to be overwhelmed. (It was quite a complicated ticket to start with.)
comment:22 in reply to: ↑ 19 Changed at 2014-03-18T23:49:38Z by daira
Replying to dreid:
Last I checked tahoe-lafs made extensive use of nevow:pattern a concept which is not supported by twisted.web.template.
Hmm, can't nevow:pattern be replaced with nevow:render (with some code refactoring obviously)? Or is that also unsupported?
[Edit: yes `render` is supported.]
comment:23 Changed at 2014-03-18T23:50:51Z by daira
Or nevow:slot maybe (which is also supported)?
comment:24 Changed at 2014-03-18T23:52:06Z by daira
http://twistedmatrix.com/trac/ticket/5040 seems relevant.
comment:25 Changed at 2014-03-19T14:31:47Z by daira
This is the doc for the feature that was added to twisted.web.template in place of nevow:pattern: http://twistedmatrix.com/trac/changeset/32840
comment:26 Changed at 2014-06-23T21:35:55Z by zooko
- Description modified (diff)
comment:27 Changed at 2014-06-23T21:37:04Z by zooko
The two motivations for this ticket in the initial comment were https://github.com/twisted/nevow/issues/7 and that Nevow hasn't had a new release since 2009. As of recently, those two things are no longer true: https://tahoe-lafs.org/trac/tahoe-lafs/ticket/2032#comment:18
Should we close this ticket now, or is there another reason to switch from Nevow to twisted.web.template?
comment:28 Changed at 2014-07-23T19:21:24Z by daira
Even though Nevow has a new release, it still isn't being actively developed. I would prefer to remove it as a dependency.
comment:29 Changed at 2014-07-24T00:56:26Z by daira
Also we can't actually use the Nevow 0.11.1 release on Windows due to it requiring Twisted >= 13.0, which triggers #2028.
comment:30 Changed at 2014-09-23T18:49:44Z by daira
https://github.com/tahoe-lafs/tahoe-lafs/commits/1963-replace-nevow is rebased to master, although it still needs a lot more work.
comment:31 Changed at 2019-11-25T14:53:57Z by sajith
- Resolution set to duplicate
- Status changed from assigned to closed
This seems to be a little outdated by now. There's more recent work on replacing nevow: see the top-level ticket #3244.
[corrected the module name]