# LGPL Compliance Checklist (Qt / PySide6)

This document is a short engineering checklist to help ensure compliance with the **LGPL** when distributing an application that uses **Qt** via **PySide6**.

> Scope: typical desktop distribution (Windows/macOS/Linux) where the app bundles Python + PySide6 + Qt libraries.

---

## 1) Identify what you ship

- [ ] Confirm you are using **PySide6 (Qt for Python)** under **LGPL** (not a commercial Qt license).
- [ ] Record the exact versions shipped:
  - [ ] Qt version
  - [ ] PySide6 version
  - [ ] shiboken6 version
- [ ] List all Qt-related binaries you distribute (examples):
  - Windows: `Qt6*.dll`, `pyside6*.pyd`, `shiboken6*.pyd`, plugins under `platforms/`, `imageformats/`, etc.
  - Linux: `libQt6*.so*`, `libpyside6*.so*`, `libshiboken6*.so*`, plugins.
  - macOS: `Qt*.framework` or `.dylib`, plugins.
- [ ] Ensure you are not statically linking Qt (static linking triggers additional obligations and is generally harder to comply with).

---

## 2) Prefer “onedir” style distribution (recommended)

LGPL compliance is easiest when users can replace the LGPL libraries.

- [ ] Prefer **onedir** packaging (e.g., PyInstaller `--onedir`) so Qt libraries are separate files.
- [ ] If you ship a single-file bundle (onefile):
  - [ ] Ensure the Qt libraries are still present as separate files at runtime and can be replaced by the user (not embedded in a way that prevents replacement).
  - [ ] Document how to replace them.

---

## 3) Allow user relinking / replacement of LGPL components

LGPL requires that users can modify/replace the LGPL library and run the application with the modified version.

- [ ] Do not prevent replacement of Qt/PySide6 binaries (no integrity checks, signatures, DRM, or hard-coded hashes that block modified libraries).
- [ ] Ensure the loader will pick up replacement libraries:
  - Windows: DLL search path allows local directory override (typical for app-local DLLs).
  - Linux: `rpath`/`runpath` does not prevent using user-provided `.so` in the app directory (or document the supported method).
  - macOS: `@rpath`/`@loader_path` setup allows replacement of frameworks/dylibs in the bundle.
- [ ] Plugins must also be replaceable (Qt platform plugins, imageformat plugins, etc.).

---

## 4) Provide license texts and notices

You must provide the LGPL license text and relevant notices for the LGPL components you distribute.

- [ ] Include the **LGPL license text** (LGPL-3.0 or LGPL-2.1 depending on the shipped Qt/PySide6 version).
- [ ] Include the **GPL exception / additional Qt notices** if applicable (Qt often includes additional notices).
- [ ] Include **copyright notices** for Qt and PySide6.
- [ ] Include third-party license bundle for Python dependencies:
  - [ ] Generate and ship `./licenses/` folder (see `licenses/README.txt`).
  - [ ] Ensure `./licenses/THIRD_PARTY_PYTHON.txt` is included in the distribution.
- [ ] Note: the license/notice texts shipped inside PySide6/Qt wheels are usually sufficient, but **Qt LGPL texts/notices may be incomplete** depending on the wheel contents. If anything is missing, add it manually under `licenses/qt/` (or an equivalent subfolder) and reference it from your documentation.

---

## 5) Provide “Corresponding Source” access (LGPL parts)

For LGPL libraries you distribute, you must provide access to the source code of those libraries (or a written offer, depending on the license version and distribution method).

Practical approach:

- [ ] Provide a link in your documentation (or `About` dialog / `LICENSES` section) to the **exact source** for the Qt/PySide6 version you ship:
  - Qt source: https://code.qt.io/ or official Qt source archives
  - PySide6 source: https://code.qt.io/cgit/pyside/pyside-setup.git/
- [ ] Record the exact versions shipped (Qt version, PySide6 version).
- [ ] If you apply patches to Qt/PySide6:
  - [ ] Provide your patch set and build instructions.

---

## 6) Dynamic linking confirmation

- [ ] Verify that your application uses Qt via dynamic libraries (DLL/.so/.dylib/framework).
- [ ] Verify you are not statically linking Qt or embedding it in a way that prevents replacement.

---

## 7) Installation information (if you lock down the device)

If you distribute on a device or environment where users cannot install/replace libraries (e.g., locked-down appliance), LGPL may require you to provide the necessary installation information to allow replacement.

- [ ] If applicable, document how a user can install a modified Qt/PySide6 build and run the app with it.

---

## 8) Where licenses live in the release (and what must be inside)

Make it unambiguous for users and auditors where to find license materials in the shipped artifact.

- [ ] The release artifact contains a **top-level** `licenses/` directory (next to the main executable/app bundle root).
- [ ] `licenses/` must include at minimum:
  - [ ] `THIRD_PARTY_PYTHON.txt` (summary of bundled Python packages; ideally includes `package==version` and license metadata)
  - [ ] The full license texts/notices collected from installed wheels (e.g., `licenses/<package>/...`)
  - [ ] Qt / PySide6 license texts and notices (e.g., `licenses/qt/`, `licenses/PySide6/`), including any manually added Qt LGPL texts if the wheel did not include them. Per-package pointers (`licenses/pyside6/SEE_QT_LICENSES.txt`, `licenses/shiboken6/SEE_QT_LICENSES.txt`) should direct users to the Qt bundle.
  - [ ] For PySide6/shiboken6, see: `licenses/pyside6/SEE_QT_LICENSES.txt` and `licenses/shiboken6/SEE_QT_LICENSES.txt`.
- [ ] Your user-facing documentation (README / Help / About) states:
  - [ ] “This product uses Qt (LGPL) via PySide6.”
  - [ ] The exact path to the `licenses/` directory in the installed app.
  - [ ] How to replace Qt libraries (path and file names).
  - [ ] Where to obtain the corresponding source.

---

## 9) Quick self-test before release

- [ ] Install the packaged app on a clean machine.
- [ ] Replace one Qt library with a compatible build (or rename to force load failure) and confirm:
  - [ ] The app loads libraries from the expected location.
  - [ ] Replacement is possible without bypassing security mechanisms.
- [ ] Confirm all license files are present in the shipped artifact (including `licenses/THIRD_PARTY_PYTHON.txt` and Qt/PySide6 LGPL texts/notices).

---

## Notes / Non-legal disclaimer

This checklist is an engineering aid and not legal advice. If you have unusual distribution constraints (static linking, locked devices, app stores with restrictions), consult legal counsel.