Skip to content

2.9.0

Latest
Compare
Choose a tag to compare
@dflook dflook released this 01 May 12:18
· 34 commits to main since this release
fd3dee4

Added

  • A new transform to remove return statements that are not required, which is enabled by default.
    e.g.
def important(a):
   if a > 3:
       return a
   if a < 2:
       return None
   a.adjust(1)
   return None

Will be minified to:

def important(a):
    if a > 3:
        return a
    if a < 2:
        return
    a.adjust(1)
  • The f-string debug specifier will now be used where possible, e.g. f'my_var={my_var!r}' will be minified to f'{my_var=}'.
    The debug specifier should now be preserved where it is used in the input source.

  • Many small improvements to minification to be more precise about where whitespace or parentheses required

    • Thanks luk3yx for improving whitespace in relative import statements.
    • A generator as the sole argument to a function call is no longer wrapped in parentheses
    • float literals can use a more compact scientific notation
    • Many more subtle improvements