v.0.15
2023.02.07
Last updated
2023.02.07
Last updated
This version has been deprecated. If used with the current API version it can produce unexpected behaviour or errors.
The package shimoku-api-python is no longer maintained
To get the new version
Introducing verbosity and async execution, this latest version has been designed to enhance the developer experience by providing greater visibility into what's happening, and significantly reducing the time of execution of dashboards by a factor of 10!
An issue with method visibility from the modules has been solved, now when your IDE of choice inspects each module of the SDK it will only show the methods available to you.
Pagination has been implemented for low level queries, which means that there is now no limit on the number of apps or reports that can be retrieved at one time using the SDK.
The tabs update function has more options! Now tabs can stick to the top of the screen when scrolling by setting the parameter sticky
to True
. They also have two variants, one where they are enclosed:
and one where they are separated:
By default they will be shown in the former. To activate the second visualization the parametter just_labels
has to be set to True
.
The following code exemplifies the use of the new tabs features:
The result is:
We have made the following charts more capable! :
Now these charts will aggregate duplicate data if there is, and they use a custom function, that has to be passed as an argument, where the user can define how the aggregation will happen.
The parameters name is aggregation_func, it expects one of the following:
A single aggregation function (e.g. np.mean
, np.sum
)
A list of aggregation functions
A dictionary mapping a column name to an aggregation function or a list of aggregation functions.
If only one function is defined, it will be applied to all columns. If a list is provided, all functions will be applied to all columns. If a dictionary is passed, each column will be aggregated by the function or functions defined for it.
Using this data:
If you pass aggregation_func=[np.mean, np.sum, np.amax, np.count_nonzero, np.amin]
in the following code:
The result is:
If instead we execute with a dictionary:
The resulting plots are:
If duplicate data is found, the SDK will notify you and you will need to provide an aggregation function as there is no default aggregation function.
Now the charts with the option to add a filter have been upgraded so that they can show the acumulation of all filters! This is useful to contrast wether a filtering field has a bigger effect than another or if you want to visualize he whole data. To trigger it you just need to add 'get_all' to the filters dictionary.
In the next example we can see that the aggregation_function will be used for the repeated data after grouping by a filtering field:
the result from executing the example is:
If the value of 'get_all' is a list of the column names, instead of True, then only the specified columns will have the option of aggregating all values, as shown in the following example:
The example's result is:
There is now the option to monitor the SDK flow of execution, with three levels of verbosity. This will help to know where the error occurred, so it will make bugfixing a lot easier, It also outputs how much time the function call has taken to quickly profile code. To enable it you just have to set the parameter verbosity from the client to 'INFO' or 'DEBUG'.
The 'INFO' keyword will be the most useful for visualizing the execution while 'DEBUG' is made so it outputs as much information as possible. You can also set it to 'WARNING' but this is the default behaviour and will have no effect, it will output only warnings and errors.
The logging level of the Shimoku SDK can be configured dynamically during execution by calling the configure_logging
function with the desired verbosity
level (either 'DEBUG', 'INFO', or 'WARNING') and an optional channel
to write the log output to. This allows for fine-grained control over the logging behavior and output, making it easier to debug and profile the SDK's execution.
This version of the SDK comes with a major productivity boost! Asynchronous execution is now supported, which means that code execution doesn't need to stop for requests, freeing up time to make more requests. To enable it, simply set the async_execution
parameter to True
when creating the client object:
By default, execution is set to sequential. You can toggle between sequential and asynchronous execution using the following functions:
When asynchronous execution is enabled, tasks are added to a task pool and executed once a strictly sequential task is reached. A function has been added to allow users to trigger the execution of tasks, which is s.run()
.
Be sure to call s.run()
at the end of your code to ensure all tasks are executed before the program terminates.