Skip to content
Merged

R26 #86

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
129 commits
Select commit Hold shift + click to select a range
2a4b538
# Feature (2970): Update python client to support setup command (#22)
sudiptatj Oct 31, 2024
8723978
improve polyapi-python setup (#24)
eupharis Nov 4, 2024
7ece4d0
# Feature (3007): Update python -m polyapi function add --logs option…
sudiptatj Nov 4, 2024
e292e4e
Project Glide + Refactor main command line args parsing (#26)
aarongoin Nov 14, 2024
cd89d8a
fix for poly cache directory path construction
aarongoin Nov 18, 2024
a8c2f52
one more adjustment to the deployables cache directory so there can't…
aarongoin Nov 18, 2024
4a0277a
this better?
aarongoin Nov 18, 2024
571e85a
verbose logging on upload code to see what's failing in CI/CD
aarongoin Nov 18, 2024
dbbbe61
bumpity
aarongoin Nov 18, 2024
c03268e
whoops
aarongoin Nov 18, 2024
64c2e37
so close
aarongoin Nov 18, 2024
2f71748
better?
aarongoin Nov 18, 2024
57a2d40
okay this should be the fix
aarongoin Nov 18, 2024
0e78bd3
is it this?
aarongoin Nov 18, 2024
30b2a28
maybe
aarongoin Nov 18, 2024
156d3df
oh for the love of pete
aarongoin Nov 18, 2024
20d8982
whatever. might be a pypi issue
aarongoin Nov 19, 2024
37b421b
removing verbose logging
aarongoin Nov 19, 2024
4cc8a16
fixing bugs in sync command to use correct api urls
aarongoin Nov 19, 2024
aa0be64
update logging
aarongoin Nov 19, 2024
db8aec6
lint
aarongoin Nov 19, 2024
32a65d1
improved auth
aarongoin Nov 19, 2024
14cf1ce
last fix for function sync
aarongoin Nov 19, 2024
9d4824a
fix bug when comment arguments don't align with the function
aarongoin Nov 19, 2024
ffe19f0
try forcing the poly directory to exist
aarongoin Nov 20, 2024
0d32c4a
test logging
aarongoin Nov 20, 2024
8bbb2c7
remove debug logging
aarongoin Nov 20, 2024
2808c97
fixing project glide deployable types and bumping the version
aarongoin Nov 22, 2024
123f0b7
fixing missing arguments in python client function upload
aarongoin Nov 22, 2024
7dc7afe
fixing return type for trained functions
aarongoin Nov 22, 2024
e117f1e
fix bug preventing use of poly sync command locally
aarongoin Nov 22, 2024
d4a656f
next version of client!
eupharis Nov 26, 2024
7441019
EN #3183 allow null logs flag for python client (#28)
eneumann Dec 5, 2024
57e7369
let the typing_extensions versions increase to support latest openai …
eupharis Dec 6, 2024
03fd34c
update dependency in one more place
eupharis Dec 6, 2024
28a1c39
Some bug fixes for python client (#29)
aarongoin Dec 14, 2024
027ceb5
Merge branch 'main' into develop
eupharis Dec 23, 2024
4ff9ba9
0.3.2
eupharis Dec 23, 2024
e895ae9
add poly schemas support (#31)
eupharis Mar 24, 2025
d189377
update to v4
eupharis Mar 24, 2025
a140802
v4 everywhere
eupharis Mar 24, 2025
96f63c3
bump version
eupharis Mar 24, 2025
15eab87
add new version
eupharis Mar 24, 2025
3ad2607
remove warning, just go with any type for now
eupharis Mar 26, 2025
1479d39
better generate printed messages, fix generate bug after function add
eupharis Mar 26, 2025
7db1cbe
Update python version (#32)
dchiniquy Mar 27, 2025
a3f09cd
Update python image (#33)
dchiniquy Mar 27, 2025
19fafde
Rollback version
nahuel-polyapi Mar 27, 2025
fccbf1e
onward (#34)
eupharis Apr 8, 2025
1e947d6
next (#35)
eupharis Apr 8, 2025
11108e0
improve intellisense detection of schemas
eupharis Apr 11, 2025
ef7e5e9
release 0.3.3.dev8, fix misleading generate after setup
eupharis Apr 14, 2025
71e2332
0.3.3.dev9 - add support for optional arguments (#36)
eupharis Apr 14, 2025
2b4a2d0
next
eupharis Apr 15, 2025
2169e15
release 0.3.3.dev10
eupharis Apr 15, 2025
c2db3e9
EN #3943 update to support SFX serverSideAsync True by setting correc…
eneumann May 2, 2025
2fc69ea
deploying version 0.3.3 for R22
nahuel-polyapi May 6, 2025
1e683f2
Merge branch 'main' into develop
eupharis May 6, 2025
a4a4872
upgrade version
FedeMarchiniHotovo May 6, 2025
e0e74b7
Merge branch 'main' into develop
FedeMarchiniHotovo May 6, 2025
a6ba2f3
4084 - revert strippping none values from function arguments during e…
akinboboye May 7, 2025
9c1a2a1
P2) Update clients and specs endpoint so when generating with no-type…
RichardDzurus May 7, 2025
d20794b
4010 generate contexts (#43)
akinboboye May 8, 2025
d02bae3
make contexts truly optional
eupharis May 12, 2025
bf238b2
P3) (Optoro) Allow variable to be secret in the UI, but gettable in f…
RichardDzurus May 13, 2025
78d4b15
add generate contexts (#45)
akinboboye May 15, 2025
ebf6e6b
adds mtls and direct execute options (#44)
RichardDzurus May 22, 2025
938dfdd
polyCustom - prevent rewrites of executionId (#46)
RichardDzurus May 26, 2025
db5381b
4292 (#47)
akinboboye May 27, 2025
93cff00
create mock schemas to fit everything when using no types flag (#48)
RichardDzurus May 28, 2025
050853e
EN #4348 flatten new-lines in arg descriptions (#50)
eneumann May 28, 2025
ee50a54
EN #4360 fix return types for TS funcs (#49)
eneumann May 28, 2025
bd33593
adding ability for python client server and client functions to add c…
aarongoin May 28, 2025
bc8e096
fix type error!
aarongoin May 28, 2025
569ec60
try simple upgrade
eupharis May 30, 2025
8c9d3d1
changed version
FedeMarchiniHotovo Jun 3, 2025
bd5729d
0.3.8.dev0 make it clearer that jsonschema parsing issue is warning n…
eupharis Jun 4, 2025
19c5613
4418 p2 bug on glide pre commit hook poly prepare make sure we git ad…
Daniel-Estoll Jun 18, 2025
391871a
4523 fix python client to save generate command arguments and reuse t…
Ash1R Jun 18, 2025
0026216
Update pydantic version to work with Python 3.13 (#54)
Ash1R Jun 24, 2025
a719bc0
fix vari under no types (#56)
eupharis Jun 25, 2025
0052b8e
better import error (#59)
eupharis Jun 26, 2025
cde7993
4645 Add github action for polyapi-python unittests, fix polyapi-pyth…
Ash1R Jun 26, 2025
4672a5a
Windows glide bug (#61)
Daniel-Estoll Jun 26, 2025
aa693fe
version command in python (#58)
RichardDzurus Jun 27, 2025
c6d9b8e
P2) Webhook Payload Type Blows Up our Python Client (#62)
RichardDzurus Jun 27, 2025
d47ab1d
Fixing bug where users couldn't put a description in their polyConfig…
aarongoin Jun 27, 2025
d32781a
next
eupharis Jun 30, 2025
f8416ee
fix schema generation (#64)
RichardDzurus Jun 30, 2025
88c55a3
remove bad ci file
eupharis Jun 30, 2025
58ac792
Upgrading version to 0.3.8 (#67)
nahuel-polyapi Jul 1, 2025
7dc8423
Merge branch 'main' into develop
eupharis Jul 1, 2025
8f0e01a
4655 p3 polyapi python schema errors lets fix (#63)
Daniel-Estoll Jul 7, 2025
5bad68b
Fixed find deployables command to ensure there are no duplicates (#65)
Daniel-Estoll Jul 7, 2025
b954112
Added check for LOGS_ENABLED env var and updated exceptions (#70)
Daniel-Estoll Jul 8, 2025
3b9ea19
allow higher stdlib_list
eupharis Jul 8, 2025
f5df984
update in one more spot
eupharis Jul 8, 2025
7a7c9b4
Merge branch 'main' into develop
eupharis Jul 8, 2025
c880a6a
increase version of truststore installed
eupharis Jul 8, 2025
e59776c
added logger (#72)
Daniel-Estoll Jul 9, 2025
f4ed72e
Change print to use logging (#73)
Daniel-Estoll Jul 16, 2025
c612f6e
EN #4845 fix function args schema bug for TypedDicts
eneumann Jul 17, 2025
a584bea
Revert c612f6e (EN #4845 fix function args schema bug for TypedDicts)…
eneumann Jul 17, 2025
1575998
EN bump v to 0.3.9.dev8
eneumann Jul 17, 2025
f51658c
EN #4845 fix func arg schema bug with typed dicts (#75)
eneumann Jul 17, 2025
eb81b46
Tabi sdk (#74)
aarongoin Jul 17, 2025
afb18ff
oh lordy (#76)
aarongoin Jul 17, 2025
c15d143
One more missed f-string in tabi
aarongoin Jul 17, 2025
6d9e606
Revert monkey patch (#77)
Daniel-Estoll Jul 18, 2025
5b9f621
remove need for special logging process
eupharis Jul 21, 2025
38827b6
fix GitHub action for polyapi python unittests, fix polyapi python un…
Ash1R Jul 21, 2025
65201eb
running into weird ord bug in python3.11, lets do simpler 7 char hash…
eupharis Jul 25, 2025
e3a343b
fix tests
eupharis Jul 28, 2025
25e768a
add workflow dispatch
eupharis Jul 28, 2025
422fcc6
try under 3.13
eupharis Jul 28, 2025
d1750c6
0.3.9.dev15: define some sort of scrub_keys
eupharis Jul 28, 2025
d6b18d7
back up
eupharis Jul 28, 2025
87caa04
actually fix tests
eupharis Jul 28, 2025
8a44827
Revert "actually fix tests"
eupharis Jul 28, 2025
06e8a41
in sync with actions now?
eupharis Jul 28, 2025
989840f
update version for deploy
aarongoin Jul 31, 2025
c263e9f
Updated encoding to utf-8 (#82)
Daniel-Estoll Aug 4, 2025
a61b97f
EN #4926 fix parser to include kwargs when parsing function params (#83)
eneumann Aug 12, 2025
f40d530
EN #4926 Disallow keyword only args (#84)
eneumann Aug 14, 2025
546c839
4940 add visibility argument (#81)
Daniel-Estoll Aug 27, 2025
6471245
Implemented scrub_keys function (#85)
Daniel-Estoll Sep 3, 2025
dddf98f
fix python
eupharis Sep 3, 2025
fe0892d
Prepare for deploy
aarongoin Sep 4, 2025
7611e79
prep
aarongoin Sep 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion polyapi/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,13 @@ def generate_command(args):
fn_add_parser.add_argument("--execution-api-key", required=False, default="", help="API key for execution (for server functions only).")
fn_add_parser.add_argument("--disable-ai", "--skip-generate", action="store_true", help="Pass --disable-ai skip AI generation of missing descriptions")
fn_add_parser.add_argument("--generate-contexts", type=str, help="Server function only – only include certain contexts to speed up function execution")
fn_add_parser.add_argument("--visibility", type=str, default="environment", help="Specifies the visibility of a function. Options: PUBLIC, TENANT, ENVIRONMENT. Case insensitive")

def add_function(args):
initialize_config()
logs_enabled = args.logs == "enabled" if args.logs else None
err = ""
visibility = args.visibility.upper()
if args.server and args.client:
err = "Specify either `--server` or `--client`. Found both."
elif not args.server and not args.client:
Expand All @@ -126,6 +128,8 @@ def add_function(args):
err = "Option `logs` is only for server functions (--server)."
elif args.generate_contexts and not args.server:
err = "Option `generate-contexts` is only for server functions (--server)."
elif visibility not in ["PUBLIC", "TENANT", "ENVIRONMENT"]:
err = "Invalid visiblity argument, visibility must be one of ['PUBLIC', 'TENANT', 'ENVIRONMENT']"

if err:
print_red("ERROR")
Expand All @@ -142,7 +146,8 @@ def add_function(args):
logs_enabled=logs_enabled,
generate=not args.disable_ai,
execution_api_key=args.execution_api_key,
generate_contexts=args.generate_contexts
generate_contexts=args.generate_contexts,
visibility=visibility
)

fn_add_parser.set_defaults(command=add_function)
Expand Down
2 changes: 2 additions & 0 deletions polyapi/function_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def function_add_or_update(
server: bool,
logs_enabled: Optional[bool],
generate_contexts: Optional[str],
visibility: Optional[str],
generate: bool = True,
execution_api_key: str = ""
):
Expand Down Expand Up @@ -55,6 +56,7 @@ def function_add_or_update(
"description": description or parsed["types"]["description"],
"code": code,
"language": "python",
"visibility": visibility or "ENVIRONMENT",
"returnType": get_jsonschema_type(return_type),
"arguments": [{**p, "key": p["name"], "type": get_jsonschema_type(p["type"])} for p in parsed["types"]["params"]],
"logsEnabled": logs_enabled,
Expand Down
6 changes: 3 additions & 3 deletions polyapi/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,20 +503,20 @@ 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
new_init_content = init_content + f"\n\nfrom . import {func_namespace}\n\n{func_str}"

# 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

Expand Down
6 changes: 6 additions & 0 deletions polyapi/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,12 @@ def visit_FunctionDef(self, node: ast.FunctionDef):
if node.name == self._name:
# Parse docstring which may contain param types and descriptions
self._extract_docstring_from_function(node)

if node.args.kwonlyargs:
print_red("ERROR")
print("Function signature has keyword-only arguments (after `*`). Please use only positional arguments.")
sys.exit(1)

function_args = [arg for arg in node.args.args]
docstring_params = deployable["types"]["params"]
parsed_params = []
Expand Down
17 changes: 16 additions & 1 deletion polyapi/poly_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@
from polyapi.typedefs import TableSpecDto
from polyapi.constants import JSONSCHEMA_TO_PYTHON_TYPE_MAP

def scrub(data) -> Dict[str, Any]:
if (not data or not isinstance(data, (Dict, List))): return data
if isinstance(data, List):
return [scrub(item) for item in data]
else:
temp = {}
secrets = ["x_api_key", "x-api-key", "access_token", "access-token", "authorization", "api_key", "api-key", "apikey", "accesstoken", "token", "password", "key"]
for key, value in data.items():
if isinstance(value, (Dict, List)):
temp[key] = scrub(data[key])
elif key.lower() in secrets:
temp[key] = '********'
else:
temp[key] = data[key]
return temp

def scrub_keys(e: Exception) -> Dict[str, Any]:
"""
Expand All @@ -16,7 +31,7 @@ def scrub_keys(e: Exception) -> Dict[str, Any]:
"error": str(e),
"type": type(e).__name__,
"message": str(e),
"args": getattr(e, 'args', None)
"args": scrub(getattr(e, 'args', None))
}


Expand Down
4 changes: 2 additions & 2 deletions polyapi/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["setuptools>=61.2", "wheel"]

[project]
name = "polyapi-python"
version = "0.3.9"
version = "0.3.10"
description = "The Python Client for PolyAPI, the IPaaS by Developers for Developers"
authors = [{ name = "Dan Fellin", email = "dan@polyapi.io" }]
dependencies = [
Expand Down