Closed veryheavypickle closed 2 years ago
python-minifier operates on a single module at a time. If a module is imported by anyone, you can't use --rename-globals
I understand. Could this be a feature request then? I understand that it is quite a complicated task. It could be done with the help of rope to refactor the name in the project.
Thank you for your quick response anyway and thank you for this amazing project that has helped a lot!
Say I have a local module called
utilities.py
with the functionIt's minified version would be
However when using
loadFile
in another file that importsutilities.py
, it still tries to call it asloadFile
even though it has been renamed toS
It may have something to do with the way I import my modules or my project layout which is
Where
main.py
before minifying ismain.py
after minifyingand
script.sh
I would assume that it would be complicated to detect importing local modules, then replacing the called function names with the updated names.
My usage of this module was to combine it with
stickytape
andpyarmor
to reduce the project size to below 32 KB so I could still use the free version ofpyarmor
, the --rename-globals option reduces the size by about a further 15%. So as you can imagine the example above is a simplification of the actual situation.