Jump to content
Korean Random

Wotmod packager for setuptools

Recommended Posts

This tool provides a command to setuptools for producing wotmod packages from setuptools based python projects.


Use cases:

  • Use setuptools to package Python packages (e.g. those found from PyPI) into wotmod packages, providing easier distribution of 3rd party libraries for game mods.
  • Use setuptools to package game mods into wotmod packages.


For installation instructions, usage and examples see the project in Github:



With my mod project, tessumod, getting more complex than I indented it to be, I have used several 3rd party libraries to make the code more manageable. Until recently, I have had those 3rd party libraries’s code committed to my mod’s code repository. But, one of those, pydash, fails to import if it doesn’t sit in PYTHONPATH. I have had pydash stored to scripts/client/gui/mods/tessumod/lib/pydash and then import it by changing sys.path before importBut, this was just so hacky thing to do and I was  hopping to find a better way.


I could have solved the problem if I put it to PYTHONPATH, e.g. scripts/common. This has a downside though; If another mod developer were to use the same library and install it to same PYTHONPATH, it would make both mods installations more difficult. And with the new wotmod format this causes a load conflict, making either my mod, or other developer’s mod incompatible with each other.


But, then I thought what if I package that 3rd party library into its own wotmod package, keeping it separate from my mod's package? Thus restricting possible load conflicts to that 3rd party package. My mod might even continue to work if the other mod developer’s 3rd party library has compatible API / version.

Those 3rd party libraries I needed had one in common. They used setuptools to package their libraries. Setuptools lets you, by default, package a python project to several types of formats, tar.gz, rpm, windows installer, and others and you can get more packagers from PyPI. Thus adding a packager command that creates a wotmod should not be an issue. And it wasn't; setuptools is extendable and making your own command and plugging it to setuptools wasn't difficult.


As a result I ended up creating the setuptools-wotmod tool. For example how to package pydash to wotmod format see:



Or, for a more complete packaging example of the 3rd party libraries I use, see tessumod's repo:



Since I had the 3rd party libraries packaged with the tool, I finally used it to package the actual mod's implementation into a wotmod as well. Got rid of a few of my custom build scripts in the process as well. Didn't need to compile py files anymore either, as setuptools does that for me, which was nice.


I've added a example hello world mod to demonstrate how to use setuptools to package it, here:



So what you think, would this be useful for you? Is there any functionality I should add? Or change?

Share this post

Link to post

Short link
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...