Published in


StarThinker 2.0 Is Here

The new 2.0 version of StarThinker has done away with the singleton pattern. Every task and function now takes a configuration and parameter object. The configuration contains authentication information while the parameters contain task specific values.

Note the Configuration Class is the main replacement for the prior singleton and is now a parameter to each function. The credentials along with the flag ‘user’ or ‘service’ are resolved at the moment the API call is made, retaining the ability to switch between the two for different end points.

import json# import StarThinker functions
from starthinker.util.configuration import Configuration
from starthinker.util.sheets import sheets_create
from starthinker.util.google_api import API_DBM

# initialize credentials ( replaces project singleton )
config = Configuration(user='[USER CREDENTIALS JSON OR PATH]')

# create a sheet ( note the new config parameter )
sheets_create(config, 'user', 'Test Sheet', 'Test Tab')

# list all your reports in DV360
for report in API_DBM(
print(json.dumps(report, indent=2, sort_keys=True))

One benefit is that multiple instances using different credentials can now be safely instantiated in parallel within the same process. Another benefit is that each task can now be used as a function, simply pass the JSON parameters in.

The update does not affect the JSON recipes, UI, Dags, or Colabs, it was mainly an architectural change contained within the python libraries and tasks. All tutorials and examples on GitHub have been updated. The prior 1.0.11 version has been packaged as a release. It is OK to install version 2.0 over a running instance of 1.0.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store