From 6896467e5b1c220d339df29ee20d1192c1285a1a Mon Sep 17 00:00:00 2001 From: Zachary Blackwood Date: Wed, 25 Sep 2024 09:40:59 -0400 Subject: [PATCH 1/3] Add alternative method for running with inline script dependencies + uv --- README.md | 4 ++++ mkbsd.py | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/README.md b/README.md index 2d34182..1a1c843 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,10 @@ MKBSD comes in two variants! Node.js and Python. 4. Wait a little. 5. All wallpapers are now in a newly created `downloads` subfolder. +Alternatively, instead of steps 2 and 3, you can: +* Install uv (https://docs.astral.sh/uv/#getting-started) +* Run `uv run mkbsd.py` + ## FAQ ### Q: What's the story behind this? diff --git a/mkbsd.py b/mkbsd.py index 2b33310..3a2c0ef 100644 --- a/mkbsd.py +++ b/mkbsd.py @@ -1,3 +1,9 @@ +# /// script +# requires-python = ">=3.12" +# dependencies = [ +# "aiohttp", +# ] +# /// # Licensed under the WTFPL License import os From 114183afc2f7634843f08aa1ec9deaec78b91307 Mon Sep 17 00:00:00 2001 From: Zachary Blackwood Date: Wed, 25 Sep 2024 09:45:13 -0400 Subject: [PATCH 2/3] Fix python version, clarify readme --- README.md | 2 +- mkbsd.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1a1c843..439cb9a 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ MKBSD comes in two variants! Node.js and Python. 4. Wait a little. 5. All wallpapers are now in a newly created `downloads` subfolder. -Alternatively, instead of steps 2 and 3, you can: +Alternatively, instead of steps 1-3, you can: * Install uv (https://docs.astral.sh/uv/#getting-started) * Run `uv run mkbsd.py` diff --git a/mkbsd.py b/mkbsd.py index 3a2c0ef..371d8a7 100644 --- a/mkbsd.py +++ b/mkbsd.py @@ -1,5 +1,5 @@ # /// script -# requires-python = ">=3.12" +# requires-python = ">=3.9" # dependencies = [ # "aiohttp", # ] @@ -35,7 +35,7 @@ async def main(): raise Exception(f"⛔ Failed to fetch JSON file: {response.status}") json_data = await response.json() data = json_data.get('data') - + if not data: raise Exception('⛔ JSON does not have a "data" property at its root.') From db230248e6425b4ce643481b59a1699a52456a29 Mon Sep 17 00:00:00 2001 From: Zachary Blackwood Date: Wed, 25 Sep 2024 09:46:09 -0400 Subject: [PATCH 3/3] Numbers instead of bullets --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 439cb9a..1671363 100644 --- a/README.md +++ b/README.md @@ -31,8 +31,8 @@ MKBSD comes in two variants! Node.js and Python. 5. All wallpapers are now in a newly created `downloads` subfolder. Alternatively, instead of steps 1-3, you can: -* Install uv (https://docs.astral.sh/uv/#getting-started) -* Run `uv run mkbsd.py` +1. Install uv (https://docs.astral.sh/uv/#getting-started) +2. Run `uv run mkbsd.py` ## FAQ