Skip to main content

NIH SPARC Python Client

Project description

sparc.client

NIH SPARC Python Client PyPI Latest Release pypi Package Status License Coverage

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

  1. Define configuration variables in config.ini file (e.g api_key, api_secret etc.)
  2. Create a file in services/
  3. Create a class within this file that extends BaseService
  4. The class needs to define all the functions required + may add its own.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sparc.client-0.0.1.tar.gz (12.6 kB view hashes)

Uploaded Source

Built Distribution

sparc.client-0.0.1-py3-none-any.whl (16.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page