This guide provides step-by-step instructions for setting up the developer and contributor environment for AmplifyP on Windows. It covers installing prerequisites, setting up Python virtual environments, running the application with hot-reload, executing unit and end-to-end (E2E) tests, and compiling release packages.
Before setting up the project, ensure the following software is installed on your Windows machine:
AmplifyP requires Python 3.12 or higher.
- Installation via Winget: Open PowerShell or Command Prompt and run:
winget install Python.Python.3.12 - Manual Installation: Download and run the installer from the official Python Website.
Important
During the Python installation process, ensure the checkbox for "Add Python to PATH" (or similar) is ticked. This is necessary to access Python from the command line.
Required for cloning the repository and managing version control.
- Installation via Winget:
winget install Git.Git
- Manual Installation: Download and install Git from Git for Windows.
Required only if you wish to build the standalone installer executable (.exe).
- Installation via Winget:
winget install JRSoftware.InnoSetup
- Installation via Chocolatey:
choco install innosetup -y
Open PowerShell, Command Prompt, or Git Bash, and navigate to the directory where you want to store the project. Run:
git clone https://github.com/fangfufu/AmplifyP.git
cd AmplifyPSet up a Python virtual environment under .venv at the root of the repository.
Follow the instructions for your preferred terminal shell:
# Create the virtual environment
python -m venv .venv
# Activate the virtual environment
.venv\Scripts\Activate.ps1Note
If you receive an execution policy error (e.g.
Script execution is disabled on this system), run the following command to
allow running scripts in the current process:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process:: Create the virtual environment
python -m venv .venv
:: Activate the virtual environment
.venv\Scripts\activate.bat# Create the virtual environment
python -m venv .venv
# Activate the virtual environment
source .venv/Scripts/activateWith the virtual environment activated, install the package in editable mode along with development and end-to-end testing dependencies:
pip install -e ".[dev,e2e]"To launch the graphical user interface (GUI) from source:
python src/main.pyTo launch the web version locally at port 34521:
python src/main.py --webTo enable hot-reload (so that UI changes are applied automatically when files are saved), run the application using the Flet CLI:
- Desktop application:
flet run -r src/main.py
- Web application:
flet run -w -r src/main.py
- Web application on a specific port (e.g. port
34521):flet run -w -r -p 34521 src/main.py
To verify your changes and maintain high code quality, use the following tools:
Before committing your work, run the quality checks using prek. This ensures
that your code complies with formatting, linting, and type-checking rules:
prek run --all-filesThis runs:
pre-commit-hookshousekeeping checks (YAML validation, trailing whitespace, end-of-file newlines, JSON formatting, and more).yamlfmtfor formatting configuration YAML files.yamllintfor YAML linting.rufffor linting and code formatting checks.mypyfor strict static type-checking.pyrightfor additional static type-checking.pytestfor the fast test suite (E2E and CI-only tests are excluded via the default markers).vulturefor detecting unused code.typosfor identifying spelling errors.mdformatfor consistent markdown formatting.
We use pytest for unit, integration, and browser tests.
To run the fast, non-GUI tests:
pytestTo run the Playwright browser automation tests that verify the web interface's behaviour:
# Ensure playwright browser binaries are installed
playwright install
# Run the E2E tests
pytest -m e2eTo package the application and generate release assets on Windows, you can run
the build_windows.ps1 script located at the root of the repository. This
script automates generating the Git SHA, building the Flet binary, archiving the
build as a ZIP file, and compiling the setup installer using Inno Setup.
Open PowerShell and run:
.\build_windows.ps1Note
An Android SDK or toolchain is not required when building for Windows. The build script automatically skips Flutter Doctor Android checks and temporarily disables Android requirements in the Flutter configuration.
After the script runs successfully, the following files and directories will be created:
build\AmplifyP: The compiled Flet Windows application folder.amplifyp-windows-<version>.zip: A ZIP archive of the application directory.amplifyp-windows-setup-<version>.exe: The standalone Windows installation wizard (only if Inno Setup'siscccompiler is available on the system PATH or found in a supported standard installation directory).