Python tools for working with OIAnalytics
Project description
Installation
pip install oianalytics
Requirements: Python 3.9+, pandas 2.x, pydantic 2.x
Basic structure of the oianalytics package
The OIAnalytics SDK is mainly built around two modules: api, and models.
The api module is made for interacting with the OIAnalytics public API.
The models module is made for building and testing "custom models", which is custom Python script designed to be deployed on OIAnalytics.
API
The api module is mainly built with the following structure:
.
├── api # api module
│ ├── endpoints # Basic implementations of endpoints of the OIAnalytics public API
│ ├── utils # Some utilitaries
│ ├── _dataframes # This submodule contains pandas wrappers around enpoints. Its content is usually called through aliases (e.g. api.get_data_list() instead of api._dataframes.data.get_data_list())
│ ├── _crendentials # A few objects and functions required to authenticate to OIAnalytics. Usually called via aliases
Most basic usage consists in using functions from the _dataframes submodules via their aliases (e.g. api.get_data_list()).
These functions call the OIAnalytics endpoints and parse the results into pandas structures (usually dataframes), which make them convenient for data exploration and data processing.
Models
The models module is mainly built with the following structure:
.
├── models # models module
│ ├── templates # Templates for building custom code intended to be deployed on OIAnalytics
│ ├── utils # Some utilitaries
│ ├── testing # Tools for testing custom code intended to be deployed on OIAnalytics
│ ├── outputs # All the output objects that must be the outputs of custom code deployed on OIAnalytics, in order to make the application capable of gathering properly the results
This module is only used when developing a custom model, which is custom code intended to be deployed on OIAnalytics.
Basic usage
There are currently two main use cases for the oianalytics Python package:
- Interacting with the OIAnalytics public API:
This is done using the
apimodule, for data manipulation, or individual operations on OIAnalytics - Building custom models for OIAnalytics:
This is done using the
modelsmodule, and usually by interacting with the OIAnalytics public API for data retrieval, for deploying scripts onto OIAnalytics
The basic import for the package is the following:
from oianalytics import api, models
Interacting with the OIAnalytics public API
Credentials
When interacting externally with the OIAnalytics public API, the first step is to setup access credentials.
After having created an API access key inside OIAnalytics (see OIAnalytics documentation), these can be used in a Python code using:
from oianalytics import api
cred = api.OIAnalyticsAPICredentials( # (1)!
base_url="https://{{platform_name}}.oianalytics.com",
login="{{user_login}}",
pwd="{{user_password}}"
)
cred.set_as_default_credentials() # (2)!
- The content of the credentials must be adjusted in regard to your platform's url, and the access key attached to the user, created in OIAnalytics
- This method allows all further api calls to use these credentials without the need of specifying them (usually through the argument
api_credentials=)
Raw endpoint call
For a low level interaction, raw endpoints are implemented in the api.endpoints module.
These functions return the raw JSON as retrieved from the public API.
from oianalytics import api
data_list_json = api.endpoints.data.get_data_list()
The endpoints are spread among several submodules: assets, azure_blob_sources, batches, computation_jobs, dashboard, data, events, files, model_instances, profiles, quantities, tags, units, users
Pandas wrappers
In most cases, it is more convenient for data processing to use the wrappers implemented in api._dataframes.
These functions usually call the raw endpoint then parse the results into pandas structures (series or dataframes), with parsing alternatives (e.g. retrieve the id or the description of an object).
These functions are embedded in submodules as well, but are made accessible at a higher level (hence the fact that it is a private module).
For instance, instead of calling api._dataframes.data.get_data_list() it is recommended to use the following:
from oianalytics import api
data_list_df = api.get_data_list()
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file oianalytics-0.6.13b2.tar.gz.
File metadata
- Download URL: oianalytics-0.6.13b2.tar.gz
- Upload date:
- Size: 86.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf361dca0d89ffb807ec2528f4149d8e7576b41991a23d293f399254c1b07ff2
|
|
| MD5 |
8f2e4046c2043ce23c8b19e10a5110b5
|
|
| BLAKE2b-256 |
454361934ce55ca144d578b738355320627f836df2d6193ef5ddf76bb6cd5857
|
Provenance
The following attestation bundles were made for oianalytics-0.6.13b2.tar.gz:
Publisher:
publish.yml on OptimistikSAS/oianalytics-python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
oianalytics-0.6.13b2.tar.gz -
Subject digest:
bf361dca0d89ffb807ec2528f4149d8e7576b41991a23d293f399254c1b07ff2 - Sigstore transparency entry: 2047385797
- Sigstore integration time:
-
Permalink:
OptimistikSAS/oianalytics-python-sdk@bbfb4644f384daf56151a80f3df315ed48c3eb94 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/OptimistikSAS
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bbfb4644f384daf56151a80f3df315ed48c3eb94 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file oianalytics-0.6.13b2-py3-none-any.whl.
File metadata
- Download URL: oianalytics-0.6.13b2-py3-none-any.whl
- Upload date:
- Size: 119.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f030cbaf23f089ebe81d894dcb8c6922607cb3efeb4444e7451b2d42a1ba5d96
|
|
| MD5 |
f7cbeb35f6a7eecf1a8933eb89d39999
|
|
| BLAKE2b-256 |
5819109c6298a16fa22ca72ee9bae4417095cc5e719367b7fd12a49f13cf60a9
|
Provenance
The following attestation bundles were made for oianalytics-0.6.13b2-py3-none-any.whl:
Publisher:
publish.yml on OptimistikSAS/oianalytics-python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
oianalytics-0.6.13b2-py3-none-any.whl -
Subject digest:
f030cbaf23f089ebe81d894dcb8c6922607cb3efeb4444e7451b2d42a1ba5d96 - Sigstore transparency entry: 2047385871
- Sigstore integration time:
-
Permalink:
OptimistikSAS/oianalytics-python-sdk@bbfb4644f384daf56151a80f3df315ed48c3eb94 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/OptimistikSAS
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bbfb4644f384daf56151a80f3df315ed48c3eb94 -
Trigger Event:
workflow_dispatch
-
Statement type: