4.4 KiB
4.4 KiB
🏗️ Build Guide - Creating Executable Files
This guide explains how to compile the EBoek.info Scraper into standalone executable files for distribution.
📦 What You'll Get
- Single executable file (~30MB) containing everything needed
- No Python installation required on target machines
- All dependencies bundled (PyQt5, Selenium, etc.)
- Cross-platform support (Windows .exe, macOS app, Linux binary)
🚀 Quick Build
Option 1: Python Build Script (Recommended)
# Cross-platform automated build
python3 build_executable.py
Option 2: Platform-Specific Scripts
Windows:
build_exe.bat
macOS/Linux:
./build_exe.sh
Option 3: Manual PyInstaller
# Install PyInstaller
python3 -m pip install pyinstaller
# Build executable
python3 -m PyInstaller --onefile --windowed --name "EBoek_Scraper" gui_main.py
📋 Prerequisites
- Python 3.8+ with all project dependencies installed
- PyInstaller 6.0+ (auto-installed by build scripts)
- All project requirements (
pip install -r requirements.txt)
🔧 Build Process Details
What Happens During Build:
- Dependency Analysis - PyInstaller scans all imports
- Code Compilation - Python code compiled to bytecode
- Library Bundling - All dependencies packaged together
- Executable Creation - Single-file output with launcher
Hidden Imports (Automatically Included):
- PyQt5 modules (QtCore, QtGui, QtWidgets)
- Selenium webdriver components
- Project modules (core/, gui/, utils/)
Excluded Modules (Size Optimization):
- tkinter, matplotlib, numpy, pandas (not needed)
📊 Build Results
| Platform | Executable | Size | Location |
|---|---|---|---|
| Windows | EBoek_Scraper.exe |
~30MB | dist/ |
| macOS | EBoek_Scraper.app |
~30MB | dist/ |
| Linux | EBoek_Scraper |
~30MB | dist/ |
🚀 Distribution
What to Share:
- Single file: The executable from
dist/folder - No additional files needed - everything is bundled
First Run Instructions:
Windows Users:
- Run
EBoek_Scraper.exe - If Windows shows security warning:
- Click "More Info"
- Click "Run Anyway"
- This only happens on first run
macOS Users:
- Run
EBoek_Scraper.apporEBoek_Scraper - If macOS shows security warning:
- Right-click the file
- Select "Open"
- Click "Open" in dialog
- This only happens on first run
Linux Users:
- Make executable:
chmod +x EBoek_Scraper - Run:
./EBoek_Scraper
🛠️ Advanced Build Options
Custom Spec File Build:
# Use custom spec file for advanced configuration
python3 -m PyInstaller eboek_scraper.spec
Debug Build:
# Build with console window for debugging
python3 -m PyInstaller --onefile --console gui_main.py
Directory Build (Faster startup):
# Build as directory instead of single file
python3 -m PyInstaller --onedir --windowed gui_main.py
🐛 Troubleshooting
Build Fails:
- Check Python version: Must be 3.8+
- Update PyInstaller:
pip install --upgrade pyinstaller - Check dependencies:
pip install -r requirements.txt - Try spec file:
python3 -m PyInstaller eboek_scraper.spec
Executable Won't Run:
- Check Chrome installation on target machine
- Antivirus interference - add exception for scraper
- Missing Visual C++ Redistributable (Windows only)
Large File Size:
- Expected behavior - includes Python + PyQt5 + Selenium
- Alternative: Use
--onedirfor faster startup - Size breakdown: Python(~15MB) + PyQt5(~10MB) + Selenium(~5MB)
📈 Performance Notes
- Startup time: 2-3 seconds (cold start)
- Memory usage: Similar to Python version
- Chrome requirement: Still needs Chrome browser installed
- No performance penalty once running
🔄 Updating Builds
When you update the source code:
- Re-run build process to create new executable
- Version number - consider adding to filename
- Distribution - replace old executable with new one
💡 Tips
- Test executable on clean system before distribution
- Keep source code - executable is not easily reverse-engineered
- Build on target OS - Windows builds work best on Windows, etc.
- Sign executables (optional) to reduce security warnings
Happy building! 🚀