Commit Graph

31 Commits

Author SHA1 Message Date
Stephan Fitzpatrick 56a3783aa5 feat(python): Refactor Windmill Python client (remove windmill-api) (#2665)
* "feat(python): Refactor Windmill Python client for better encapsulation and maintainability"

This PR obviates the need for the `windmill-api` library. I believe this makes the client package is easier to understand, debug, build, (and test) without it.

Additional updates were made to improve logging and add more robust error handling.

Here's what Jetbrains' AI assistant came up with to describe the changes based on the diff--I think it did a decent job:

> Simplified the Windmill Python client by refactoring out repeated code into more compact, reusable methods. Transitioned the client functions into a Windmill client class, enabling a better encapsulation of the client's state. Updated the README example to reflect this change. This improves code maintainability by making the code easier to understand and update, and improves user experience by providing a more intuitive client interface.

* "Refactor post method in Windmill Python client"

Removed the hard-coded param 'refresh_client' from the post method in wmill/client.py. since it's no longer used.

* "Update build script for Python client"

Updated the build script for the Python client for the backend to now include scaffolding code for generating the OpenAPI client, making changes to the generated client, and building the client. .

* "Add raise_for_status option in http methods"

Enhanced 'get' and 'post' methods in the client class to include a new optional parameter 'raise_for_status'. This allows for better error handling by raising exceptions for 4XX and 5XX responses, if requested. This way, non critical API calls can continue execution even if they receive a client or server error.

* "Removed refresh_client condition in post method"

* Replace `create_job` with `start_execution` in wmill client

This commit changes the method `create_job` to `start_execution` in the wmill client. The change was made to better reflect the function's purpose and make the code even more self-explanatory. Additionally, references to this changed method in README.md and various portions of client.py are also updated. The change will enhance readability and make it easier for newcomers to understand the code.

* Fix type hints and default arguments in wmill client

This commit adjusts typing hints for several methods from Dict[str, Any] to Any in wmill client since the result of a script isn't always a dictionary. Null arguments are also adjusted from {} to None, ensuring better Python standard practices and less unpredicted behaviors. These changes are aimed to enhance maintainability and make the functions more resilient.

* Update client.py

* Update pyproject.toml

* Update client.py

---------

Co-authored-by: Ruben Fiszel <ruben@rubenfiszel.com>
2023-11-22 09:49:50 +01:00
Stephan Fitzpatrick d1b1459ebb feat(python): Add functionality and resiliency to wmill python client (#2650)
* Refine wmill client.py `run_script_sync` and `run_script_by_path_sync` with more features

This commit enriches the functionality of the `run_script_sync` and `run_script_by_path_sync` functions. New features introduced include script cancellation upon exit, logging capabilities,
and script execution timeout. These enhancements improve script execution control and provide better debug information. The `get_result` function was also adjusted to enable the control
of 'is not None' assertion on the job result. Consequently, user flexibility is enhanced, and the method can cater to cases where a `None` result is within the expected behavior.

* remove unnecessary local import and rename cancel_atexit to cleanup
2023-11-20 02:07:20 +01:00
Ruben Fiszel b9dc8b6cff fix: make wmill compatible with python 3.7 2023-11-18 17:15:05 +01:00
Guillaume Bouvignies f932e4c916 feat: Add Python SDK capabilities to generate Polars and DuckDB connection settings to S3 (#2625)
* feat: Add Python SDK capabilities to generate Polars and DuckDB connection settings to S3

* Add endpoint to list S3 objects

* Add FE to set the workspace S3 resource

* Fix openapi

* sqlx prepare

* Hide Windmil LFS tab
2023-11-15 19:37:02 +01:00
Ruben Fiszel c65a90e41a fix: optimize single step iterative forloops (#2596)
* cc

* fixed
2023-11-10 13:17:39 +01:00
Ruben Fiszel 63901597f4 fix: fix get_result for python-client 2023-09-09 00:37:15 +02:00
Ruben Fiszel b96809902e fix: fix python client 2023-08-25 13:37:10 +02:00
Ruben Fiszel 868ac37978 fix: update python client with by_path methods 2023-08-24 15:54:47 +02:00
Ruben Fiszel 5909bd27d6 fix: fix python get_resource 2023-08-18 00:11:16 +02:00
Ruben Fiszel a8c46066b1 fix: unify clients to use server-side interpolation to retrieve full resources 2023-08-17 20:16:50 +02:00
Ruben Fiszel c711180bdc fix tar initialization 2023-08-14 16:16:42 +02:00
Ruben Fiszel 9970f6daeb feat: migrate state path to new schema 2023-08-11 18:54:47 +02:00
Ruben Fiszel 426471e85a fix loading nested resource in client fetched resources 2023-03-17 20:54:37 +01:00
Ruben Fiszel 74ef6e46c2 fix: support setting undefined states 2023-01-02 04:22:56 +01:00
Ruben Fiszel ebbc2039a2 update all clients to use update resource value 2023-01-01 10:26:11 +01:00
Ruben Fiszel 8fe77cf15a feat: add move to drawer for script and flows 2022-12-21 06:55:37 +01:00
Ruben Fiszel a3f6a810bd add resume urls at the api level 2022-12-02 22:19:15 +01:00
Ruben Fiszel f4507033a3 feat(deno,python): get/set_shared_state 2022-11-21 19:04:14 +01:00
Ruben Fiszel f85c7f0f87 fix(go-client): support setVariable, setResource, setState, getState 2022-11-19 16:54:12 +01:00
Ruben Fiszel 38be2fb301 fix(python-client): get_state on empty state return None 2022-11-19 10:10:38 +01:00
Ruben Fiszel 27b638b611 feat(python): add Resource[resource_type] as a parsed parameter 2022-11-16 14:08:55 +01:00
Ruben Fiszel d09d54d153 fix empty path for get_resource and set_resource 2022-11-15 14:28:22 +01:00
Ruben Fiszel 1d2d79306c fix(python-client): fix transform_leaves 2022-11-15 14:03:54 +01:00
Ruben Fiszel d1852630b8 fix(python-client): fix get_state 2022-11-15 13:59:58 +01:00
Ruben Fiszel 9447591c9d fix(python-client): fix set_resource 2022-11-15 13:38:46 +01:00
Ruben Fiszel e75aacc7db feat(clients): rename internal state as state + setters for resources/variables in python 2022-11-15 13:16:53 +01:00
Ruben Fiszel 685073799f fix(python-client): fix get_resource 2022-11-03 08:56:00 +01:00
Jakub Kołodziejczak 52f6db2e81 fix(python-client): provide backwards compatibility down to python3.7 (#738) (#739)
this reverts 79b176cbbd introducing
alternative way of avoiding bug described in
https://github.com/windmill-labs/windmill/issues/736#issuecomment-1279679730

the improvement here is that we're able to support more python versions
now
2022-10-15 10:27:07 +02:00
Ruben Fiszel dc67c07970 fix: python-client verify ssl 2022-06-12 03:42:44 +02:00
Ruben Fiszel 193a26cfad feat: alpha hub integration + frontend user store fixes + script client base_url fix 2022-06-12 01:55:05 +02:00
Ruben Fiszel 2e132878e4 first commit 2022-05-05 04:25:58 +02:00