Tool Ren'Py RenPurge: Refactor like a lamborghini

Mar 2, 2020
76
57
As you might know, during development of a renpy game, moving/renaming files around and/or switching git branches can mess up your renpy project requiring a manual .rpyc cleanup. You can opt for your OS' file search, but good luck with that.

Enter RenPurge, a simple python script to couple-click all this headache away:
auf.png
What it does is, deletes files of certain extensions:
derp.png
And optionally cleans up empty folders.
Leave .rpyc in only if you know the implications of doing so.



How-to:
0) download the git repo release .exe or grab a git repo main.py. If you're using the .py, you can figure out the rest.
1) drop RenPurge.exe into your project/game folder. If you end up using any other folder I'm not responsible for your results. : )
1.5) You can also use sth like project/game/buildExcluded and set "jump one dir up" to true in the config file.
2) The config file will be created on first launch. You can either proceed with defaults or quit & tweak at this point.
3) Push y and enjoy.

Designed to be ran after you move/rename/delete a bunch of .rpys or switch change-heavy branches, this program won't magically fix your gig but can save you a minute or two.
Stay thirsty. <3
 
Last edited:

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,111
14,790
What it does is, deletes files of certain extensions:
Do not delete .rpyc files unless you also deleted the corresponding .rpy file.

It break the internal references, what then:
  • Break the skip feature ;
  • Break the translation ;
  • Make the call stack obsolete, the game wouldn't know where it have to return ;
  • Break the "from clause", renewing them all, what remove all the interest of the feature ;
  • Can lead to save compatibility issues, making Ren'Py unable to know where it should continue (at most the player have to restart the whole label, at worse the save file is totally useless) ;
  • Can break the rollback, making it not working until the moment its stack have been totally renewed.

And I'm not sure that I don't forget some others issues.
 
Mar 2, 2020
76
57
Do not delete .rpyc files unless you also deleted the corresponding .rpy file.
It's a development tool. Like, at project stage, not for a released build.
Try rename your somescript.rpy & launch the project, you'll end up with duped entries from all over the .rpyc's.
"force recompiling" will drown you in redundant backups eventually.
Most of the issues listed are irrelevant here.
The only concern might be, save compat in case you've done some heavy changes to an ongoing project.
But if you did, you're most likely in a world of no-compat at that point.

Anyway, perhaps I should have made the purpose behind this clear in the OP.
...
Also, you could just erase the .rpyc out of extensions list if your gig needs em so much.(y)
 
Last edited:

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,111
14,790
It's a development tool. Like, at project stage, not for a released build.
Presented on a scene where ~80% of the games are released by updates ; therefore while still being at development level.


Try rename your somescript.rpy & launch the project, you'll end up with duped entries from all over the .rpyc's.
Of course you'll have duplicated entries, .rpyc files are not decoration. They contain the code of the game once "compiled" ; the quotation marks being here because, while it's the official denomination, it's a misuse of the word.
It's on them that Ren'Py rely to process the game. The .rpy files are secondary in Ren'Py eyes, they contain the source code, and can perfectly be missing without it having an impact on the game ; at least as long at the equivalent .rpyc files exist.
So, if you rename "somescript.rpy", just rename the .rpyc file accordingly, same if you move it, period.


But anyway, like .rpy(c) files don't need to be declared to be processed, while their name and location are totally irrelevant by themselves, there's only one case where you effectively need to rename or move one ; when an early python block, or an init block, used in one file need to be processed before the content of another file. In this case, moving the sole early python block, or init one, would be more efficient, because moving the whole file can lead to other incompatibilities, especially in the case of an early python block.
In all other cases, the name and location of the file have absolutely no meaning except for the developer himself.
Since this meaning depend on the content of the file, there's no reason for it to change during the development process, and if it happen, it's because he put in this file content that have nothing to do in it.
 
Mar 2, 2020
76
57
The prescriptive nature of your 2nd paragraph goes outta window once you end up in a prolonged, evolving, less-VN-like project that has more than 2 programmers involved.

Appreciate a thorough explanation though!
I'll just update OP a bit to make sure people dont shoot themselves in the foot. <3
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,111
14,790
The prescriptive nature of your 2nd paragraph goes outta window once you end up in a prolonged, evolving, less-VN-like project that has more than 2 programmers involved.
Unless one read the documentation:
" "
 

osanaiko

Engaged Member
Modder
Jul 4, 2017
2,092
3,337
I was gonna make the same comment as Anne'o about the foot-gun potential of deleing rpyc, but I'm glad a friendly conclusion was reached. Thanks for releasing the tool, it looks like a nice useful script.
 
  • Like
Reactions: The Masked Man