-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docs: How to single source version number? #216
Comments
Glad you like it! At present, this isn't possible with a static configuration file. Larger projects often favour either creating the config file from a script as a build step, or scripting the build with Pynsist's Python API. I tend to favour using tools like bump2version to update version numbers over having a strictly single source for it. But I am also open to retrieving the version number automatically (e.g. Flit does this for publishing Python packages). I lean towards doing so with static analysis rather than importing the package, as importing it can have side effects, needs dependencies to be installed, etc. |
As far as I know, a common pattern is to declare the version numbers in pyproject.toml (keeping it up to date with poetry or other tools)
However, this does not work for pynsist generated apps (it never finds the metadata and thus defaults to 0.0.0), because the mypackage is not really installed (?) so the mypackage-xxx.dist-info folder is not created inside pkgs (unlike for the rest of dependencies). |
Pynsist is roughly designed so that you don't need to make a package of your application code (in the sense that pip etc. know about) before you can build an installer for it. So yes, it copies the application code without 'installing' it in a Python packaging sense (the relevant spec is Recording installed projects). This might be something to change, but it's probably a trickier change than it sounds. I personally dislike packages calling |
Thanks for the hint that using importlib like this may be a performance issue, good to know. |
Hi,
Thanks for making and maintaining this awesome package! I was about to create something similar, but was happily surprised there is already a package that does the job. I have a question about single sourcing the version number.
Currently, I use a common strategy:
__version__.py
insidemypackage
folder, which has justAnd then, in the
setup.py
, I read the version using some regex. In application code, I read the version by just importing byfrom mypackage.__version__ import __version__
. or similar. When usingpynsist
, I have to define a version number for the application ininstaller.cfg:Application.version
.What is the recommended way to single source version number in applications using pynsist? I suppose there are many ways to do it, but probably there is one is covers most use cases and/or is better than the others.
The text was updated successfully, but these errors were encountered: