-
Notifications
You must be signed in to change notification settings - Fork 0
Helper Tools ‐ Wheel Setup (Py)
github-actions[bot] edited this page Aug 16, 2025
·
1 revision
These Python scripts handle the build process for the PyCTools package:
-
setupHelper.py
: A helper script that:- Builds a wheel distribution package
- Cleans up temporary build files
- Organizes wheel files into a structured directory
- Provides guidance for testing and installation
-
setup.py
: The package configuration file that:- Defines package metadata and structure
- Includes DLLs from bin directory in the package
- Validates binary files exist before building
Important
setup.py
should NOT be run directly at ALL, use setupHelper.py
only
- Python 3.9 or higher
- The
build
package installed (pip install build
) - The
wheel
package installed (pip install wheel
) - The
setuptools
package installed (pip install setuptools
) - A properly configured project structure with compiled binaries in the bin folder
-
compilerHelper.ps1
must have been executed previously to create the bin directory
- Extracts the version string from
pyCTools/__init__.py
. - Returns: The version number of the PyCTools package.
- Exits with error if VERSION string cannot be found or file cannot be read.
- Outputs completion messages and instructions for next steps.
- Parameters:
-
whl_filename_
: Name of the wheel file that was built -
version_
: Version of the package
-
- Prints testing instructions, local installation commands, and GitHub release instructions.
- Finds the most recently modified wheel file matching the package name.
- Parameters:
-
dist_dir
: Directory to search for wheel files -
package_name
: Base name of the package
-
- Returns: Path to the most recent wheel file.
- Exits if no wheel files are found.
- Removes build artifacts and organizes wheel files:
- Removes
./pyCTools.egg-info/
directory - Removes
./build/
directory - Removes
./pyCTools/dist/
directory - Creates
./dist/wheels/
if it doesn't exist - Moves wheel files from
./dist/
to./dist/wheels/
- Removes
- Changes to the parent directory of the script.
- Runs
python -m build --wheel
as a subprocess to build the wheel package. - Cleans up temporary files with
cleanup()
. - Gets the path to the latest wheel file.
- Displays success messages and usage instructions.
Caution
Always use setupHelper.py
or the Python build system (python -m build
). Direct execution of setup.py is deprecated.
- Validates that the bin directory exists with required DLL files.
- Parameters:
-
bin_path
: Path to the bin directory
-
- Checks that both x86 and x64 subfolders exist with DLL files.
- Exits with error if validation fails.
- Creates the output directory structure for the wheel.
- Returns: Path to the output directory.
- Exits if directory creation fails.
- Utility function to print a separator line with optional title.
- Extracts version from
pyCTools/__init__.py
. - Returns: Version string.
- Exits if VERSION string cannot be found or file cannot be read.
- Extracts version information from
__init__.py
. - Validates binary files exist in bin directory.
- Creates output directory structure.
- Configures package with metadata and file inclusion rules:
- Package name, version, author information
- Includes DLL files from bin/x86 and bin/x64
- Sets output directories for distribution files
-
Ensure you've run
compilerHelper.ps1
to create the bin folder with DLL files. -
Navigate to the
tool
directory in your terminal:cd tool
-
Run the setupHelper script:
python setupHelper.py
-
The script will:
- Build a wheel package
- Clean up build artifacts
- Organize the wheel file into
dist/wheels/
- Provide instructions for testing and installation
-
Follow the displayed instructions to:
- Test in a virtual environment
- Install locally
- Prepare for GitHub release
- DO NOT run setup.py directly! This is deprecated practice.
- The setup.py file should only be used indirectly through:
- The
setupHelper.py
script (recommended) - The Python build system (
python -m build
)
- The
- This file defines the package structure and metadata but is not meant to be executed directly.
================================================================================
SETUP SCRIPT OUTPUT
================================================================================
...setup output...
================================================================================
[*] Removed ./pyCTools.egg-info/
[*] Removed ./build/
[*] Moved ./dist/pyctools-1.0.0-py3-none-any.whl to ./dist/wheels/pyctools-1.0.0-py3-none-any.whl
[*] Found wheel file successfully
[*] Completed setup.py execution.
Suggested action: Run 'distributionHelper.ps1' to create the distribution package for github releases.
Suggested action: Execute the following to test in VENV:
python -m venv dist/venv_test
dist\venv_test\Scripts\Activate.ps1
python -m pip install --upgrade pip
pip install dist/wheels/pyctools-1.0.0-py3-none-any.whl
# Do whatever you want here and run any script that uses the library
deactivate
Remove-Item -Recurse -Force dist\venv_test
[*] For local installation, run:
cd ..
python -m pip install dist/wheels/pyctools-1.0.0-py3-none-any.whl
[*] If you place the WHL file on the GitHub releases page, users can download it and install it with:
pip install https://github.com/DefinetlyNotAI/PyCTools/releases/download/1.0.0/pyctools-1.0.0-py3-none-any.whl
> Assuming the version[1.0.0] entered earlier is the exact same as the tag release.
- Always run
compilerHelper.ps1
before building the package to ensure DLL files are available. - The wheel file is moved to
dist/wheels/
for better organization. - If multiple wheel files are found, the most recently modified one is selected.
- Setup validation ensures proper directory structure and presence of required files.
- The package includes both x86 and x64 DLL files, making it compatible with both architectures.
- NEVER run setup.py directly as this approach is deprecated and may not work correctly.
This has been updated for version 0.2.0-beta
(or 0.2.0b0
for python) on 13/08/2025