Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alembic's runtime doesn't need Mako #126

Closed
sqlalchemy-bot opened this issue May 24, 2013 · 9 comments
Closed

Alembic's runtime doesn't need Mako #126

sqlalchemy-bot opened this issue May 24, 2013 · 9 comments
Labels

Comments

@sqlalchemy-bot
Copy link

Migrated issue, originally created by g2p (@g2p)

I'm using Alembic for its runtime (alembic.migration and alembic.operations), which works well without the script generation portion.
Recent versions of MarkupSafe (0.16 released 3 days ago) break Python 3.2 support, which I'd rather keep for the sake of Debian users, and I would appreciate it if it was possible to have a PyPI name that provides Alembic's runtime without the Mako dependency. Moving Mako to an extras_require=dict(generation=['Mako']) in Alembic's setup.py would be ideal.

@sqlalchemy-bot
Copy link
Author

Michael Bayer (@zzzeek) wrote:

Mako shouldn't fail on python 3.2. Why not post a bug report for Mako ? I'm not sure what's supposed to happen here if someone types "alembic init" and it fails because Alembic didn't install it's dependencies. Wouldn't I get a bug report for that too?

@sqlalchemy-bot
Copy link
Author

g2p (@g2p) wrote:

alembic init might say: please run pip install "alembic[generation]" for script generation support.

It's not really a Mako bug, but from mako.template import Template (and from alembic.operations import Operations) currently fail on Python 3.2 after MarkupSafe's author rewrote it to use u'' literals; backtrace here. IMH reading that looks like aggressive promotion for the PEP he co-authored, and I hope he'll simply accept a reversion of those changes. It's fine if you wait for that to happen, but the extra dependency bugged me when I started relying on Alembic, and I'd be happy to work on making Mako an extra if you think it's a good idea.

@sqlalchemy-bot
Copy link
Author

g2p (@g2p) wrote:

Delaying the Mako import by moving template_to_file from util.py to script.py would be enough to move it out of the operations/migrations imports, if you're okay with that, and have less impact than changing Alembic's dependencies.
Thank you for the prompt fix with Mako 0.8.1.

@sqlalchemy-bot
Copy link
Author

Michael Bayer (@zzzeek) wrote:

Well you can't get markupsafe installed in Python 3.2 anymore, and Mako has always been OK at the import level, I'm not sure how you got from mako.template import Template to fail? Markupsafe can't be there since it won't install (unless you're just doing PYTHONPATH stuff).

@sqlalchemy-bot
Copy link
Author

g2p (@g2p) wrote:

Somehow I've installed it (with pip and Mako 0.8), even though it's not importable and doesn't install for everyone.

Re imports, here's the relevant bit from the backtrace.

>   from mako.template import Template
.tox/py32/lib/python3.2/site-packages/mako/template.py:10: in <module>
>   from mako.lexer import Lexer
.tox/py32/lib/python3.2/site-packages/mako/lexer.py:11: in <module>
>   from mako import parsetree, exceptions, compat
.tox/py32/lib/python3.2/site-packages/mako/parsetree.py:9: in <module>
>   from mako import exceptions, ast, util, filters, compat
.tox/py32/lib/python3.2/site-packages/mako/exceptions.py:255: in <module>
>   _install_highlighting()
.tox/py32/lib/python3.2/site-packages/mako/exceptions.py:254: in _install_highlighting
>           _install_fallback()
.tox/py32/lib/python3.2/site-packages/mako/exceptions.py:245: in _install_fallback
>       from mako.filters import html_escape
.tox/py32/lib/python3.2/site-packages/mako/filters.py:38: in <module>
>       import markupsafe
E File "/home/travis/build/g2p/bedup/.tox/py32/lib/python3.2/site-packages/markupsafe/__init__.py", line 68
E def __new__(cls, base=u'', encoding=None, errors='strict'):
E ^
E SyntaxError: invalid syntax

@sqlalchemy-bot
Copy link
Author

Michael Bayer (@zzzeek) wrote:

OK well that's markupsafe, blow it away from your 3.2 install and it'll be resolved. if somehow people are still managing to install markupsafe in their 3.2 folders they have to get on armin's case about that.

@sqlalchemy-bot
Copy link
Author

Michael Bayer (@zzzeek) wrote:

mako 0.8.1 wont install markupsafe; users shouldn't have markupsafe in their 3.2 folders and if they do, its a markupsafe bug

@sqlalchemy-bot
Copy link
Author

Changes by Michael Bayer (@zzzeek):

  • changed status to closed

@sqlalchemy-bot
Copy link
Author

g2p (@g2p) wrote:

Works for me. Moving template_to_file was just a defensive idea, I can let the CI catch any actual breakage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant