From 80e5c307a0914a930b19708db0ae30f5847a7a92 Mon Sep 17 00:00:00 2001 From: Daniel Estoll Date: Mon, 4 Aug 2025 10:41:06 -0600 Subject: [PATCH 1/2] Updated encoding to utf-8 --- polyapi/generate.py | 6 +++--- polyapi/utils.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/polyapi/generate.py b/polyapi/generate.py index 16793fc..4397499 100644 --- a/polyapi/generate.py +++ b/polyapi/generate.py @@ -503,7 +503,7 @@ def add_function_file( # Read current __init__.py content if it exists init_content = "" if os.path.exists(init_path): - with open(init_path, "r") as f: + with open(init_path, "r", encoding='utf-8') as f: init_content = f.read() # Prepare new content to append to __init__.py @@ -511,12 +511,12 @@ def add_function_file( # Use temporary files for atomic writes # Write to __init__.py atomically - with tempfile.NamedTemporaryFile(mode="w", delete=False, dir=full_path, suffix=".tmp") as temp_init: + with tempfile.NamedTemporaryFile(mode="w", delete=False, dir=full_path, suffix=".tmp", encoding='utf-8') as temp_init: temp_init.write(new_init_content) temp_init_path = temp_init.name # Write to function file atomically - with tempfile.NamedTemporaryFile(mode="w", delete=False, dir=full_path, suffix=".tmp") as temp_func: + with tempfile.NamedTemporaryFile(mode="w", delete=False, dir=full_path, suffix=".tmp", encoding='utf-8') as temp_func: temp_func.write(func_type_defs) temp_func_path = temp_func.name diff --git a/polyapi/utils.py b/polyapi/utils.py index 4c803c0..6a7b475 100644 --- a/polyapi/utils.py +++ b/polyapi/utils.py @@ -24,7 +24,7 @@ def init_the_init(full_path: str, code_imports: Optional[str] = None) -> None: if not os.path.exists(init_path): if code_imports is None: code_imports = CODE_IMPORTS - with open(init_path, "w") as f: + with open(init_path, "w", encoding='utf-8') as f: f.write(code_imports) @@ -33,7 +33,7 @@ def add_import_to_init(full_path: str, next: str, code_imports: Optional[str] = init_the_init(full_path, code_imports=code_imports) init_path = os.path.join(full_path, "__init__.py") - with open(init_path, "a+") as f: + with open(init_path, "a+", encoding='utf-8') as f: import_stmt = "from . import {}\n".format(next) f.seek(0) lines = f.readlines() From e09b1b39d9a580ec7872e58508ef802cd7f98f9e Mon Sep 17 00:00:00 2001 From: Daniel Estoll Date: Mon, 4 Aug 2025 10:41:57 -0600 Subject: [PATCH 2/2] bumped version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 18031a6..8086a2a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["setuptools>=61.2", "wheel"] [project] name = "polyapi-python" -version = "0.3.9" +version = "0.3.10.dev1" description = "The Python Client for PolyAPI, the IPaaS by Developers for Developers" authors = [{ name = "Dan Fellin", email = "dan@polyapi.io" }] dependencies = [