@@ -4,33 +4,88 @@ All notable changes to this project will be documented in this file.
44The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
55and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
66
7- ## [ 2.9.0] - 2023-05-01
7+ ## [ 2.10.0] - 2024-09-15
8+
9+ :information_source : Note that python-minifier depends on the python interpreter for parsing source code,
10+ and will output source code compatible with the version of the interpreter it is run with.
11+
12+ This means that if you minify code written for Python 3.11 using python-minifier running with Python 3.12,
13+ the minified code may only run with Python 3.12.
814
915### Added
10- - A new transform to remove ` return ` statements that are not required, which is enabled by default.
16+ - Python 3.12 support, including:
17+ - PEP 695 Type parameter syntax
18+ - PEP 701 Improved f-strings
19+
20+ - A new transform to remove the brackets when instantiating and raising built-in exceptions, which is enabled by default.
1121 e.g.
1222
1323 ``` python
14- def important (a ):
15- if a > 3 :
16- return a
17- if a < 2 :
18- return None
19- a.adjust(1 )
20- return None
24+ def a ():
25+ raise ValueError ()
2126```
2227
2328 Will be minified to:
2429
2530``` python
26- def important (a ):
27- if a > 3 :
28- return a
29- if a < 2 :
30- return
31- a.adjust(1 )
31+ def a ():
32+ raise ValueError
33+ ```
34+
35+ The raise statement automatically instantiates classes derived from Exception, so the brackets are not required.
36+
37+ - A new constant folding transform, which is enabled by default.
38+ This will evaluate simple expressions when minifying, e.g.
39+
40+ ``` python
41+ SECONDS_IN_A_DAY = 60 * 60 * 24
3242```
3343
44+ Will be minified to:
45+ ``` python
46+ SECONDS_IN_A_DAY = 86400
47+ ```
48+
49+ ### Changed
50+ - Annotation removal is now more configurable, with separate options for:
51+ - Removal of variable annotations (` --no-remove-variable-annotations ` )
52+ - Removal of function return annotations (` --no-remove-return-annotations ` )
53+ - Removal of function argument annotations (` --remove-argument-annotations ` )
54+ - Removal of class attribute annotations (` --no-remove-class-annotations ` )
55+
56+ The default behavior has changed, with class attribute annotations no longer removed by default.
57+ These are increasingly being used at runtime, and removing them can cause issues.
58+
59+ ### Fixed
60+ - Fixed various subtle issues with renaming of names that overlap class scope.
61+
62+ ## [ 2.9.0] - 2023-05-01
63+
64+ ### Added
65+ - A new transform to remove ` return ` statements that are not required, which is enabled by default.
66+ e.g.
67+
68+ ``` python
69+ def important (a ):
70+ if a > 3 :
71+ return a
72+ if a < 2 :
73+ return None
74+ a.adjust(1 )
75+ return None
76+ ```
77+
78+ Will be minified to:
79+
80+ ``` python
81+ def important (a ):
82+ if a > 3 :
83+ return a
84+ if a < 2 :
85+ return
86+ a.adjust(1 )
87+ ```
88+
3489- 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=}' ` .
3590 The debug specifier should now be preserved where it is used in the input source.
3691
@@ -199,6 +254,7 @@ def important(a):
199254- python-minifier package
200255- pyminify command
201256
257+ [ 2.10.0 ] : https://github.com/dflook/python-minifier/compare/2.9.0...2.10.0
202258[ 2.9.0 ] : https://github.com/dflook/python-minifier/compare/2.8.1...2.9.0
203259[ 2.8.1 ] : https://github.com/dflook/python-minifier/compare/2.8.0...2.8.1
204260[ 2.8.0 ] : https://github.com/dflook/python-minifier/compare/2.7.0...2.8.0
0 commit comments