Important Dates

Latest Posts

Topic: print statements and other files

kaputtnik
Avatar
Topic Opener
Joined: 2013-02-18, 20:48
Posts: 2514
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2024-01-23, 17:02

My addons are ready but i wait for the ui-plugins3 branch to be merged before i upload them. The last questions i have:

  • My scripts contain currently some print statements for informational purposes (e.g. memory consumption). I think they do not harm or are disturbing at all, but should they be removed?
  • I have also added a gimp .xcf-file to allow others to modify the used add-on icons. And of course to have anything in one place. Should those xcf-files also be removed?
  • Last but not least: I used git to manage my changes. Will the hidden folder .git be uploaded also? If so, can this be prevented?

Top Quote
Nordfriese
Avatar
Joined: 2017-01-17, 18:07
Posts: 2029
OS: Debian Testing
Version: Latest master
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2024-01-23, 19:04

My addons are ready but i wait for the ui-plugins3 branch to be merged before i upload them.

Merged a minute ago face-smile.png

  • My scripts contain currently some print statements for informational purposes (e.g. memory consumption). I think they do not harm or are disturbing at all, but should they be removed?

IMO it is cleaner to remove all such statements, but for add-ons, best coding practices are entirely optional face-wink.png

  • I have also added a gimp .xcf-file to allow others to modify the used add-on icons. And of course to have anything in one place. Should those xcf-files also be removed?

Depends on the size and how important sharing the sources is to you, IMO. If they're just a few kB it doesn't hurt to include them. If you have really big source assets, they shouldn't be bundled with the add-on and if you want to share them I'd recommend uploading them to a repo on CB/GH or elsewhere.

  • Last but not least: I used git to manage my changes. Will the hidden folder .git be uploaded also? If so, can this be prevented?

Ouch. TBH I had not thought of add-on developers being so diligent about version control… face-smile.png
Yes it would be uploaded, and this should really be avoided. Please copy the final add-on files to a separate .wad folder and upload that instead. So you'd have "my_addon_devel.wad" with its own .git dir and other development stuff, and copy only the relevant files to "my_addon.wad" before uploading.

Maybe I should add something to prevent this: a hardcoded exclusion list of common VCS dirs like ".git" and ".bzr", or how about a .gitignore-style ".wlignore" that allows you to exclude arbitrary files and directories from uploading?


Top Quote
tothxa
Avatar
Joined: 2021-03-24, 12:44
Posts: 460
OS: antix / Debian
Version: some new PR I'm testing
Ranking
Tribe Member
Posted at: 2024-01-23, 20:22

Nordfriese wrote:

  • I have also added a gimp .xcf-file to allow others to modify the used add-on icons. And of course to have anything in one place. Should those xcf-files also be removed?

[...] if you want to share them I'd recommend uploading them to a repo on CB/GH or elsewhere.

+1

how about a .gitignore-style ".wlignore" that allows you to exclude arbitrary files and directories from uploading?

+1

Though wouldn't globbing be hard? And without globbing, it would be often uncomfortable to use.


Top Quote
kaputtnik
Avatar
Topic Opener
Joined: 2013-02-18, 20:48
Posts: 2514
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2024-01-23, 20:41

Thanks face-smile.png

Hm, the print statements... it is just interesting how memory consumption grows and shrinks after a cellectgarbage. Especially the analyse_map add-on needs a lot of memory if you analyse a very, very big map as a whole. In one of the first versions it was about 10GB... now it's "only" 1,7 GB. I think i'll leave them in the analyse_map add-on and remove them in the height_tools add-on which is not that memory hungry.

The xcf-files have just 36kb, i'll keep them in the add-on.

Git is just a nice helper if you have a working solution but you want to make some refactoring or add new stuff to the UI... . Will create a new folder then. And for uploading i think just ignoring hidden files would be sufficient, imho.


Top Quote
kaputtnik
Avatar
Topic Opener
Joined: 2013-02-18, 20:48
Posts: 2514
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2024-01-24, 10:17

Please copy the final add-on files to a separate .wad folder and upload that instead. So you'd have "my_addon_devel.wad" with its own .git dir and other development stuff, and copy only the relevant files to "my_addon.wad" before uploading.

Easier said than done, because you also have to change all the include statements to point to the current folder. Probably one can use local dir = path.dirname(__file__) and change appropriate places.

Maybe I should add something to prevent this: a hardcoded exclusion list of common VCS dirs like ".git" and ".bzr", or how about a .gitignore-style ".wlignore" that allows you to exclude arbitrary files and directories from uploading?

-> https://codeberg.org/wl/widelands/issues/4689


Top Quote