From 00edb44442a194ff2f037aa4af6cd17460cba859 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Thu, 7 Aug 2025 10:51:13 -0400 Subject: [PATCH] feat: make GUI dependencies optional --- README.md | 15 +++++++++++---- .../content/01-getting-started/06-gui_adapter.md | 15 +++++++++++---- poetry.lock | 9 +++++++-- pyproject.toml | 6 +++++- requirements.lock | 2 +- scripts/install.ps1 | 2 +- scripts/install.sh | 2 +- src/runtime_requirements.txt | 1 - 8 files changed, 37 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index fca742f..163fe7c 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/docs/docs/content/01-getting-started/06-gui_adapter.md b/docs/docs/content/01-getting-started/06-gui_adapter.md index dcb2dac..89f015b 100644 --- a/docs/docs/content/01-getting-started/06-gui_adapter.md +++ b/docs/docs/content/01-getting-started/06-gui_adapter.md @@ -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 diff --git a/poetry.lock b/poetry.lock index 2ee3e1b..da03718 100644 --- a/poetry.lock +++ b/poetry.lock @@ -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" diff --git a/pyproject.toml b/pyproject.toml index 70f438c..6c5841a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" diff --git a/requirements.lock b/requirements.lock index 24efcbf..231e432 100644 --- a/requirements.lock +++ b/requirements.lock @@ -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 diff --git a/scripts/install.ps1 b/scripts/install.ps1 index bd5509e..91b389f 100644 --- a/scripts/install.ps1 +++ b/scripts/install.ps1 @@ -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" } diff --git a/scripts/install.sh b/scripts/install.sh index 93d5b62..93a1133 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -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..." diff --git a/src/runtime_requirements.txt b/src/runtime_requirements.txt index a970f15..dc4464c 100644 --- a/src/runtime_requirements.txt +++ b/src/runtime_requirements.txt @@ -27,4 +27,3 @@ requests>=2.32 python-multipart>=0.0.20 orjson argon2-cffi -toga-core>=0.5.2