python-minifier icon indicating copy to clipboard operation
python-minifier copied to clipboard

Add setting to disable using semicolons to combine lines

Open Archmonger opened this issue 1 year ago • 1 comments

While I know that merging lines via semicolons is an attractive way to save character space, this really should be a feature that can be turned off.

I'm currently running into issues getting python-minifier to play nice with the WASM-based pyodide interpreter due to their lack of support for semicolons.

But in my opinion, there should be enough configuration options within the minifier(...) API to where if I set every boolean to false, then zero minification should occur.

Archmonger avatar Feb 09 '25 11:02 Archmonger

python-minifier parses a Python code module and then serializes it back to valid Python code. When all options to minify() are False, the output remains functionally identical, though formatting may differ since python-minifier does not preserve the original source formatting.

Semicolons are a valid part of the Python language, so it's surprising that Pyodide does not support them—I would expect to find them in Python modules in the wild.

We could consider adding an option in the future to control semicolon usage, as there have been requests both to use them more frequently and to avoid them entirely.

dflook avatar Feb 10 '25 10:02 dflook