Coding · development

How to avoid duplicating your package version number using a file

I thought it was rather annoying to specify the version of your package both in the tool itself and in your, so I searched the internet for solutions and below I’ll explain how I set it up.

I have a file in my project folder and this is the only spot where I keep my version number, which only contains the following.

__version__ = "0.16.1"

The script itself contains the following line to import the version number, making __version__ a variable in my script where I can easily use to report (and log) the version number:

from .version import __version__

In my I have the following line, which will also make the __version__ variable available for uploading the script to Pypi:



Some useful resources on how to organize package development are the following:



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s