Files
anki/.python-version
Abdo c9cd85dd97 feat: Distribute compiled sources in Briefcase bundle (#4856)
## Linked issue

#4855

## Summary

Compile .pyc files and package them in the Briefcase bundle instead of
the .py sources.

## How to test

You can run this Powershell script to do a basic benchmark of startup
performance on Windows (Requires
[py-spy](https://github.com/benfred/py-spy)):
```powershell
function Remove-Build {
    Remove-Item -LiteralPath "./out/installer" -Force -Recurse
}

function Start-Anki {
    param (
        [Parameter()]
        [string]
        $OutputPath
    )

    Start-Process -FilePath "py-spy" -ArgumentList "record --output $OutputPath -- ./out/installer/build/anki/windows/app/src/Anki.exe --safemode"
    Start-Sleep -Seconds 10
    Stop-Process -Name Anki
}

if ($null -eq (Get-Command "py-spy" -ErrorAction SilentlyContinue)) {
    Write-Error "py-spy not found. See https://github.com/benfred/py-spy"
    Exit 1
}

git checkout main
Remove-Build
./tools/ninja installer:build
Start-Anki -OutputPath "main.svg"

git checkout briefcase-compile-pyc
Remove-Build
./tools/ninja installer:build
Start-Anki -OutputPath "pyc.svg"
```

Output is written to `main.svg` and `pyc.svg`. Here's an example run
(using default 100 sampling rate):
<img width="950" height="559" alt="image"
src="https://github.com/user-attachments/assets/5da6a06a-3393-4f0e-80fe-ced735d50c2c"
/>
<img width="830" height="352" alt="image"
src="https://github.com/user-attachments/assets/ca9e5d8d-c3d4-4a0b-bd86-7aa2d6c5cee2"
/>
2026-05-18 17:47:03 +03:00

2 lines
8 B
Plaintext