From 07ecc52206d419437ea20766fe68fde7028e5a4a Mon Sep 17 00:00:00 2001 From: Henry Webel Date: Wed, 26 Feb 2025 16:17:12 +0100 Subject: [PATCH 1/6] :sparkles: test also on Windows and Mac (some formatting) - macos-13 uses Intel Architecture, latest arm64 https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners --- .github/workflows/cdci.yml | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/cdci.yml b/.github/workflows/cdci.yml index 1fa82e6..b4908ef 100644 --- a/.github/workflows/cdci.yml +++ b/.github/workflows/cdci.yml @@ -7,24 +7,25 @@ on: branches: [main] release: types: [published] - + jobs: test: name: Unittests+streamlit - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} strategy: matrix: + os: ["ubuntu-latest", "macos-13", "macos-latest", "windows-latest"] python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v4 - - uses: psf/black@stable + - uses: psf/black@stable - uses: isort/isort-action@v1 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - cache: 'pip' # caching pip dependencies - cache-dependency-path: '**/pyproject.toml' + cache: "pip" # caching pip dependencies + cache-dependency-path: "**/pyproject.toml" - name: Install dependencies run: | python -m pip install --upgrade pip @@ -37,12 +38,13 @@ jobs: cd docs vuegen --directory example_data/Earth_microbiome_vuegen_demo_notebook vuegen --config example_data/Earth_microbiome_vuegen_demo_notebook/Earth_microbiome_vuegen_demo_notebook_config.yaml - + other-reports: name: Integration tests - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} strategy: matrix: + os: ["ubuntu-latest", "macos-13", "macos-latest", "windows-latest"] python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v4 @@ -50,8 +52,8 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - cache: 'pip' # caching pip dependencies - cache-dependency-path: '**/pyproject.toml' + cache: "pip" # caching pip dependencies + cache-dependency-path: "**/pyproject.toml" - name: Install dependencies run: | pip install --upgrade pip @@ -110,7 +112,7 @@ jobs: steps: - uses: actions/checkout@v4 - + - uses: actions/setup-python@v5 with: python-version: "3.11" From 86ab36879544b67912d34d7717ef18ecc310399d Mon Sep 17 00:00:00 2001 From: Henry Webel Date: Thu, 27 Feb 2025 09:31:01 +0100 Subject: [PATCH 2/6] :zap: isort does not support windows. check basic pkg only on ubuntu but test usage of package on all platforms (as good as possible) --- .github/workflows/cdci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cdci.yml b/.github/workflows/cdci.yml index b4908ef..cb4a68c 100644 --- a/.github/workflows/cdci.yml +++ b/.github/workflows/cdci.yml @@ -14,7 +14,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: ["ubuntu-latest", "macos-13", "macos-latest", "windows-latest"] + os: ["ubuntu-latest"] # test only on ubuntu basic tests, but run integration on all platforms python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v4 From faa8fc4ea6bb3889c1ed1cd4dcbb0b2dd939636f Mon Sep 17 00:00:00 2001 From: enryh Date: Fri, 7 Mar 2025 12:51:57 +0100 Subject: [PATCH 3/6] =?UTF-8?q?=F0=9F=9A=A7=20check=20if=20printed=20messa?= =?UTF-8?q?ge=20is=20an=20issue=20on=20windows=20server?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/vuegen/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vuegen/__main__.py b/src/vuegen/__main__.py index 2f2565a..3472ab1 100644 --- a/src/vuegen/__main__.py +++ b/src/vuegen/__main__.py @@ -48,7 +48,7 @@ def main(): ) # Print completion message - print_completion_message(report_type) + # print_completion_message(report_type) # ! test if message is an issue on windows if __name__ == "__main__": From 05c4139e900b034550ded71ed3f647ee67c2f799 Mon Sep 17 00:00:00 2001 From: enryh Date: Fri, 7 Mar 2025 13:09:49 +0100 Subject: [PATCH 4/6] :bug: strip unicode in case not supported on os --- src/vuegen/__main__.py | 2 +- src/vuegen/utils.py | 34 +++++++++++++++++++++++++++------- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/vuegen/__main__.py b/src/vuegen/__main__.py index 3472ab1..564f678 100644 --- a/src/vuegen/__main__.py +++ b/src/vuegen/__main__.py @@ -48,7 +48,7 @@ def main(): ) # Print completion message - # print_completion_message(report_type) # ! test if message is an issue on windows + print_completion_message(report_type) # ! test if message is an issue on windows if __name__ == "__main__": diff --git a/src/vuegen/utils.py b/src/vuegen/utils.py index 41fa4e7..9c3d783 100644 --- a/src/vuegen/utils.py +++ b/src/vuegen/utils.py @@ -5,6 +5,7 @@ import logging import os import sys +import unicodedata from datetime import datetime try: @@ -729,14 +730,31 @@ def get_logger(log_suffix): return logger +def strip_unicode(text: str) -> str: + """ + Strip Unicode characters from the given text. + + Parameters + ---------- + text : str + The input text from which to strip Unicode characters. + + Returns + ------- + str + The text with Unicode characters removed. + """ + return "".join(c for c in text if ord(c) < 128) + + def print_completion_message(report_type: str): """ Prints a formatted completion message after report generation. """ border = "─" * 65 # Creates a separator line if report_type == "streamlit": - print( - """🚀 Streamlit Report Generated! + msg = """ +🚀 Streamlit Report Generated! 📂 All scripts to build the Streamlit app are available at: streamlit_report/sections @@ -749,10 +767,9 @@ def print_completion_message(report_type: str): 🛠️ Advanced users can modify the Python scripts directly in: streamlit_report/sections """ - ) else: - print( - f"""🚀 {report_type.capitalize()} Report Generated! + msg = f""" +🚀 {report_type.capitalize()} Report Generated! 📂 Your {report_type} report is available at: quarto_report @@ -762,8 +779,11 @@ def print_completion_message(report_type: str): 🛠️ Advanced users can modify the report template directly in: quarto_report/quarto_report.qmd """ - ) - + try: + print(msg) + except UnicodeEncodeError: + msg = strip_unicode(msg) + print(msg) print(border) From cba7cae03c025796d2621c401595d8e173efd0c0 Mon Sep 17 00:00:00 2001 From: enryh Date: Fri, 7 Mar 2025 13:21:18 +0100 Subject: [PATCH 5/6] :bug: format and border was also using non ASCII character --- src/vuegen/__main__.py | 2 +- src/vuegen/utils.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/vuegen/__main__.py b/src/vuegen/__main__.py index 564f678..28a5d21 100644 --- a/src/vuegen/__main__.py +++ b/src/vuegen/__main__.py @@ -48,7 +48,7 @@ def main(): ) # Print completion message - print_completion_message(report_type) # ! test if message is an issue on windows + print_completion_message(report_type) # ! test if message is an issue on windows if __name__ == "__main__": diff --git a/src/vuegen/utils.py b/src/vuegen/utils.py index 9c3d783..4dae246 100644 --- a/src/vuegen/utils.py +++ b/src/vuegen/utils.py @@ -781,10 +781,11 @@ def print_completion_message(report_type: str): """ try: print(msg) + print(border) except UnicodeEncodeError: msg = strip_unicode(msg) print(msg) - print(border) + print('-' * 65) ## REPORT FORMATTING From 95f94e4dcf589b5515d722111c4f3f491badb2bf Mon Sep 17 00:00:00 2001 From: enryh Date: Fri, 7 Mar 2025 13:25:52 +0100 Subject: [PATCH 6/6] :format: format --- src/vuegen/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vuegen/utils.py b/src/vuegen/utils.py index 4dae246..c10876a 100644 --- a/src/vuegen/utils.py +++ b/src/vuegen/utils.py @@ -785,7 +785,7 @@ def print_completion_message(report_type: str): except UnicodeEncodeError: msg = strip_unicode(msg) print(msg) - print('-' * 65) + print("-" * 65) ## REPORT FORMATTING