NIH SPARC Python Client
Project description
sparc.client
Architecture details
The sparc.client Python Client stores its configuration in the config.ini file.
The modules of sparc.client are to be defined in services/ directory and need to be derived from BaseService class (services/_default.py) This means that they need to implement the specific functions defined in the interface, such as init, connect(), info(), get_profile(), set_profile() and close(). Apart from that functions, each module in the services may define their own methods (e.g. refer to services/pennsieve.py list_datasets()).
config.ini
The configuration file has the following format:
[global]
default_profile=ci
[prod]
pennsieve_profile_name=prod
[dev]
pennsieve_profile_name=test
[ci]
pennsieve_profile_name=ci
[global] section defines the default profile that is to be used. This basically refers to any section in brackets that stores configuration variables. In this case it refers to 'ci' section.
Within each section, different configuration variables could be defined. In our case, the only variable that needs to be defined is pennsieve_profile_name, which is passed to the Pennsieve2 library.
Module automatic import
Each python file in services/ folder with defined class name that is derived from BaseService is imported as a module to SparcClient class. For example, pennsieve.py file
from sparc.client import SparcClient
a = SparcClient(connect=False, config_file='config.ini')
module = a.pennsieve.connect()
module.user.whoami() #execute internal functions of the module
# alternatively connect all the services available
a.connect() #connect to all services
Contribution Guide
- Define configuration variables in config.ini file (e.g api_key, api_secret etc.)
- Create a file in services/
- Create a class within this file that extends BaseService
- The class needs to define all the functions required + may add its own.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for sparc.client-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d0c0c95b149da0ad781a824a3fc6601f3f1915ed6e905701ac4abc2c3bd6f60 |
|
MD5 | 6b2bb33e79b6ee73ff62d17d2bce10f0 |
|
BLAKE2b-256 | 2c2cc2087d0faceab6ff4f72f6248a090cd7ea6c1fcd5db5639c0138b5c90fed |