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.2.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.2.0-py3-none-any.whl (165.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: osdu_api-1.2.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.2.0.tar.gz
Algorithm Hash digest
SHA256 5dde2b9e012dc66a7e4dfdc835c5c10ed9df402e7538e7421ae80a6d69c4e6dd
MD5 6cdecad0a6e1cb615ec3830832339b04
BLAKE2b-256 f8abe60af18317ca43cff26e5ffba2be213ddacb7a7f633c1967b590c9707b58

See more details on using hashes here.

File details

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

File metadata

  • Download URL: osdu_api-1.2.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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8528b4686b433e7659c8ad9dd179ada9a7e3a72f2ef6b72972eeb3d351728d6c
MD5 34963923b088396e6141b508802db3f3
BLAKE2b-256 f01b48ca4bfa73326fea50c6c945ed9a4a3f9886f56adef10733f4bbbd4cab65

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