Skip to main content

PyWinGUI GUI Automation Library for Windows Forms (Binary Distribution)

Project description

build_tools — README

This document explains how to build, test, and publish Windows Nuitka-compiled wheels for the pywingui project using the repository's build scripts and GitHub Actions.

Checklist

  • Create PyPI API token and add it to GitHub Secrets (PYPI_API_TOKEN).
  • Verify make_nuitka_wheel.ps1 and push.ps1 are configured correctly.
  • Test a local build for each target Python interpreter (32-bit and 64-bit).
  • (Optional) Run the GitHub Actions workflow manually to inspect artifacts.
  • Tag and push when ready to publish to PyPI (workflow will run and upload wheels).

Overview

  • make_nuitka_wheel.ps1 — Builds a wheel for a specific Python interpreter using Nuitka. It compiles selected modules into extension modules and packages them into a wheel.
  • push.ps1 — Uploads the built wheel(s) to PyPI using twine, reading the token from environment variables (PYPI_API_TOKEN or TWINE_PASSWORD).
  • GitHub Actions workflow (.github/workflows/build-windows-wheels.yml) — Builds Windows wheels across a matrix of Python versions and architectures (x86/x64) and publishes them to PyPI when a tag is pushed and PYPI_API_TOKEN is set as a secret.

Security model

  • For releasing protected/compiled code, build and publish per-ABI wheels (win32 and win_amd64) and do not include source fallback files in release wheels. To do that, run the build script without the -IncludeSourceFallbacks switch.
  • If you need debug/compatibility builds that include Python source fallbacks, run the build script with -IncludeSourceFallbacks. Do not publish fallback-enabled wheels to PyPI if you want to protect source code.

Local usage

  1. Build a secure wheel (no source fallbacks)

Open PowerShell in the repository root and run:

# Build for a target Python interpreter (replace path with target python.exe)
.\build_tools\make_nuitka_wheel.ps1 -PythonExe "C:\Path\To\Target\python.exe"
  1. Build a compatibility/debug wheel (includes _source.py fallbacks)
# Include source fallbacks for debugging (not recommended for protected releases)
.\build_tools\make_nuitka_wheel.ps1 -PythonExe "C:\Path\To\Target\python.exe" -IncludeSourceFallbacks
  1. Inspect the produced wheel

After the build completes, the wheel(s) are placed under dist\. To list the wheel files:

Get-ChildItem .\dist\*.whl | Sort-Object LastWriteTime -Descending | Format-Table Name,FullName -AutoSize

To list the contents of a wheel (using Python):

python - <<'PY'
import zipfile
w = r".\dist\your-built-wheel.whl"  # replace with the actual file
z = zipfile.ZipFile(w)
print('\n'.join(z.namelist()))
PY
  1. Test install in a fresh venv (use the same interpreter you built for)
"C:\Path\To\Target\python.exe" -m venv .\test_env
.\test_env\Scripts\python.exe -m pip install --upgrade pip
.\test_env\Scripts\python.exe -m pip install .\dist\your-built-wheel.whl
.\test_env\Scripts\python.exe -c "import pywingui; import pywingui.controller as controller; print('OK', controller)"

Publishing to PyPI (local)

  1. Set token in environment (temporary for current PowerShell session):
$env:PYPI_API_TOKEN = 'pypi-<your-token-here>'
# or the less-preferred variable used by older scripts
$env:TWINE_PASSWORD = 'pypi-<your-token-here>'
  1. Run the push script (it will install twine into the project's venv and upload):
.\build_tools\push.ps1

GitHub Actions (automated build & publish)

What the workflow does

  • For each Python version and architecture in the matrix it:
    • Checks out the repo
    • Sets up Python (x86/x64)
    • Installs build dependencies (nuitka, wheel, setuptools)
    • Runs make_nuitka_wheel.ps1 to build a wheel
    • Uploads the built wheel(s) as an artifact for inspection
  • If the workflow run is triggered by a pushed tag (e.g. v1.2.3) and PYPI_API_TOKEN is set as a repository secret, the workflow will run twine to upload dist/* to PyPI.

One-time setup on GitHub

  1. Create a PyPI API token at https://pypi.org (Account → API tokens).
  2. In GitHub, go to the repository: Settings → Secrets and variables → Actions → New repository secret
    • Name: PYPI_API_TOKEN
    • Value: (the token you copied from PyPI)

Triggering a publish

  • To test the workflow without publishing, run the workflow manually from Actions → your workflow → Run workflow.
  • To publish to PyPI, push a tag. Example:
git add .
git commit -m "release prep"
git tag v1.0.0
git push origin main
git push origin v1.0.0

Versioning

The build scripts set a SMART_VERSION environment variable that setup_build_pkg.py reads and uses as the package version when building a wheel. By default make_nuitka_wheel.ps1 generates a timestamp-based PEP-440-friendly version to keep builds unique (useful for automated builds).

You can control the version in three ways:

  1. Let the build produce a timestamped version (default)
  • This happens automatically when you run make_nuitka_wheel.ps1 without -Version. The script sets SMART_VERSION to a value like 2026.1.2.10.5+2026.01.02.10.05 (format keeps it PEP-440 compatible while preserving a raw timestamp suffix).
  1. Provide an explicit version when running the build script
  • Use the -Version parameter to set a specific PEP-440 compliant version string. Example:
# Set the build version explicitly
.\build_tools\make_nuitka_wheel.ps1 -PythonExe "C:\Path\To\python.exe" -Version "1.2.3"
  • The provided -Version value overrides the generated timestamp and is exported as SMART_VERSION for the wheel build.
  1. In CI (recommended for releases): use the git tag as the version
  • When publishing releases from CI you typically want the wheel version to match the git tag (for example v1.2.3 or 1.2.3). You can pass the tag name into the build script by supplying -Version or by exporting SMART_VERSION in the runner environment.

Example (GitHub Actions step) — pass the tag name into the build script:

- name: Build wheel (Nuitka)
  shell: pwsh
  run: |
    $py = (Get-Command python).Source
    $ver = '${{ github.ref_name }}'   # e.g. 'v1.2.3' or '1.2.3'
    Write-Host "Building wheel for version: $ver"
    .\build_tools\make_nuitka_wheel.ps1 -PythonExe $py -Version $ver

Notes on version format

  • Use a PEP-440 compliant version string (for example: 1.2.3, 1.2.3.post1, 1.2.3rc1). Avoid spaces or characters that are illegal in wheel metadata.
  • If you use git tags prefixed with v (v1.2.3) and prefer to drop the v, strip it in CI before passing to -Version (for example trim the leading v in the script or set -Version ${{ github.ref_name | replace('v','') }}).

How setup_build_pkg.py reads the version

  • setup_build_pkg.py uses os.environ.get('SMART_VERSION', '0.0.0') as the package version. The make_nuitka_wheel.ps1 script sets SMART_VERSION before invoking setup_build_pkg.py, so the wheel will carry the SMART_VERSION value.

Troubleshooting

  • If you see 0.0.0 in the built wheel metadata, SMART_VERSION was not set in the environment at package-build time. Confirm you invoked make_nuitka_wheel.ps1 (it sets SMART_VERSION) and that setup_build_pkg.py is executed in the same process/venv context.
  • If a wheel is already published with an identical version, PyPI rejects the upload; ensure you increment the version for each published release.

Notes & troubleshooting

  • Make sure you build wheels on Windows for Windows wheels. The GitHub Actions workflow uses runs-on: windows-latest.
  • Ensure you build one wheel per ABI. For Windows you typically need both win32 and win_amd64 if you support 32-bit and 64-bit Python users.
  • If a user reports "No module named 'pywinGUI.controller'" after installing from PyPI:
    1. Ask them to run python -c "import platform,sys; print(sys.executable, platform.python_version(), platform.architecture())" and python -m pip show -f pywinGUI.
    2. Verify they installed the wheel matching their Python bitness. If not, provide the correct wheel or publish both ABI wheels.
    3. If the installed package has an incorrectly named file (e.g. _init_.py), remove the package folder and reinstall.

CI considerations

  • If Nuitka or compiled code requires MSVC or other build tools on the runner, add the installation steps in the workflow (Chocolatey or Visual Studio Build Tools) before running the build script.
  • The workflow currently publishes only on tag pushes. You can adjust it to publish on a release or add manual approvals.

Contact

  • If a build fails or a wheel raises import errors on a target interpreter, collect the following and open an issue:
    • The wheel filename
    • The output of python -c "import platform,sys; print(sys.executable, platform.python_version(), platform.architecture())" on the failing machine
    • The output of python -m pip show -f pywinGUI
    • Any traceback from attempting to import pywinGUI.controller

This README is intentionally minimal and focused on build and release flow. If you want, I can:

  • Add a short RELEASE.md with step-by-step release checklist and gating rules.
  • Create a GitHub Actions job that requires manual approval before upload.
  • Add cibuildwheel usage for cross-platform future support.

Which of these would you like next?

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pywingui-5.0.12-cp313-none-win_amd64.whl (756.8 kB view details)

Uploaded CPython 3.13Windows x86-64

pywingui-5.0.12-cp313-none-win32.whl (645.2 kB view details)

Uploaded CPython 3.13Windows x86

pywingui-5.0.12-cp312-none-win_amd64.whl (764.7 kB view details)

Uploaded CPython 3.12Windows x86-64

pywingui-5.0.12-cp312-none-win32.whl (655.9 kB view details)

Uploaded CPython 3.12Windows x86

pywingui-5.0.12-cp311-none-win_amd64.whl (771.4 kB view details)

Uploaded CPython 3.11Windows x86-64

pywingui-5.0.12-cp311-none-win32.whl (660.6 kB view details)

Uploaded CPython 3.11Windows x86

File details

Details for the file pywingui-5.0.12-cp313-none-win_amd64.whl.

File metadata

  • Download URL: pywingui-5.0.12-cp313-none-win_amd64.whl
  • Upload date:
  • Size: 756.8 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for pywingui-5.0.12-cp313-none-win_amd64.whl
Algorithm Hash digest
SHA256 ea97b410d744a3f65ed7500aedf4b22db721f1e380f6d649833bb45707c9dc7b
MD5 543a01fb66330040cba2c08ad5a45ef0
BLAKE2b-256 a00ae6836c167c34a8c677611454975032367e0577bb9559b077c3616e39de9d

See more details on using hashes here.

File details

Details for the file pywingui-5.0.12-cp313-none-win32.whl.

File metadata

  • Download URL: pywingui-5.0.12-cp313-none-win32.whl
  • Upload date:
  • Size: 645.2 kB
  • Tags: CPython 3.13, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for pywingui-5.0.12-cp313-none-win32.whl
Algorithm Hash digest
SHA256 4d3671da0cddf518211329f898702448c7ee9d7763b63aa69ff6cbb558900e4d
MD5 65e643b3c71e5fab4a1a340fca61a835
BLAKE2b-256 9f44722d98da0923df6a722a80ce7ae96d60251da307995ce2ba9832e5f96626

See more details on using hashes here.

File details

Details for the file pywingui-5.0.12-cp312-none-win_amd64.whl.

File metadata

  • Download URL: pywingui-5.0.12-cp312-none-win_amd64.whl
  • Upload date:
  • Size: 764.7 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for pywingui-5.0.12-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 c116eb44d639e046a8e87f906996dade8c07b213016b0e2f8d62cd509aed6ca9
MD5 3b1d450fe372dafe05c0dd09be4cab0b
BLAKE2b-256 66e3889ebef0cf407044037cd36a78cccc87696151cc4ccd2585565aceac366e

See more details on using hashes here.

File details

Details for the file pywingui-5.0.12-cp312-none-win32.whl.

File metadata

  • Download URL: pywingui-5.0.12-cp312-none-win32.whl
  • Upload date:
  • Size: 655.9 kB
  • Tags: CPython 3.12, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for pywingui-5.0.12-cp312-none-win32.whl
Algorithm Hash digest
SHA256 f4f843587136c2b6b1431fd5df95d24441d2c554c7066287ca65f47ccb6dd94c
MD5 15c0ddf114cc3c2b369dafda41eb5017
BLAKE2b-256 ce283b4041de1f65970920e029080e5230e3ee0d9f93b1afa6f14530ed03245c

See more details on using hashes here.

File details

Details for the file pywingui-5.0.12-cp311-none-win_amd64.whl.

File metadata

  • Download URL: pywingui-5.0.12-cp311-none-win_amd64.whl
  • Upload date:
  • Size: 771.4 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for pywingui-5.0.12-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 57251a91b56b1d189c1d5eca7e0aed4ab6d16b3a736d8ea0d67c5efe62ad5eac
MD5 879da022f43a29fa6812cc41f25cd6b7
BLAKE2b-256 0d22a62d6ffaa617601fca7bf2a75d8df7353d8d1d26bd5da53eb2727006c727

See more details on using hashes here.

File details

Details for the file pywingui-5.0.12-cp311-none-win32.whl.

File metadata

  • Download URL: pywingui-5.0.12-cp311-none-win32.whl
  • Upload date:
  • Size: 660.6 kB
  • Tags: CPython 3.11, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for pywingui-5.0.12-cp311-none-win32.whl
Algorithm Hash digest
SHA256 0cc04b9c0552fc114b2616ce2fc613854bbc6ef34e6f9fe4b2f0d26cc32d32e4
MD5 de14f5dba5b2c8eb3ab0a1c9c786eda8
BLAKE2b-256 9595b4e5744cb62fb72648773c21a8d3a600adcf4ad106120f0133bd27d37698

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page