Pecan a lean Python web framework
pecanpy.orgI 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.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.
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.
What's wrong with Flask, or the better question is. What does Pecan do better than Flask?
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.
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.
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?
Is it leaner than bottle or flask?
It diesn't seem as clean on a first glance?
Can you be specific about what doesn't seem as clean?
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.
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.
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?
What use is a web framework that "includes no out of the box support for things like sessions or databases?"
Flask doesn't include an ORM either, and it's very popular. For example.
this is where "light-weight" comes in. you could do something like use werkzeug's secure cookies and sqlalchemy for sessions and databases respectively.