Squiblydoo / debloat

A GUI and CLI tool for removing bloat from executables
BSD 3-Clause "New" or "Revised" License
301 stars 25 forks source link

Draft: Extract logic into a separate file, add basic CLI function #3

Closed nazywam closed 1 year ago

nazywam commented 1 year ago

Hi there!

I started working on refactoring the codebase to allow for a CLI. Here's a short list of what I've done in this PR so far:

Here's what still needs to be done before merging this into master main:

Squiblydoo commented 1 year ago

Awesome. Thanks for helping with this refactoring; these are definitely features I've been interested to work toward. I'll try running some tests in the next few days with a bunch of binaries.

Squiblydoo commented 1 year ago

I have a dozen or so binaries for testing specific use cases. In my review, the refactor did not break anything. I have checked that task as complete.

I've also started moving files and preparing a python stub for the 6th task. I still have some testing to do in order to ensure a stub is properly created.

I'm a novice as it comes to Python development, so I have more to do in regards to the 7th task. The plan is to review your changes to some of the variables, understand what you are doing/why, and then implement similar changes elsewhere once I understand the how and why.

Squiblydoo commented 1 year ago

Task 6: Stub completed. I've created the necessary files for pushing a release to PyPI. I've tested the release using Test.PyPI.org. From the package on Test.PyPI a user can install Debloat. Debloat can then be executed with the commands debloat or python -m debloat. The gui can be launched with debloat-gui or python -m debloat-gui. The processor file and functions can be imported into other scripts by calling import debloat.processor.

Squiblydoo commented 1 year ago

Task 6 and 7: processor.pyi stub was created using mypy stubgen. In my review, I don't believe main.py and gui.py need stubs, but feel free to correct me.

I finished updating all variable names to be consistent with your recommended format, and more consistent with PEP8. I read through the entirety of PEP8 and adjusted the scripts to be consistent with PEP8 and more consistent in general. I added more Type Hints for gui.py. Added doc strings to all methods.

Everything there seems to be in good working order. I've also pushed debloat to be live at PyPI: https://pypi.org/project/debloat/1.3.1/

With that, I am going to merge this branch into main and put out a new release.

nazywam commented 1 year ago

Great, thanks for working on rest of the issues!

Squiblydoo commented 1 year ago

Sure thing! Probably within the next week or so, I am planning to work on the processor to move some components into standalone methods to better support calling individual methods.

I have some ideas in regards to solving my riskiest debloat method (i.e. removing the overlay). If I'm unable to implement my idea, my alternative plan is to create a "safe" and "unsafe" mode. Where "safe" will remove the overlay only if I can ensure it will only remove junk and nothing else. "Unsafe" would be the current functionality, where it can sometimes remove important parts of the overlay.

In that regard, feel free to suggest additional improvements or submit additional pull requests that can help toward your use cases as well.

Squiblydoo commented 1 year ago

Seemed worth mentioning here for you and for citizens of the future: 1) I solved my riskiest debloat method: I can successfully remove bloat and preserve important parts of the overlay. 2) I implemented a "unsafe" feature, but it runs "safe" by default. If ran with the unsafe switch, it can choose to remove the whole overlay, but this should be rarely needed, if at all.