bottlepy / bottle

bottle.py is a fast and simple micro-framework for python web-applications.
http://bottlepy.org/
MIT License
8.4k stars 1.46k forks source link

import bottle.ext... not pythonic #1063

Open avelino opened 6 years ago

avelino commented 6 years ago

example:

from bottle.ext import sqlalchemy

It is not very pythonic, we are bringing spells (not leaving explicit where the package comes from).

This python:

...
Explicit is better than implicit.
...

What's your opinions?

provinzkraut commented 6 years ago

You'd have my support for explicit import!

The current way unnecessarily hides information.

oz123 commented 6 years ago

What's your concrete suggestion?

avelino commented 6 years ago

My suggested is explicit import, not more proxy (bottle.ext.)

oz123 commented 6 years ago

I think there are many examples already doing that.

PyB1l commented 6 years ago

I think that explicit import is the best way to go for many reasons. Although I believe that python "magic" could work in some scenarios to provide a nice API, in this case i agree that explicit import in this case is better. For instance:

1) New (python) users that chose bottle.py for a single project for it's simplicity should not have to deal with this.

2) Decouple from package management: Instead of

from bottle.ext.jwt import JWTPLugin the equilevant

from bottle_jwt import JWTPlugin

is more clear. Image the confusion with two different plugins with similar name conventions.

avelino commented 6 years ago

@defnull what you opinion?