Commit Graph

4 Commits

Author SHA1 Message Date
Stephan Fitzpatrick
528cca268b Feat(python): Quality of Life improvements to Python client (#2686)
* Fix references to `Windmill.start_script_async`

* Improve client usability and extend functionalities

This commit introduces several changes to improve the usability of the module and extend its functionalities. Line breaks have been added for long function calls to improve readability. A state setter has been added for the 'state' property to facilitate state updates. New functions 'cancel_running' and 'run_script' have been added to provide more control to the user over the script executions. The README file has been updated to reflect these changes and provide more comprehensive usage instructions including both basic and advanced usage of the module.

* Add line breaks and update README.md for readability

Inserted line breaks into function calls for improved readability in python-client/wmill/README.md. This enhances module usability by making code easier to follow. 'state' property setter, 'cancel_running' and 'run_script' functions have been added to enrich module's functionality. README was updated to reflect these changes and provide clearer instructions.
2023-11-23 08:39:38 +01:00
Stephan Fitzpatrick
38e6ea6702 Update method name in wmill README sample code (#2679)
In the README's example code for the wmill Python client, the method name `start_execution` has been changed to `run_script_async`. This change is in line with the recent updates we made to the client's public API. The naming adjustment adds more clarity to the method's functionality, and ensures that the sample code in the README is accurate and stays updated with the latest changes in the wmill Python client's API.
2023-11-22 17:16:07 +01:00
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
Ruben Fiszel
2e132878e4 first commit 2022-05-05 04:25:58 +02:00