Skip to content

Releases: dflook/python-minifier

3.4.0

Choose a tag to compare

@github-actions github-actions released this 29 Sep 08:58
Immutable release. Only release title and notes can be modified.
3493fee

ℹ️ Note that python-minifier depends on the python interpreter for parsing source code,
and will output source code compatible with the version of the interpreter it is run with.

This means that if you minify code written for Python 3.11 using python-minifier running with Python 3.12,
the minified code may only run with Python 3.12.

Added

  • Python 3.15 support, including:
    • PEP 810 lazy imports
    • PEP 798 unpacking in comprehensions

Fixed

  • The combine imports transform now combines all runs of from imports that can be combined.
    Previously only a leading run of imports from the same module was combined.

3.3.0

Choose a tag to compare

@github-actions github-actions released this 04 Sep 19:38
Immutable release. Only release title and notes can be modified.
81892c6

ℹ️ Note that python-minifier depends on the python interpreter for parsing source code,
and will output source code compatible with the version of the interpreter it is run with.

This means that if you minify code written for Python 3.11 using python-minifier running with Python 3.12,
the minified code may only run with Python 3.12.

Added

  • New transform to remove if statement branches that have no effect because the condition is always True or False. This is enabled by default and can be disabled with the --no-remove-dead-branches option.
  • Constant folding can now fold boolean (and/or) and comparison (==, is, <, ...) expressions with literal operands.

Changed

  • The remove pass, remove asserts, remove literal statements and combine imports transforms now also apply within except handler and match case bodies, where they were previously skipped.

Fixed

  • The remove debug transform no longer removes branches if they affect the program, even though they aren't executed, e.g. they contain yield, a global/nonlocal declaration, or the only binding of a local name. It also now properly inlines the else branch.
  • Fixed producing invalid output for a match case guard that is a tuple, yield, or named expression, e.g. case x if (1, 2):.
  • Constant folding no longer emits a DeprecationWarning when folding ~ on a boolean (e.g. ~True) on Python 3.12 and later

3.2.0

Choose a tag to compare

@github-actions github-actions released this 31 Dec 19:50
Immutable release. Only release title and notes can be modified.
3f4c582

ℹ️ Note that python-minifier depends on the python interpreter for parsing source code,
and will output source code compatible with the version of the interpreter it is run with.

This means that if you minify code written for Python 3.11 using python-minifier running with Python 3.12,
the minified code may only run with Python 3.12.

Added

  • New --prefer-single-line option to use semicolons instead of newlines between top-level statements when there is no difference in output size. This doesn't make the output any smaller, but may be preferred.
  • Constant folding can now fold unary operators (e.g. -1, not True, ~0) in addition to binary operators.

3.1.1

Choose a tag to compare

@github-actions github-actions released this 11 Dec 21:34
Immutable release. Only release title and notes can be modified.
2d066ae

ℹ️ Note that python-minifier depends on the python interpreter for parsing source code,
and will output source code compatible with the version of the interpreter it is run with.

This means that if you minify code written for Python 3.11 using python-minifier running with Python 3.12,
the minified code may only run with Python 3.12.

Fixed

  • The remove debug transform could incorrectly remove if branches that did not test __debug__

3.1.0

Choose a tag to compare

@github-actions github-actions released this 10 Oct 08:50
Immutable release. Only release title and notes can be modified.
213434f

ℹ️ Note that python-minifier depends on the python interpreter for parsing source code,
and will output source code compatible with the version of the interpreter it is run with.

This means that if you minify code written for Python 3.11 using python-minifier running with Python 3.12,
the minified code may only run with Python 3.12.

Added

  • Python 3.14 support, including:
    • PEP 750 Template strings (t-strings)

Fixed

  • Failure to minify modules with special characters appearing in f-strings (e.g. null)

3.0.0

Choose a tag to compare

@dflook dflook released this 13 Aug 15:38
Immutable release. Only release title and notes can be modified.
d24f6fe

ℹ️ Note that python-minifier depends on the python interpreter for parsing source code,
and will output source code compatible with the version of the interpreter it is run with.

This means that if you minify code written for Python 3.11 using python-minifier running with Python 3.12,
the minified code may only run with Python 3.12.

Fixed

  • Better support of unicode on platforms that do not use UTF-8 as the default encoding.
    This should fix issues with minifying files on Windows, and possibly other platforms with very old Python versions.

    If you are still using Python 2.7 this could be a breaking change - the pyminify command is unchanged, but the minify() function now returns unicode strings.

2.11.3

Choose a tag to compare

@dflook dflook released this 12 Nov 16:12
Immutable release. Only release title and notes can be modified.
ca4cba5

ℹ️ Note that python-minifier depends on the python interpreter for parsing source code,
and will output source code compatible with the version of the interpreter it is run with.

This means that if you minify code written for Python 3.11 using python-minifier running with Python 3.12,
the minified code may only run with Python 3.12.

Fixed

  • The special behaviour of assignment expression target binding inside comprehensions was not correctly implemented.

    This could lead to the analysed scope of these variables being incorrect and the variable being renamed to a name that was already in scope.

2.11.2

Choose a tag to compare

@dflook dflook released this 03 Oct 21:46
Immutable release. Only release title and notes can be modified.
0ada486

ℹ️ Note that python-minifier depends on the python interpreter for parsing source code,
and will output source code compatible with the version of the interpreter it is run with.

This means that if you minify code written for Python 3.11 using python-minifier running with Python 3.12,
the minified code may only run with Python 3.12.

Fixed

  • Using the positional only parameter separator / in method definitions could cause the following parameter to be
    incorrectly renamed in place, which could lead to failure if the method was called with that parameter as a keyword argument.
    This has been fixed.

2.11.1

Choose a tag to compare

@dflook dflook released this 29 Sep 17:45
Immutable release. Only release title and notes can be modified.
7d1c371

ℹ️ Note that python-minifier depends on the python interpreter for parsing source code,
and will output source code compatible with the version of the interpreter it is run with.

This means that if you minify code written for Python 3.11 using python-minifier running with Python 3.12,
the minified code may only run with Python 3.12.

Fixed

  • Using the --remove-class-attribute-annotations option together with --rename-globals was incorrectly causing class attributes to be renamed. Both of these options are unsafe for arbitrary code and are disabled by default but this was not the intended behavior, and has been fixed.

2.11.0

Choose a tag to compare

@dflook dflook released this 26 Sep 22:02
Immutable release. Only release title and notes can be modified.
3daead3

ℹ️ Note that python-minifier depends on the python interpreter for parsing source code,
and will output source code compatible with the version of the interpreter it is run with.

This means that if you minify code written for Python 3.11 using python-minifier running with Python 3.12,
the minified code may only run with Python 3.12.

Added

  • Python 3.13 support, including:
    • PEP 696 Type parameter defaults