web3py?

1,351 views
Skip to first unread message

User

unread,
Nov 26, 2012, 11:39:05 PM11/26/12
to web...@googlegroups.com
I noticed a thread over in web2py-developers web3py - important! which was exciting to read.  I've flirted with web2py and there's a lot that I like about it.  For some reason I find web2py exciting whereas django doesn't provide that.  I've used Yii on the php side which is great framework as far as php goes and asp.net mvc which is great as well.  I'd love to work with python but the main thing making me hesitate with web2py is critical mass. 
 
It seems like it wouldn't be hard for web2py to really dominate the python web framework space if some of the core criticisms were addressed.  I'm not fully up to speed on what they are but I usually hear about unit testing and global variables.  It feels like there is a roadblock preventing the project from skyrocketing.  Python needs a rails.  I understand that the design decisions are by choice with pros and cons.
 
My questions are:
1. Will web3py likely address these often repeated core criticisms? (I saw point 5 from the thread linked to above: "5) No more global environment. Apps will do "from web3py import *" (see below)")
2. The developer thread is over in the developers section.  Will you have a more open forum for users (as opposed to developers) to have input on web3py?
 
 

Massimo Di Pierro

unread,
Nov 27, 2012, 11:28:31 AM11/27/12
to web...@googlegroups.com
Hello user,

The purpose of that thread is to discuss where web2py should got in the future. For now we refer to that as web3py but noting is settled, not even the name.
There is a prototype containing some of my ideas for web3py.

My ideas are:
1) keep dal, templates, and validators
2) rewrite source code for forms and helpers (they would work more or less the same but simpler APIs, now they have too many options)
3) simplify internal logic (import instead of exec, better use of wsgi middleware, everything lazy for speed)
4) support for python 3.3
5) a compatibility layer that will allow running legacy web2py apps when running web3py in python 2.7. 

This means we will keep backward compatibility for legacy apps but new app will slightly different APIs.
Anyway this is a proposal.  people can looks at the prototype. It is 20x faster on hello world apps.

I think for now this discussion belongs to web2py-developers and everybody is welcome to join.
When the proposal is more concrete we can move some of the discussion here.

Massimo

Ovidio Marinho

unread,
Nov 27, 2012, 11:50:11 AM11/27/12
to web...@googlegroups.com
I think we are thinking about it at the time python3 is working well.
      


       Ovidio Marinho Falcao Neto
                Web Developer
             ovid...@gmail.com 
          ovidio...@itjp.net.br
                 ITJP - itjp.net.br
               83   8826 9088 - Oi
               83   9334 0266 - Claro
                        Brasil
              



2012/11/27 Massimo Di Pierro <massimo....@gmail.com>
--
 
 
 

Daniel González

unread,
Nov 27, 2012, 12:40:20 PM11/27/12
to web...@googlegroups.com
Is there any site where we can post improvements that we want to see in
web3py? (something like a wish-list)

El 27/11/12 17:28, Massimo Di Pierro escribi�:
> <https://groups.google.com/forum/?fromgroups=#%21topic/web2py-developers/RCeiRd3Rzs0> which
> was exciting to read. I've flirted with web2py and there's a lot
> that I like about it. For some reason I find web2py exciting
> whereas django doesn't provide that. I've used Yii on the php
> side which is great framework as far as php goes and asp.net
> <http://asp.net> mvc which is great as well. I'd love to work
> with python but the main thing making me hesitate with web2py is
> critical mass.
>
> It seems like it wouldn't be hard for web2py to really dominate
> the python web framework space if some of the core criticisms were
> addressed. I'm not fully up to speed on what they are but I
> usually hear about unit testing and global variables. It feels
> like there is a roadblock preventing the project from
> skyrocketing. Python needs a rails. I understand that the design
> decisions are by choice with pros and cons.
>
> My questions are:
> 1. Will web3py likely address these often repeated core
> criticisms? (I saw point 5 from the thread linked to above: "5) No
> more global environment. Apps will do "from web3py import *" (see
> below)")
> 2. The developer thread is over in the developers section. Will
> you have a more open forum for users (as opposed to developers) to
> have input on web3py?
>
>
>
> --
>
>
>

Richard Vézina

unread,
Nov 27, 2012, 2:56:12 PM11/27/12
to web...@googlegroups.com
I would say get in web2py developper group, find the thread about web3py : web3py important and leave your comments there.

Richard

On Tue, Nov 27, 2012 at 12:40 PM, Daniel González <dgzab...@gmail.com> wrote:
Is there any site where we can post improvements that we want to see in
web3py? (something like a wish-list)

El 27/11/12 17:28, Massimo Di Pierro escribió:
--




VP

unread,
Nov 28, 2012, 1:03:35 PM11/28/12
to web...@googlegroups.com
I have already put in my few cents in that thread.   The only thing I want to say here is that I hope web3py will be out soon.   I think web2py has started to show its age a  little bit.

:)

LightDot

unread,
Nov 28, 2012, 1:42:48 PM11/28/12
to web...@googlegroups.com
Age in weeks? ;)

On a serious note, I plan to use web2py on RHEL 6 systems for another 5-8 years. Once RHEL 7 is out, this new rewrite (web3py aka web2py 3.0 or whatever will it become) will most likely be a viable replacement for new projects, if it's released. I'm assuming web2py features and versatility are a good indicator for the new project, although I haven't looked at the code yet. Don't see any reasons to doubt. :)

But, at least for me, web2py isn't going anywhere soon.

Regards,
Ales

Ralo Tannahill

unread,
Nov 28, 2012, 6:44:49 PM11/28/12
to web...@googlegroups.com
+1
In a production system with thousands of lines of code, lots of servers, databases... I plan to keep the systems frozen (CENTOS 6, python 2.6 and web2py 2.x) for some years with the exception of security patches. The cost of reviewing/updating the existing code is too high...
So web3py could be the next generation framework, and backward compatibility should be the principal goal from my point of view

Best regards

Daniele

unread,
Nov 28, 2012, 8:14:52 PM11/28/12
to web...@googlegroups.com
I really believe web2py will indeed become the "rails for python" as someone mentioned. Actually, I believe it's much better, easier to use and comprehend, and more pleasant to develop in.

That said, I agree web2py needs to reach a critical mass of users because as of now, it's too hard to get the support to even simple answers, which sometime require days to be answered on google groups. A much wider user base would rapidly solve this problem quite naturally. I think the solution to this would be word of mouth: more users need to use web2py and spread the word of how good it is by mere word of mouth. It's possible, I believe the project can really outshine all the other python web frameworks.

peter

unread,
Nov 29, 2012, 5:06:30 AM11/29/12
to web...@googlegroups.com
In my experience, and what I have seen from following the threads, the norm is for questions to be answered very well and very quickly. One of the many pleasures of using Web2py is the responsiveness of the users group. There might be the odd exception to this, but this is unusual I believe. So sorry if you had a bad exprience Daniele, but I do not think most users find this.
Peter

Jim S

unread,
Nov 29, 2012, 9:25:25 AM11/29/12
to web...@googlegroups.com
+1 to what Peter said.

LightDot

unread,
Nov 29, 2012, 11:51:20 AM11/29/12
to web...@googlegroups.com
Some valid and interesting questions can get unanswered, slip below
the radar, that's bound to happen everywhere. I have a feeling that
web2py community is very active when compared to some others, taking
the number of members into account. It would be interesting to put
some numbers behind this and prove one way or another, but alas, I
don't really have the time... :/

My personal observations are that unanswered questions are often
either a) accompanied by complex, long examples of code, which many
readers don't have time to decipher; b) answered many times before or
so general, that they aren't web2py specific at all (ie. general css
or html questions); c) very specific, with sparse information about
the problem itself (such as individual web server configurations,
etc.). I might be wrong though, as I naturally don't read
everything...

Regards,
Ales
> --
>
>
>

Richard Penman

unread,
Dec 1, 2012, 11:47:05 PM12/1/12
to web...@googlegroups.com
Interesting development. This seems to address the common criticisms of web2py, which aren't an issue for me but surely deter others.

Luc Chase

unread,
Dec 2, 2012, 5:53:51 AM12/2/12
to web...@googlegroups.com
One or two high-profile projects would would go a long way towards this.  


On Thursday, 29 November 2012 01:14:52 UTC, Daniele wrote:

Lewis

unread,
Dec 8, 2012, 3:41:45 PM12/8/12
to web...@googlegroups.com
That sounds great!  Keep all that is great about Web2py--especially templates and helpers!--and silence the blathering, unhelpful critics.

Ovidio Marinho

unread,
Dec 9, 2012, 7:03:58 PM12/9/12
to web...@googlegroups.com
look is this http://ovidiomfalcao.wordpress.com/2011/10/24/web2py-ja-roda-em-python3-web2py-py3k/
      


       Ovidio Marinho Falcao Neto
                Web Developer
             ovid...@gmail.com 
          ovidio...@itjp.net.br
                 ITJP - itjp.net.br
               83   8826 9088 - Oi
               83   9336 3782 - Claro
                        Brasil
              



2012/12/8 Lewis <lewis...@hotmail.com>
--
 
 
 

Robert Clark

unread,
Dec 10, 2012, 6:42:20 PM12/10/12
to web...@googlegroups.com
A couple of days ago in the "web3py important!" thread I posted some thoughts on URL route matching syntax for the @expose(....) method, but my post is yet to surface.  Posting a more-considered version here for consideration and feedback.

I've been looking into some other frameworks, and Alloy stands out to me (http://alloyframework.org/manual/url-router/), it's the main inspiration for the syntax below.  (Also looked at Flask, Silex, Codeignighter, Django and considered trade offs each one brings)

In a URL route lets say that '/' delimits segments, and anything between matching '<' and '>' pairs is a segment pattern.  Each segment may contain either static text or a segment pattern.  Segment patterns cannot span '/' separators.

1. Suggest use symbols to define string and integer types in segment patterns. ":" = "str", "#" = int (are other types necessary?).  So ':' is no longer a delimiter.
@expose('/index/<:company>/<#ssd>')
def index(company, ssd):
  '''company is a string, ssd is an int'''

2. Up to one question mark may be included immediately before any '/' to indicate the remaining segment patterns are all optional (and consequently map to non-required attributes which may have defaults).  By specifying a single point in the route beyond which matching segments are optional, it's harder to write ambiguous route definitions.
@expose('/index/<:company>/<#ssd>?/<#favourite>')
def index(company, sad, favourite=None):

@expose('index/<:company>/<#ssd>?/<#favourite>/<#last_visited_article>')
def index(company, ssd, favourite=None, last_visited_article=1):

3. Perhaps use "*" as wildcard to match text (including '/') but there may be good security reasons not to allow?  The constraint could be that no segment patterns may follow.  Also only one per route.  Always a string.
@expose('index/<:company>/<#ssd>?/<*rest_of_url>')
def index(company, ssd, part_of_url='not provided'):

@expose('index/<:company>/<#ssd>/<*part_of_url>/some-static-text')
def index(company, ssd, part_of_url):

4. Regex.  Must match whole segments - i.e. shouldn't be able to split a section into multiple parameters with a regex. Keep type - so regex match is still passed through as string or int.  (E.g. the 4-digit year is passed through as 'int' here.).  It's not really a validator but could be abused that way.
@expose('index/<:company|[A-Za-z ]{3,20}>/<#year|[0-9]{4}>')
def index(company, year):

Cheers
Rob

Massimo Di Pierro

unread,
Dec 10, 2012, 7:33:46 PM12/10/12
to web...@googlegroups.com
web3py does that already. Although it does not support the exact syntax you proposed. Did you try it?

Robert Clark

unread,
Dec 10, 2012, 9:51:53 PM12/10/12
to web...@googlegroups.com
Nice, that is great news that it already behaves like this :). Definitely gets my vote.

I couldn't see these details elaborated in the web3py thread so was aiming to suggest some clear rules.   Guess that makes these suggestions syntactic only.

Still to try web3py, will do soon.

--
 
 
 



--
robert...@niftybean.com
nz.linkedin.com/in/robertclarknz
twitter.com/robot88

Niftybean Productions Ltd · niftybean.com
PO Box 11463 · Manners Street Central · Wellington 6142 · NZ
021.146.9675 · 04.478.2968

Arnon Marcus

unread,
Dec 18, 2012, 4:04:10 AM12/18/12
to web...@googlegroups.com
Has anybody taken a look at this?

http://tomerfiliba.com/blog/Hypertext/

My first reaction was "oh my, the poor guy is reinventing the wheel that already exists in web2py..."
Then a friend of mine pointed out that:
"
...context managers allow your code structure to correlate to the the html layout, through nesting blocks. that's the key difference
"

Is he correct?
Could this be implemented in web3py's HTML helpers?

Massimo Di Pierro

unread,
Dec 18, 2012, 11:46:19 AM12/18/12
to web...@googlegroups.com
No question he is reinventing web2py helpers. They look almost identical. In fact an acknowledgement would be in order. Web2py helpers have been around almost unchanged since Oct 2007.

I agree he is adding context managers. We did not create them not because we did not think about them but because we were supporting python 2.4 which does not have a with statement.

There is a problem with minima's syntax.
It can do

   with div.myclass: ....

but this means you cannot "myclass" be a name of a method or attribute of div. Also you cannot do

   with div#myid: .... 

so this tries use the css / haml syntax in Python but only partially succeed.

In web3py we have helpers.py which are almost identical to web2py helpers but faster and simpler. I just added contexts (it took 10 lines of code, pretty much the same as in minima's, I will post the code later today).


It allows this:

from web3py helpers import tag
div, h1, p = tag.div, tag.h1, tag.p

with div(_class='test') as html:
    h1('title')
    p('hello world')
print html

I like it. It is slightly different from minima's but it will stay in. Perhaps we should backport it to web2py.

Massimo 

Arnon Marcus

unread,
Dec 20, 2012, 5:16:54 AM12/20/12
to web...@googlegroups.com
Cool (!)

Do the HTML helpers support HTML5's " data-* " attributes?
Can that be used for javascriupt frameworks like Knockout.js or Angular.js ?

Massimo Di Pierro

unread,
Dec 20, 2012, 9:58:25 AM12/20/12
to web...@googlegroups.com
They always did although the syntax is cumbersone

DIV('content',**{'data-something':'something value'})

Niphlod

unread,
Dec 20, 2012, 10:07:21 AM12/20/12
to web...@googlegroups.com
correction, the _ in front is needed as always .... DIV('content',**{'_data-something':'something value'})

Massimo Di Pierro

unread,
Dec 20, 2012, 10:17:48 AM12/20/12
to web...@googlegroups.com
Oops. right. I wish there was a simple syntax but I cannot think about one. 

Arnon Marcus

unread,
Dec 20, 2012, 5:09:12 PM12/20/12
to
Pfff...

The creator of web2py says he wishes he could do web3py some other way, but can't...

Am I the only one that finds that funny? :)

web3py will end up however you wish it to end up as...

You can do whatever you want with it, as it's already inherently backwards incompatible (python 3.x), and is not even fully planned yet...

If anyone at any time could change things, it would be you guys and at this time...

How about putting auxiliary attributes "front and center"?
Data-* attributes are already a part of the standard of HTML5 and most-if-not-all browsers support them.

Single-Page apps are also not even considered a novelty anymore, and we're in a Renaissance of data-binding frameworks...

I mean, I guess I could do this:

def DATA(name, value):
    return {('_data-' + name):str(value)}
    

Then:

DIV( "{{MyVar}}", **DATA( "ng-controller", "MyController" ) )
=>
DIV( "{{MyVar}}", **{ "_data-ng-controller": "MyController" } )
=>
<div data-ng-controller="MyController">{{MyVar}}</div>

and:

DIV( "{{MyVar}}", **DATA( "bind", "text: MyVar" ) )
=>
DIV( "{{MyVar}}", **{ "_data-bind": "text: MyVar" } )
=>
<div data-bind="text: MyVar">{{MyVar}}</div>


But hell, you can make the TAG classes able to receive DATA class-instances, that other people can sub-class/modify to implenet the interface for different frameworks.

A generic DATA class may look something like this:

class DATA:

    namespace = ""
    
    aggregate = False
    seperator = ": "
    delimiter = ", "

    def __init__(self, **attrs):
        self.attrs = dict(**attrs)
        ...

    def parse( self ):
        parsed = ""
        
        if aggregatre:
            parsed += 'data-' + ns + '="'
            for k, v in items(self.attrs):
                parsed += k + seperator + v + delimiter
            parsed = parsed[:-len(delimiter)] + '"'            
        else:
            ns  = namespace + '-' if namespace else ''
            for k, v in items(self.attrs):
                parsed += 'data-' + ns + k + '="' + v + '"'
        
        return parsed  


And have your TAG classes do something like:

class <TAG>:
    def __init__(self, content, *vars, **args):
        ...
        parsed = [ var.parsed() for var in *vars if isinstanceof(var, DATA) ]
        ...
        <use parsed somehow>
        ...


Angular guys may then do something like this:

DATA.namespace = "ng"
BUTTON( "Delete", DATA( click="destroy()", show="project._id".) )
=>
<button data-ng-click="destroy()" data-ng-show="project._id">Delete</button>

or:

class ngDATA( DATA ):
    namespace = "ng"

+ <use ngDATA instead of DATA in the html helpers>


Knockout guys could do this:

DATA.namespace = "bind"
DATA.aggregate = True
SELECT( "", DATA( options = "$root.availableMeals",
                                   value = "meal".
                                   optionsText = "'mealName'" ) )
=>
<select data-bind="options: $root.availableMeals, value: meal, optionsText: 'mealName'"></select>

or:

class koDATA( DATA ):
    namespace = "bind"
    aggregated = False

+ <use koDATA instead of DATA in the html helpers>


More advanced usages can then sub-class DATA and just re-implement the parse function...


What say you?

Anthony

unread,
Dec 20, 2012, 5:47:27 PM12/20/12
to web...@googlegroups.com
On Thursday, December 20, 2012 5:02:45 PM UTC-5, Arnon Marcus wrote:
Pfff...

The creator of web2py says he wishes he could do web3py some other way, but can't...

I don't think he said that. He wasn't talking about web3py at all -- this is in reference to web2py. He was just noting the Python limitation regarding the naming of function arguments (which the HTML helpers use as attribute names). If we want attribute names that are not legal Python function arguments, we either need to use the **{'attribute': 'value'} syntax or some other alternative way to pass in the attributes. You have proposed an alternative, but probably could have done so without the attitude.

Anthony

Arnon Marcus

unread,
Dec 20, 2012, 7:23:23 PM12/20/12
to web...@googlegroups.com
LOL.. You got me all wrong! :)

I meant no disrespect, I adore Massimo!
Massimo - You Da Man!

I was just teasing a little, is all...
You know, the way he said that it could have sounded as if he was frustrated from not being able to change his own creation - it's like a clay-sculptor staring at his clay, saying "I wish I could mold that... A shame it's made out of clay..." :P

And this is a web3py thread, so I think I got the context right...

I know about the "-" problem not being able to get used within a function-argument-name, while being required as a tag-attribute-name by the HTML5 standard for full compliance.

I'm just saying: "So what?" Who's to say that the expected arguments in the HTML-helpers must be regular arguments? Client-side frameworks are already overloading/abusing/nesting this attribute like crazy anyway, so why not make a special class for it to begin with? It IS a special kind of argument, even by HTML5's standards, why not treat it as such? I mean, it's not like we're stuck with the helpers the way they are, Massimo just said here that he's going to add context-managers to them, and even back-port that to web2py... My proposal doesn't even have to necessarily break backward compatibility...

Anthony

unread,
Dec 20, 2012, 8:36:47 PM12/20/12
to web...@googlegroups.com
OK, thanks for clarifying. So, when you asked the question about using HTML5 "data-" attributes, you were asking about how they would be supported in web3py, not how they are currently supported in web2py, correct? I think Massimo was answering for web2py.

Anyway, there's nothing stopping us from making a change in web2py as well. Maintaining backward compatibility doesn't prevent additions to the API -- we just can't change any old behavior (i.e., old code should continue to work the same).

Anthony

Massimo Di Pierro

unread,
Dec 21, 2012, 1:43:34 AM12/21/12
to web...@googlegroups.com
Actually I like your solution. It could be even easier.

class attr(object):
     def __init__(self,key,value):
          self.key=key
          self.value=value

class DIV(object):
    def __init__(self,*components,**attributes):
        self.components = []
        self.attributes = attributes
        for x in components:
             if isinstance(x,attr): self.attributes[x.key]=x.value
             else: self.components.append(x)

print DIV('hello','world',attr('data-something','value'),_class='myclass')
<div data-something='value' class='myclass'>helloworld</div>
        ...

DIV('hello','world',attr('data-something')='value')

        





On Thursday, December 20, 2012 4:02:45 PM UTC-6, Arnon Marcus wrote:
Pfff...

The creator of web2py says he wishes he could do web3py some other way, but can't...

Massimo Di Pierro

unread,
Dec 21, 2012, 1:44:31 AM12/21/12
to web...@googlegroups.com
Ignore the very last line. Cut and paste error.
Message has been deleted
Message has been deleted

apps in tables

unread,
Dec 22, 2012, 12:35:33 PM12/22/12
to web...@googlegroups.com
Hi Massimo,

Can webRTC be touched by web2py, (as a feature or as an example) , or by web3py ?

here is an example,

and its documentation,

Regards,

Ashraf

Massimo Di Pierro

unread,
Dec 22, 2012, 12:39:18 PM12/22/12
to web...@googlegroups.com
Very interesting. Looks like it completely client-side so it should work without problems with web2py.

Massimo

webpypy

unread,
Dec 22, 2012, 12:44:24 PM12/22/12
to web...@googlegroups.com
Do you prefer it as feature or example?

Massimo Di Pierro

unread,
Dec 22, 2012, 12:50:44 PM12/22/12
to web...@googlegroups.com
I do not understand the question.

webpypy

unread,
Dec 22, 2012, 12:55:16 PM12/22/12
to web...@googlegroups.com
I mean, do we expect a web2py example that use webRTC or do we expect a core feature in web2py(or web3py) that interface with the cam and mic?

Massimo Di Pierro

unread,
Dec 22, 2012, 1:51:28 PM12/22/12
to web...@googlegroups.com
At this time none of them since my priority if finish the book by next week. ;-)
After that we'll see. As I said before the library is client side. I am not sure there is anything web2py specific. An example would be nice.

Masimo

webpypy

unread,
Dec 22, 2012, 2:13:23 PM12/22/12
to web...@googlegroups.com
Thank you, Massimo.


Vinicius Assef

unread,
Dec 26, 2012, 7:41:46 AM12/26/12
to web...@googlegroups.com
No, this isn't. They use node.js on the server side: http://www.easyrtc.com/
> --
>
>
>

Alec Taylor

unread,
Dec 26, 2012, 8:14:16 AM12/26/12
to web...@googlegroups.com
+1 to WebRTC example app
> --
>
>
>

Shawn McElroy

unread,
Aug 25, 2013, 4:43:41 PM8/25/13
to web...@googlegroups.com
It has been quite some time since the topic was updated. So I was curious to the status of web3py. I know it's not done and I'm not asking for a release date. I am just wondering what is going on currently.

Derek

unread,
Aug 26, 2013, 3:17:02 PM8/26/13
to web...@googlegroups.com
Look here...

It appears the last time this thread was updated was the last time web3py was worked on.

Ron Chatterjee

unread,
Feb 10, 2016, 11:27:10 PM2/10/16
to web...@googlegroups.com
This may be a off topic, and I am not a python expert by any means, that said...wondering for web3py, are we still going to have the utf-8 and object format? I asked because somewhere I read python 3 support both string and utf-8. Data structure can be much more readable and easy to get into with string (dict, list ...) than the object space that is currently in the version of python we use. Any thoughts?

On Monday, November 26, 2012 at 11:39:05 PM UTC-5, User wrote:
I noticed a thread over in web2py-developers web3py - important! which was exciting to read.  I've flirted with web2py and there's a lot that I like about it.  For some reason I find web2py exciting whereas django doesn't provide that.  I've used Yii on the php side which is great framework as far as php goes and asp.net mvc which is great as well.  I'd love to work with python but the main thing making me hesitate with web2py is critical mass. 
 
It seems like it wouldn't be hard for web2py to really dominate the python web framework space if some of the core criticisms were addressed.  I'm not fully up to speed on what they are but I usually hear about unit testing and global variables.  It feels like there is a roadblock preventing the project from skyrocketing.  Python needs a rails.  I understand that the design decisions are by choice with pros and cons.
 
My questions are:
1. Will web3py likely address these often repeated core criticisms? (I saw point 5 from the thread linked to above: "5) No more global environment. Apps will do "from web3py import *" (see below)")
2. The developer thread is over in the developers section.  Will you have a more open forum for users (as opposed to developers) to have input on web3py?
 
 
Reply all
Reply to author
Forward
0 new messages