From 581e19018c8650d7855a55f28d65e172d242c1f5 Mon Sep 17 00:00:00 2001 From: Winston Chang Date: Fri, 22 Dec 2023 14:44:33 -0600 Subject: [PATCH 1/3] Bump version to 0.6.1.1 --- shiny/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shiny/__init__.py b/shiny/__init__.py index d729a043a..158dc7e65 100644 --- a/shiny/__init__.py +++ b/shiny/__init__.py @@ -1,6 +1,6 @@ """A package for building reactive web applications.""" -__version__ = "0.6.1" +__version__ = "0.6.1.1" from ._shinyenv import is_pyodide as _is_pyodide From 5c6537e3c03c198c2134eae2ec699edb336cfafe Mon Sep 17 00:00:00 2001 From: Winston Chang Date: Fri, 22 Dec 2023 14:46:33 -0600 Subject: [PATCH 2/3] Switch from `requests` to `urllib` (#940) --- CHANGELOG.md | 7 +++++++ shiny/_template_utils.py | 21 +++++++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 38c3c330a..c1c7328e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [UNRELEASED] + +### Bug fixes + +* Fixed #935: `shiny create` required the `requests` package, but it was not listed as a dependency. (#940) + + ## [0.6.1] - 2023-12-18 ### New features diff --git a/shiny/_template_utils.py b/shiny/_template_utils.py index dd9d54072..e2fb4e9b4 100644 --- a/shiny/_template_utils.py +++ b/shiny/_template_utils.py @@ -1,14 +1,17 @@ +from __future__ import annotations + import os import shutil import sys import tempfile import zipfile from pathlib import Path -from typing import Dict, List, Optional +from typing import Optional, cast +from urllib.error import URLError from urllib.parse import urlparse +from urllib.request import urlopen import questionary -import requests from questionary import Choice from ._custom_component_template_questions import ( @@ -33,7 +36,7 @@ back_choice: Choice = Choice(title=[("class:secondary", "← Back")], value="back") -def choice_from_dict(choice_dict: Dict[str, str]) -> List[Choice]: +def choice_from_dict(choice_dict: dict[str, str]) -> list[Choice]: return [Choice(title=key, value=value) for key, value in choice_dict.items()] @@ -75,10 +78,16 @@ def template_query(question_state: Optional[str] = None, mode: Optional[str] = N def download_and_extract_zip(url: str, temp_dir: Path): - response = requests.get(url) - response.raise_for_status() + try: + response = urlopen(url) + data = cast(bytes, response.read()) + except URLError as e: + # Note that HTTPError is a subclass of URLError + e.msg += f" for url: {url}" # pyright: ignore + raise e + zip_file_path = temp_dir / "repo.zip" - zip_file_path.write_bytes(response.content) + zip_file_path.write_bytes(data) with zipfile.ZipFile(zip_file_path, "r") as zip_file: zip_file.extractall(temp_dir) From 4cea3b676db966815aecd57fe51299a293d1985a Mon Sep 17 00:00:00 2001 From: Winston Chang Date: Fri, 22 Dec 2023 14:48:10 -0600 Subject: [PATCH 3/3] Update changelog --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c1c7328e4..0ed31cc7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,11 +6,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [UNRELEASED] +## [0.6.1.1] - 2023-12-22 ### Bug fixes -* Fixed #935: `shiny create` required the `requests` package, but it was not listed as a dependency. (#940) +* Fixed #935: `shiny create` required the `requests` package, but it was not listed as a dependency. It now uses `urllib` instead, which is part of the Python standard library. (#940) ## [0.6.1] - 2023-12-18