Skip to content

feat: using UDS Lib to talk to DS services #76

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions libs/unity-py/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.10.0] - 2025-03-31

### Added

### Fixed

### Changed
* feat: using UDS Lib to talk to DS services [#76](https://github.com/unity-sds/unity-monorepo/pull/76)

### Removed

### Security

### Deprecated

## [0.9.0] - 2025-02-19

### Added
Expand Down
1,390 changes: 760 additions & 630 deletions libs/unity-py/poetry.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions libs/unity-py/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "unity-sds-client"
version = "0.9.0"
version = "0.10.0"

description = "Unity-Py is a Python client to simplify interactions with NASA's Unity Platform."
authors = ["Anil Natha, Mike Gangl"]
Expand All @@ -19,14 +19,14 @@ enable = true
[tool.poetry-monorepo.deps]

[tool.poetry.dependencies]
python = "^3.8"
python = "^3.9"
requests = "^2.28.0"
tenacity = "^8.0.1"
giturlparse = "^0.10.0"
pystac = "^1.7.3"
unity-sps-ogc-processes-api-python-client ="^2.0.1"
unity-sds-apgs-client = {path = "../app-package-build-client", develop = true}
jsonschema = "^4.22.0"
mdps-ds-lib="1.1.1.dev500"


[tool.poetry.dev-dependencies]
Expand Down
Empty file.
Empty file.
95 changes: 95 additions & 0 deletions libs/unity-py/tests/unity_sds_client/services/test_data_service.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import base64

from dotenv import load_dotenv
import os
from unittest import TestCase

from unity_sds_client.services.data_service import DataService
from unity_sds_client.unity import _read_config
from unity_sds_client.unity_environments import UnityEnvironments
from unity_sds_client.unity_session import UnitySession
from unity_sds_client.resources.collection import Collection as UnityCollection


class TestDataService(TestCase):

def setUp(self) -> None:
super().setUp()
load_dotenv()
os.environ['UNITY_USER'] = base64.standard_b64decode(os.environ.get('USERNAME').encode()).decode()
os.environ['UNITY_PASSWORD'] = base64.standard_b64decode(os.environ.get('PASSWORD').encode()).decode()

def test_01(self):
config = _read_config([os.path.join('..', '..', '..', 'unity_sds_client', 'envs', 'environments.cfg')])
session = UnitySession(UnityEnvironments.DEV.value, config)
client = DataService(session=session, endpoint=session.get_unity_href())
result = client.get_collections(1)
print(result)
result = client.get_collections(1, True)
print(result)
return

def test_02(self):
config = _read_config([os.path.join('..', '..', '..', 'unity_sds_client', 'envs', 'environments.cfg')])
session = UnitySession(UnityEnvironments.DEV.value, config)
client = DataService(session=session, endpoint=session.get_unity_href())
result = client.get_collection_data(UnityCollection('urn:nasa:unity:uds_local_test:DEV1:CHRP_16_DAY_REBIN___9'), 1)
print(result)
result = client.get_collection_data(UnityCollection('urn:nasa:unity:uds_local_test:DEV1:CHRP_16_DAY_REBIN___9'), 3, output_stac=True)
print(result)
return

def test_03(self):
config = _read_config([os.path.join('..', '..', '..', 'unity_sds_client', 'envs', 'environments.cfg')])
session = UnitySession(UnityEnvironments.DEV.value, config)
client = DataService(session=session, endpoint=session.get_unity_href())
result = client.get_collection_data(UnityCollection('urn:nasa:unity:uds_local_test:DEV1:CHRP_16_DAY_REBIN___9'), 1, filter="status = 'completed'", output_stac=True)
print(result)
return

def test_04(self):
config = _read_config([os.path.join('..', '..', '..', 'unity_sds_client', 'envs', 'environments.cfg')])
session = UnitySession(UnityEnvironments.DEV.value, config)
client = DataService(session=session, endpoint=session.get_unity_href())
client.urn = 'urn'
client.org = 'nasa'
client.project = 'unity'
client.tenant = 'uds_local_test'
client.tenant_venue = 'DEV1'
client.collection = 'CHRP_16_DAY_REBIN'
client.collection_venue = '9'
result = client.query_custom_properties()
print(result)
return

def test_05(self):
config = _read_config([os.path.join('..', '..', '..', 'unity_sds_client', 'envs', 'environments.cfg')])
session = UnitySession(UnityEnvironments.DEV.value, config)
client = DataService(session=session, endpoint=session.get_unity_href())
client.urn = 'urn'
client.org = 'nasa'
client.project = 'unity'
client.tenant = 'uds_local_test'
client.tenant_venue = 'DEV1'
client.define_custom_metadata({
'tag': {'type': 'keyword'},
'c_version': {'type': 'float'},
'c_type': {'type': 'keyword'},
})
return

def test_06(self):
config = _read_config([os.path.join('..', '..', '..', 'unity_sds_client', 'envs', 'environments.cfg')])
session = UnitySession(UnityEnvironments.DEV.value, config)
client = DataService(session=session, endpoint=session.get_unity_href())
result = client.create_collection(UnityCollection('urn:nasa:unity:uds_local_test:DEV1:WILLIAM_UNIT_TEST___2'), True)
print(result)
return

def test_07(self):
config = _read_config([os.path.join('..', '..', '..', 'unity_sds_client', 'envs', 'environments.cfg')])
session = UnitySession(UnityEnvironments.DEV.value, config)
client = DataService(session=session, endpoint=session.get_unity_href())
result = client.delete_collection_item(UnityCollection('urn:nasa:unity:unity:dev:nga-unity-dev-output___3'), 'urn:nasa:unity:unity:dev:nga-unity-dev-output___3:output_1')
print(result)
return
Loading
Loading