Skip to main content

VersionInfo helper script for PyInstaller

This repository contains helper scripts to dynamically create VersionInfo objects that can be embedded in .exe files created by PyInstaller.

Project Status

Category Workflow information
Published on PyPI PyPI - Version PyPI - Python Version 📦 Publish Python Package
Documentation Documentation on Github Pages 📚 Build and publish documentation
Tests Coverage Status 🔄 Integration Testing 🧪 Unittests with Coverage
Type annotations: inline 🔍 Typecheck: Mypy 🧠 Typecheck: Pyright 🦋 Typecheck: Pyrefly
Additional CI/CD workflows 🧹 Linters 🚦 Noxfile Self Check

Motivation

This project was created because existing solutions to embed version information inside executables relied on creating artifact files that get read (and eval-ed) by PyInstaller during the build process.
Dynamically creating such files essentially boiled down to inserting data in a string template, with no guides to the user if their entered data is valid or not.
A bit of exploration of PyInstaller's source code and official Microsoft documentation revealed that it should be possible to provide PyInstaller with necessary data straight from .spec files without file-read-and-eval step.
This approach has the added bonus of being type hint compatible, offering rich auto-complete in supported IDEs.

Installation

Wheels are available on PyPI, install with:

pip install versioninfo_helper

Usage

See example_simple.onefile.spec and example_dynamic.onefile.spec for examples on how to integrate VersionInfo creation directly into PyInstaller .spec files.

Snippet of .spec file with embedded VersionInfo generation:

...  # Skipped other parts of .spec file

def gen_version_info():  #  -> VSVersionInfo
    '''
    Helper function, which can be embedded in .spec file,
    generates VSVersionInfo instance for executable.
    '''
    from versioninfo_helper import CharsetCode
    from versioninfo_helper import LanguageID
    from versioninfo_helper import create_VersionInfo
    # version must be a tuple of 4 (16-bit) integers
    # hardcoded in this example, but can be generated dynamically as needed
    version = (1, 2, 3, 4)
    version_str = '.'.join(str(v) for v in version)

    return create_VersionInfo(
        version,
        strings=[
            {
                # all fields are described in included TypedDicts, 
                # so IDEs should offer auto-complete and type checks
                "lang_id": LanguageID.US_English,
                "charset_id": CharsetCode.Unicode,
                "fields": {
                    "CompanyName": 'Your Company Name LLC',
                    'FileDescription': f'AppName ({version_str})',
                    'FileVersion': f'{version_str}',
                    'InternalName': 'AppName.exe',
                    'LegalCopyright': '© 2026 Your Company Name LLC',
                    'OriginalFilename': 'AppName.exe',
                    'ProductName': 'AppName - Part of Product',
                    'ProductVersion': f'{version_str}',
                }
            }
        ]
    )

...  # Skipped other parts of .spec file

exe = EXE(
    pyz,
    a.scripts,
    a.binaries,
    a.zipfiles,
    a.datas,
    [],
    name='AppName',
    debug=False,
    bootloader_ignore_signals=False,
    strip=False,
    upx=True,
    upx_exclude=[],
    runtime_tmpdir=None,
    console=True,
    icon='icon.ico',
    version=gen_version_info()  # call your helper function here
)

Metadata

Release files for versioninfo-helper 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for versioninfo-helper 1.1.0
File Size Uploaded Provenance Actions
versioninfo_helper-1.1.0.tar.gz 93.0 kB With provenance Details for versioninfo_helper-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for versioninfo-helper 1.1.0
File Interpreter ABI Platform Actions
versioninfo_helper-1.1.0-py3-none-any.whl Python 3 none any Details for versioninfo_helper-1.1.0-py3-none-any.whl

Total release size: 107.3 kB

Release files / versioninfo_helper-1.1.0.tar.gz

Download URL versioninfo_helper-1.1.0.tar.gz
Size 93.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b1014f7da301267bc2e3a1b2be018e69ec9067a7e62e56c88c66ee3dde7040fc
BLAKE2b-256 checksum
How to use checksums
a8824a43633ba1215654d76d7492df506d2b038fbd2ac399848978549943446e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Release files / versioninfo_helper-1.1.0-py3-none-any.whl

Download URL versioninfo_helper-1.1.0-py3-none-any.whl
Size 14.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
60f81c56008ec25945215db5b3687884d7ec90b421e1f502db64c8c28d275abc
BLAKE2b-256 checksum
How to use checksums
495d6f5abb96eac27e5416b2b6f4cfea19f2de5188032eb746c36f614890f20b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Security for versioninfo-helper 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for versioninfo_helper-1.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page