Minimal APP example

Because an Implementation is Worth a Thousand Words

Code Example

Once the Installation & Setup process has been done, everything should be ready to get hands on. Here is a usage example to showcase some of the capabilities of the platform.

In the following implementation, various features will be used with the aim of portraying the basic functionalities that the platform can offer. For more powerfull features and insightfull explanations, check the Extended Example or the rest of the specific documentation!


In the following code, a bar diagram display is used to portray the performance of different programming languages in terms of expresiveness. To explore the different diagrams and analytics displays, check the Charts section.

# Explained in the previous page
from shimoku import Client
s = Client(
    async_execution=True, 
    verbosity='INFO',      
)

# Necessary for compatibility with cloud execution
s.set_workspace() 

# Set the group of the menu
s.set_board('Custom Board')

# Set the menu path 'catalog' with the sub-path 'bar-example'
s.set_menu_path('catalog', 'bar-example')

language_expressiveness = [
    {'Language': 'C', 'Statements ratio': 1.0, 'Lines ratio': 1.0},
    {'Language': 'C++', 'Statements ratio': 2.5, 'Lines ratio': 1.0},
    {'Language': 'Fortran', 'Statements ratio': 2.0, 'Lines ratio': 0.8},
    {'Language': 'Java', 'Statements ratio': 2.5, 'Lines ratio': 1.5},
    {'Language': 'Perl', 'Statements ratio': 6.0, 'Lines ratio': 6.0},
    {'Language': 'Smalltalk', 'Statements ratio': 6.0, 'Lines ratio': 6.25},
    {'Language': 'Python', 'Statements ratio': 6.0, 'Lines ratio': 6.5},
]

s.plt.bar(
    order=0, title='Language expressiveness',
    data=language_expressiveness, x='Language',
    y=['Statements ratio', 'Lines ratio'],
)

# Necessary for notifying the front-end even if not using async execution
s.run()

When changes are made locally using the s.run() command, the SDK provides immediate feedback to the front end. This live update system ensures developers can see the impact of their changes in real time

Deployment in Cloud

The deployment with the Shimoku platform is very straightforward, just set your credentials in the client initialization and execute the same code you've been developing:

  • Set the values of the enviroment variables in a separate .env file as explained in Environment Variables

  • If you don't have these credentials, you will need to create an account on Shimoku.io, consult the Shimoku Cloud for further information.

  • It is advisable to make sure that the contents of the playground can be replicated by the code before deploying.

from shimoku import Client 

access_token: str = getenv('API_TOKEN')     # Environment variable
universe_id: str = getenv('UNIVERSE_ID')    # Environment variable
workspace_id: str = getenv('WORKSPACE_ID')  # Environment variable

s = Client(
    access_token=access_token,
    universe_id=universe_id,
    async_execution=True,
    verbosity='INFO'
)

s.set_workspace(workspace_id)

. . .

Last updated