Settings

Theme

Pecan a lean Python web framework

pecanpy.org

49 points by poissonpie 12 years ago · 17 comments

Reader

codegeek 12 years ago

I have been learning Flask for a while and any other python based light frameworks are of interest. This looks promising with its own set of conventions but one thing that immediately caught my eye is this:

    pecan create test_project
Essentially, it creates a barebone project with a list of pre-defined folders/files. For me, this is not very useful as I actually prefer to create my own. In fact, as you get to a decent sized project, you always end up customizing the structure of the app and hence a barebone structure even though sounds good actually becomes unusable. For a lightweight framework, I really don't want any app structure conventions done for me. Let me do that.
  • mildtrepidation 12 years ago

    Essentially, it creates a barebone project with a list of pre-defined folders/files. For me, this is not very useful as I actually prefer to create my own.

    Unless this command is vastly more opinionated (and less bare-bones) than Django's startapp/startproject, and with only what you've written to go on, I get the impression that what you're doing here is killing part of the benefit a framework gives you: The ability for others with framework experience to (relatively) quickly pick up your projects and work on them.

    I've worked on several projects that did similar things in addition to many that more strictly followed their framework's conventions, and choice of framework aside, when you're using something lightweight already but ignoring its conventions, you might as well be rolling your own.

    If that's not something that's important to you when choosing a framework, for whatever reason, then I can see this being OK (if not useful). But I don't think it's a good habit to get into if you are likely to pass off your work to others or need to bring in outside help in the future.

  • fingerprinter 12 years ago

    I actually love this option, particularly when learning something new. I actually wish Flask had this with some options to preselect libs.

    Padrino uses generators[1] for this and while they might have too many options, something like this for Flask would be fantastic, IMO.

    [1] - http://www.padrinorb.com/guides/generators

nubela 12 years ago

What's wrong with Flask, or the better question is. What does Pecan do better than Flask?

  • rch 12 years ago

    It looks like they might claim: "object-dispatch style routing"

    Maybe I'm missing something, but I don't see a substantial improvement over Flask's (or even Werkzeug's) approach.

    • dkuntz2 12 years ago

      It also looks like it generates a lot of boilerplate stuff for you.

      I personally prefer Flask's simplicity of "do as you will" over "here's an entire project for you" that lots of frameworks use.

mattlutze 12 years ago

I'm having trouble understanding from the paragraph intro on the site, why I would need this in the growing market of python-in-my-browser tools. I've used the language mostly as scripts to process piles of data -- if I were to get into generating web content, why this over one of the "inspirations" or other packages?

dorfsmay 12 years ago

Is it leaner than bottle or flask?

It diesn't seem as clean on a first glance?

  • pekk 12 years ago

    Can you be specific about what doesn't seem as clean?

    • dorfsmay 12 years ago

      With bottle, you don't need the ProfileSchema nor the ProfileController, hello world is literally 5 lines.

      I know that everything is a tradeoff, bottle.py has A LOT of limitation, but to me it is the lean'est python framework. Heavy framework (WAY more features) would be django and pyramid, and midle of the road cherrypy. I'm not sure where Pecan fits in that picture.

      • murali44 12 years ago

        Pecan is definitely not as light weight as flask. Creating a simple hello world requires multiple files and multiple classes. Flask is super light weight in that regard. Which is why I use flask for quick hacking on personal projects.

        Pecan on the other hand has a lot of great features built in, such as ORM, built in templates, etc. Pecan is a popular choice over flask for large scale projects.

        • dorfsmay 12 years ago

          ORM and templates:

          I personally dislike framework forcing their ORM and templates engines, I prefer when they let me pick the ones I want. Trying to use Django was extremely weird for that reason. bottle does this kind of integration really well.

          Can Pecan do https (my biggest issue with most "lean" framework)?

          How much lighter / simpler is it compared to cherrypy then?

dudus 12 years ago

can someone name that vim color-scheme?

pc86 12 years ago

What use is a web framework that "includes no out of the box support for things like sessions or databases?"

  • pekk 12 years ago

    Flask doesn't include an ORM either, and it's very popular. For example.

  • jpwagner 12 years ago

    this is where "light-weight" comes in. you could do something like use werkzeug's secure cookies and sqlalchemy for sessions and databases respectively.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection