feat: make GUI dependencies optional

This commit is contained in:
thePR0M3TH3AN
2025-08-07 10:51:13 -04:00
parent 38a392a7c9
commit 00edb44442
8 changed files with 37 additions and 15 deletions

View File

@@ -270,10 +270,17 @@ python -m seedpass_gui
seedpass-gui
```
Only `toga-core` and the headless `toga-dummy` backend are included by default.
The quick installer automatically installs the correct BeeWare backend so the
GUI works out of the box. If you set up SeedPass manually, install the backend
for your platform:
GUI dependencies are optional. Install them alongside SeedPass with:
```bash
pip install "seedpass[gui]"
# or when working from a local checkout
pip install -e .[gui]
```
After installing the optional GUI extras, add the BeeWare backend for your
platform:
```bash
# Linux

View File

@@ -14,10 +14,17 @@ python -m seedpass_gui
seedpass-gui
```
Only `toga-core` and the headless `toga-dummy` backend ship with the project.
The installation scripts automatically install the correct BeeWare backend so
the GUI works out of the box. If you set up SeedPass manually, install the
backend for your platform:
GUI dependencies are optional. Install them alongside SeedPass with:
```bash
pip install "seedpass[gui]"
# or when working from a local checkout
pip install -e .[gui]
```
After installing the optional GUI extras, add the BeeWare backend for your
platform:
```bash
# Linux

9
poetry.lock generated
View File

@@ -1854,7 +1854,7 @@ version = "10.4.0"
description = "Python Imaging Library (Fork)"
optional = false
python-versions = ">=3.8"
groups = ["dev"]
groups = ["main", "dev"]
files = [
{file = "pillow-10.4.0-cp310-cp310-macosx_10_10_x86_64.whl", hash = "sha256:4d9667937cfa347525b319ae34375c37b9ee6b525440f3ef48542fcf66f2731e"},
{file = "pillow-10.4.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:543f3dc61c18dafb755773efc89aae60d06b6596a63914107f75459cf984164d"},
@@ -2905,6 +2905,7 @@ files = [
{file = "toga_core-0.5.2-py3-none-any.whl", hash = "sha256:e872cebd2d899e9138f73393e8cd834a55a057aa269608ff7314a853ab33cb4e"},
{file = "toga_core-0.5.2.tar.gz", hash = "sha256:bdd3760146b74c8d315cb901392c2b645ab3e5d4cd90114f3e36e0e7dad3d6d1"},
]
markers = {main = "extra == \"gui\""}
[package.dependencies]
travertino = "0.5.2"
@@ -2994,6 +2995,7 @@ files = [
{file = "travertino-0.5.2-py3-none-any.whl", hash = "sha256:fd69ac3b14f2847e4c972198588b8a86ca3b437aaa0c8ce7259bbe5dab17aff1"},
{file = "travertino-0.5.2.tar.gz", hash = "sha256:5afcc673e14e16c3c04c0e3fe387062633e6bc88e87bc0bbd214a04b4dfbbcd4"},
]
markers = {main = "extra == \"gui\""}
[package.extras]
dev = ["coverage-conditional-plugin (==0.9.0)", "coverage[toml] (==7.9.2)", "pytest (==8.4.1)", "tox (==4.27.0)", "typing-extensions (==4.12.2) ; python_version < \"3.10\""]
@@ -3386,7 +3388,10 @@ idna = ">=2.0"
multidict = ">=4.0"
propcache = ">=0.2.1"
[extras]
gui = ["pillow", "toga-core"]
[metadata]
lock-version = "2.1"
python-versions = ">=3.10,<3.13"
content-hash = "9328b804a5f8600a6dbf7c857d35d1edbbc4727084aed8bde34d49967775a6ff"
content-hash = "8d9d5db692f39b9b05e0a365d779505583074f510d34de17627ac1849ca61bde"

View File

@@ -6,7 +6,6 @@ authors = []
[tool.poetry.dependencies]
python = ">=3.10,<3.13"
toga-core = ">=0.5.2"
colorama = ">=0.4.6"
termcolor = ">=1.1.0"
cryptography = ">=40.0.2"
@@ -35,6 +34,11 @@ orjson = "*"
argon2-cffi = "*"
PyJWT = ">=2.8.0"
slowapi = "^0.1.9"
toga-core = { version = ">=0.5.2", optional = true }
pillow = { version = "*", optional = true }
[tool.poetry.extras]
gui = ["toga-core", "pillow"]
[tool.poetry.group.dev.dependencies]
pytest = "^8.2"

View File

@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile --generate-hashes --output-file=requirements.lock src/requirements.txt

View File

@@ -255,7 +255,7 @@ if ($LASTEXITCODE -ne 0) {
Write-Error "Dependency installation failed."
}
& "$VenvDir\Scripts\python.exe" -m pip install -e .
& "$VenvDir\Scripts\python.exe" -m pip install -e .[gui]
if ($LASTEXITCODE -ne 0) {
Write-Error "Failed to install SeedPass package"
}

View File

@@ -143,7 +143,7 @@ main() {
print_info "Installing/updating Python dependencies from requirements.lock..."
pip install --upgrade pip
pip install --require-hashes -r requirements.lock
pip install -e .
pip install -e .[gui]
print_info "Installing platform-specific Toga backend..."
if [ "$OS_NAME" = "Linux" ]; then
print_info "Installing toga-gtk for Linux..."

View File

@@ -27,4 +27,3 @@ requests>=2.32
python-multipart>=0.0.20
orjson
argon2-cffi
toga-core>=0.5.2