dflook / python-minifier

Transform Python source code into its most compact representation
MIT License
558 stars 41 forks source link

Default-replacement in case a module uses __doc__ on remove_literal_statements=True? #38

Open phorward opened 2 years ago

phorward commented 2 years ago

Hey there!

First of all, thanks for providing this useful piece of software! It should be improved and find more friends in the Python community.

In a pull request for Pyodide, my idea was to strip down the entire Python standard library using python-minifier to reduce download bandwidth, using the --remove-literal-statements-flag. Pyodide is a port of the CPython interpreter as web-assembly, running a Python in the browser. Therefore, making the standard library as small as possible is perfect use-case for python-minifier.

I've seen in the documentation, that the remove_literal_statements-option is retained when the module uses the __doc__ name, which is the case in some modules of the Python standard library, for example in ssl.py.

My question for this issue: Would it be an choice to provide a further command-line option for replacing the doc-strings in a module in this case by either an empty string or something like "stripped by python-minifier" or something similar? This would also safe some more space, especially in this use-case.

Thanks a lot for any support.

dflook commented 2 years ago

Hi @phorward, that's a great idea.

phorward commented 2 years ago

Hi @phorward, that's a great idea.

Thank you, I did a first pull request as a draft in #39.