Skip to main content

A package to interface with OSDU microservices

Project description

OSDU Python SDK

Contents

Introduction

The Python SDK is a package to interface with OSDU microservices.

Interactions with OSDU services are cloud platform-agnostic by design. However, there are specific implementation requirements by cloud platforms, and the OSDU R3 Prototype provides a dedicated Python SDK to make sure that interactions are independent from the cloud platforms.

The Python SDK must be installed on the machine that uses OSDU services.

In OSDU R3 Prototype, the SDK encapsulates calls to the ODES Storage and Search services.

Also, in osdu_api.providers folder the SDK provides common interfaces for writing cloud-specific implementations for authorization and accessing cloud storages. In this osdu_api.providers folder CSP code is stored.

Getting Started

Installation from source

  1. Pull the latest Python SDK's changes from https://community.opengroup.org/osdu/platform/system/sdks/common-python-sdk

  2. Use Python 3.13. Also, it is highly recommended using an isolated virtual environment for development purposes (Creation of virtual environments: https://docs.python.org/3.11/library/venv.html)

  3. Make sure you have setuptools and wheel installed

pip install --upgrade setuptools wheel
  1. Change directory to the root of PythonSDK project
cd path/to/python-sdk
  1. Make sure osdu-api isn't already installed
pip uninstall osdu-api
  1. Install Python SDK
pip install '.[common]'

Example import after installing: from osdu_api.clients.storage.record_client import RecordClient

Installation from Package Registry

pip install 'osdu-api' --extra-index-url=https://community.opengroup.org/api/v4/projects/148/packages/pypi/simple

Impersonation

If client objects are initialized with client_id argument then either x-on-behalf-of or on-behalf-of headers are set. The former header is used by default. The latter is used when the ENTITLEMENTS_IMPERSONATION environment variable is "True" or "true"

Testing

Running E2E Tests

Specify of end-services URLs into tests/osdu_api.yaml and run

pip install '.[dev, common]'
pytest

Running CSP tests

export CLOUD_PROVIDER=<cloud_provider>
pip install '.[dev, common]'
pytest

For Google Cloud, you can select the type of token to use: ID token or Access token.

You can configure this via the GC_ID_TOKEN environment variable. Here's how to set it:

  • for enabling ID token: 'y', 'yes', 'on', 'true' (case-insensitive)
  • for using Access token: any other value, or don't set the variable at all

Release Notes

0.29

Updated project structure and added support for Python 3.13. Dual publishing to PyPi and OpenGroup package registry.

0.28

From this release verification of SSL certificates is enabled by default. If your environment is using self-signed certificates or a private CA this can be disabled by setting the environment variable OSDU_API_DISABLE_SSL_VERIFICAITON to iknowthemaninthemiddle.

0.17

Starting from this release each particular client class has 2 more optional parameters: provider and the corresponding client service URL. This was done in order to make using osdu_api.ini file optional. If you are not using named arguments in initializing your clients it can break your code since the order of parameters was changed.

Licence

Copyright © Amazon Web Services Copyright © Google LLC Copyright © EPAM Systems

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. A package to interface with OSDU microservices

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

osdu_api-1.1.0.tar.gz (63.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

osdu_api-1.1.0-py3-none-any.whl (165.8 kB view details)

Uploaded Python 3

File details

Details for the file osdu_api-1.1.0.tar.gz.

File metadata

  • Download URL: osdu_api-1.1.0.tar.gz
  • Upload date:
  • Size: 63.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.6

File hashes

Hashes for osdu_api-1.1.0.tar.gz
Algorithm Hash digest
SHA256 a53b4b077c0a5a6695f0c6294a071396cc4452df166a85b90cf62dbfcd193f99
MD5 e37c81c363cb7e6f177b498286bf624b
BLAKE2b-256 f5ab1a3c3dbe764cf25de382844c82bed02ed28493a9504ba8e66acb5992df61

See more details on using hashes here.

File details

Details for the file osdu_api-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: osdu_api-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 165.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.6

File hashes

Hashes for osdu_api-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 71de081f996f15c3267b7dbc3c44fadb6baa0facb7b24141879d36b60788842b
MD5 b9cd70a29e39cd5bc4530c553fd3cdaf
BLAKE2b-256 7b4b95ce23ac564beb4e703cc089464d14ee0722f8326993eb2994655b1c95ec

See more details on using hashes here.

Supported by

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