From c0fcd16100b2493bf44df837680197b7528a91be Mon Sep 17 00:00:00 2001 From: Shariq Malik Date: Mon, 2 Jan 2023 07:51:42 +0500 Subject: [PATCH 1/3] Fixed Error of unicode encoding Fixed the Error of unsupported Unicode encoding in Windows while reading the `pages.toml` file. --- src/st_pages/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/st_pages/__init__.py b/src/st_pages/__init__.py index ab11730..95d4326 100644 --- a/src/st_pages/__init__.py +++ b/src/st_pages/__init__.py @@ -197,7 +197,7 @@ def _get_pages_from_config(path: str = ".streamlit/pages.toml") -> list[Page] | Given a path to a TOML file, read the file and return a list of Page objects """ try: - raw_pages: list[dict[str, str | bool]] = toml.loads(Path(path).read_text())[ + raw_pages: list[dict[str, str | bool]] = toml.loads(Path(path).read_text(encoding='utf-8'))[ "pages" ] except (FileNotFoundError, toml.decoder.TomlDecodeError, KeyError): From 2f5037e22f403ff7546601582530c473b5ac22c9 Mon Sep 17 00:00:00 2001 From: Zachary Blackwood Date: Tue, 3 Jan 2023 09:34:12 -0500 Subject: [PATCH 2/3] Black format, bump version --- pyproject.toml | 2 +- src/st_pages/__init__.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 34461d1..09a28fb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "st-pages" -version = "0.3.0" +version = "0.3.1" description = "An experimental version of Streamlit Multi-Page Apps" authors = ["Zachary Blackwood "] readme = "README.md" diff --git a/src/st_pages/__init__.py b/src/st_pages/__init__.py index 95d4326..af8d49d 100644 --- a/src/st_pages/__init__.py +++ b/src/st_pages/__init__.py @@ -197,9 +197,9 @@ def _get_pages_from_config(path: str = ".streamlit/pages.toml") -> list[Page] | Given a path to a TOML file, read the file and return a list of Page objects """ try: - raw_pages: list[dict[str, str | bool]] = toml.loads(Path(path).read_text(encoding='utf-8'))[ - "pages" - ] + raw_pages: list[dict[str, str | bool]] = toml.loads( + Path(path).read_text(encoding="utf-8") + )["pages"] except (FileNotFoundError, toml.decoder.TomlDecodeError, KeyError): st.error( f""" From d404c344883e2f31bdc0a4ac8c72907d1a9d7e1c Mon Sep 17 00:00:00 2001 From: Zachary Blackwood Date: Tue, 3 Jan 2023 09:36:52 -0500 Subject: [PATCH 3/3] Also test on PR in case of external PR --- .github/workflows/testing.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 51e214a..81394bb 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -2,6 +2,7 @@ name: testing on: push: + pull_request: jobs: test: