Skip to content

Releases: sqlalchemy/mako

1.4.1

Choose a tag to compare

@sqla-tester sqla-tester released this 05 Aug 06:11

1.4.1

Released: Wed Aug 5 2026

bug

  • [bug] [installation] Fixed issue in the 1.4.0 packaging where the repository's internal
    tools/ directory was detected by setuptools package discovery and
    installed as a top-level tools package into site-packages, shadowing
    unrelated tools packages belonging to other applications. Package
    discovery is now limited to the mako package explicitly.

    References: #438

1.4.0

Choose a tag to compare

@sqla-tester sqla-tester released this 04 Aug 18:20

1.4.0

Released: Tue Aug 4 2026

changed

  • [changed] [examples] The examples/bench folder has been removed as it used mostly
    long-obsolete template engines. The examples/wsgi/run_wsgi.py example
    has been updated to remove the use of the removed-in-Python-3.13 cgi
    module, and to be runnable as a module from the project root.

  • [changed] [installation] Minimum MarkupSafe dependency version bumped from 0.9.2 to 2.0.

  • [changed] [tests] The test suite now runs via nox. The old tox.ini remains however nox will
    be the only system that's maintained.

  • [changed] [installation] Project metadata has been migrated to PEP 621 pyproject.toml-based
    configuration. setup.cfg remains only for the [mako_testing]
    section used by Mako's own test suite. The build requirements
    now set the minimum setuptools version at 77.0.0 in order to build Mako
    from source.

  • [changed] [installation] Minimum Python version is now 3.10. Mako 1.4.0 has been tested up through
    Python 3.15.0b4.

bug

  • [bug] [ext] The minimum Lingua version supported by LinguaMakoExtractor is
    now 4.16. The test suite had continued to pin Lingua below 4 long after
    the extractor itself was repaired to work with Lingua 4 in version 1.2.0,
    with the result that the plugin was no longer covered by tests at all; the
    pinned version additionally imports pkg_resources at startup, which is
    not present in current setuptools releases and left the package
    unimportable. Lingua 4.16 resolves entry points using
    importlib.metadata, so no deprecated pkg_resources usage remains.

    References: #393

  • [bug] [exceptions] Fixed issue where formatting a traceback for an exception raised inside a
    template compiled from a string would emit DeprecationWarning: Module globals is missing a __spec__.loader on Python 3.15. Modules for such
    templates were created without a module spec, which Python's
    linecache module consults for every frame while a traceback is
    being built; the warning was raised from within traceback formatting
    itself, disrupting the error report for applications that configure
    warnings as errors. These modules are now given a spec with a loader that
    provides the generated module source, which additionally allows the
    generated source lines to be displayed in tracebacks produced by the
    standard library where previously no source was available.

    References: #437

  • [bug] [exceptions] A series of fixes involving syntax warnings and exceptions found
    during template lexing / compilation:

    -   Warnings raised while a template is compiled, which in practice means
        `SyntaxWarning`, now report the filename and line number of the
        template rather than a line within the generated module, and are no
        longer reported twice.  This applies equally to templates compiled from a
        string, from a file, and to a module file in a
        `Template.module_directory`, as does a warning raised while
        the module level code of a `<%! %>` block runs.  Warnings raised while
        a template renders continue to report the location within the generated
        module.
        
        To do this, Mako replaces `warnings.showwarning` while a template is
        compiled.  As that name is global to the process, an unrelated warning
        displayed by another thread during that window may also be passed through
        Mako's hook, which shows any warning it does not recognize unchanged.
        ([#430](https://github.com/sqlalchemy/mako/issues/430))
    
    -   The `SyntaxException` raised for a syntax error in Python code spanning
        several lines of a template, such as that within a `<% %>` or `<%! %>`
        block, is now reported against the line the error is on, rather than
        against the line on which the block begins.  The line reported for code
        that occupies a single line, such as an expression or a control line, is
        unchanged. ([#245](https://github.com/sqlalchemy/mako/issues/245))
    
    -   The `SyntaxException` raised for a tag or expression that is never
        closed is now reported against the line the construct begins on, rather
        than the point at which the search for the closing token gave up, which
        for an unclosed construct is the end of the template.  The message of the
        exception is amended to indicate that the position given is where the
        unterminated construct begins. ([#428](https://github.com/sqlalchemy/mako/issues/428))
    

    References: #245, #428, #430

1.3.12

Choose a tag to compare

@sqla-tester sqla-tester released this 28 Apr 19:01

1.3.12

Released: Tue Apr 28 2026

bug

  • [bug] [template] Fixed issue in TemplateLookup where a URI with backslash path
    separators (e.g. \..\secret.txt) could bypass the directory traversal
    check on Windows, allowing reads of arbitrary files outside of the template
    directory. Backslash characters in URIs are now normalized to forward
    slashes before path resolution.

    References: #435

1.3.11

Choose a tag to compare

@sqla-tester sqla-tester released this 14 Apr 20:19

1.3.11

Released: Tue Apr 14 2026

bug

  • [bug] [template] Fixed issue in TemplateLookup where a URI with a double-slash
    prefix (e.g. //../../) could bypass the directory traversal check in
    Template, allowing reads of arbitrary files outside of the
    template directory. The issue was caused by an inconsistency in how leading
    slashes were stripped between TemplateLookup.get_template() and
    Template initialization.

    References: #434

1.3.10

Choose a tag to compare

@sqla-tester sqla-tester released this 10 Apr 12:50

1.3.10

Released: Thu Apr 10 2025

bug

  • [bug] [lexer] Fix undefined variable errors when strict_undefined=True when using a
    nested list comprehension. Pull request courtesy Sébastien Granjoux.

    References: #418

1.3.9

Choose a tag to compare

@sqla-tester sqla-tester released this 04 Feb 15:05

1.3.9

Released: Tue Feb 4 2025

bug

  • [bug] [tests] Fixed test suite to not rely upon ancient "future division" statement to
    test the Template.future_imports feature. The test is
    replaced with one that tests only the rendering, not the ultimate effect.

    References: #408

1.3.8

Choose a tag to compare

@sqla-tester sqla-tester released this 07 Dec 18:41

1.3.8

Released: Sat Dec 7 2024

bug

  • [bug] [lexer] Reverted the fix for #140 released in Mako 1.3.7 as it produced
    regressions in existing user code.

    References: #140, #415

1.3.7

Choose a tag to compare

@sqla-tester sqla-tester released this 03 Dec 18:58

1.3.7

Released: Tue Dec 3 2024

bug

  • [bug] [codegen] [lexer] During the lexical analysis phase, add an additional prefix for undeclared
    identifiers that have the same name as built-in flags, and determine the
    final filter to be used during the code generation phase based on the
    context provided by the user. Pull request by Hai Zhu.

    References: #140

  • [bug] [lexer] Support the direct passing of dictionary literals when calling functions
    and fix the errors caused by nested braces. This revises the fix that was
    released in 1.3.4 and then reverted in 1.3.5. Pull request by Hai Zhu and
    Jose Galvez.

    References: #400, #401

1.3.6

Choose a tag to compare

@sqla-tester sqla-tester released this 21 Oct 21:53

1.3.6

Released: Mon Oct 21 2024

bug

  • [bug] [lexer] Fixed long standing bug where the sequence <& would be misinterpreted
    by the lexer. It's not clear why the ampersand character was part of the
    characters being consumed here and it may have been an inadvertent bit of
    code from one of Mako's predecessor languages.

    References: #412

1.3.5

Choose a tag to compare

@sqla-tester sqla-tester released this 14 May 12:22

1.3.5

Released: Tue May 14 2024

bug

  • [bug] [lexer] [regression] Reverted the fix for #400 as it caused new issues when traversing
    some bracketed situations.

    References: #400, #401