Skip to main content

Python SDK for TIDAS/ILCD Life Cycle Assessment data

Project description

TIDAS Python SDK

中文文档

Type-safe Python SDK for working with ILCD/TIDAS life-cycle assessment (LCA) data. It provides generated Pydantic models plus higher-level helpers so you can read, manipulate, validate and export ILCD-compatible datasets from Python.

Installation

From PyPI

pip install tidas-sdk

From source (this repository)

cd sdks/python
uv sync --group dev

Quick Start

Run the end-to-end sample to see the core features in action:

uv run python examples/usage.py

Minimal usage example:

from tidas_sdk import create_process

process = create_process({})
process.process_data_set.process_information.data_set_information.name.base_name.set_text(
    "Sample Process", lang="en"
)

print(process.to_json())

Basic Usage

Creating entities

from tidas_sdk import create_process, create_flow, create_source

process = create_process({})
flow = create_flow({})
source = create_source({})

You can also build entities directly from ILCD‑style JSON:

from pathlib import Path
from tidas_sdk import create_process_from_json

process = create_process_from_json(Path("process.json"))

Or start from ILCD XML when you already have the canonical .xml datasets:

from pathlib import Path
from tidas_sdk import create_process_from_xml, TidasProcess

process = create_process_from_xml(Path("process.xml"))
# or, if you prefer to work with the class directly
process = TidasProcess.from_xml(Path("process.xml"))

Working with multilingual fields

name_list = process.process_data_set.process_information.data_set_information.name.base_name
name_list.set_text("Sample Process", lang="en")
name_list.set_text("示例工艺", lang="zh")
print(name_list.get_text("en"))

Validation and export

is_valid = process.validate()          # Pydantic (and optional JSON Schema) validation
json_payload = process.to_json()       # ILCD‑compatible dict
xml_payload = process.to_xml()         # ILCD XML string

Main Features

  • JSON ➜ Object: create_process() and other factory helpers build rich entity objects from complete or partial ILCD JSON.
  • Object ➜ JSON: to_json() returns ILCD-compatible dictionaries suitable for storage or downstream tooling.
  • Multilingual fields: MultiLangList with set_text() / get_text() simplifies @xml:lang / #text handling.
  • Strong typing: generated Pydantic models expose full type hints for IDE autocompletion and static checking.
  • On-demand validation: validate() runs Pydantic and optional JSON Schema validation when your dataset is ready.
  • XML export: to_xml() converts entities into ILCD XML for interoperability with other LCA systems.

See examples/usage.py for a step‑by‑step walkthrough of these features.

Development Workflow (for contributors)

# Install / update dependencies
uv sync --group dev

# Linting & formatting
uv run ruff check src
uv run ruff format src

# Type checking
uv run mypy src

# Tests
uv run pytest

Project Layout

  • src/tidas_sdk: Core implementation and generated models
  • examples/usage.py: Feature walkthrough used in this README
  • scripts/: Utility scripts for code generation and maintenance

For questions or contributions, open an issue or pull request at https://github.com/tiangong-lca/tidas-sdk.

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

tidas_sdk-0.2.0.tar.gz (393.0 kB view details)

Uploaded Source

Built Distribution

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

tidas_sdk-0.2.0-py3-none-any.whl (423.6 kB view details)

Uploaded Python 3

File details

Details for the file tidas_sdk-0.2.0.tar.gz.

File metadata

  • Download URL: tidas_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 393.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tidas_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 2948a407614857fcb06825fcbc5f1a5ece3b0afbcb875b112bc70a64a3a6414b
MD5 21d1ac93e7cef779c5d9ad8d0a72e00f
BLAKE2b-256 335b3d57be41d67a77a05e9dc5e8ccd6525d653ad3b3c89c9736a57685d7161a

See more details on using hashes here.

Provenance

The following attestation bundles were made for tidas_sdk-0.2.0.tar.gz:

Publisher: publish.yml on tiangong-lca/tidas-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tidas_sdk-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: tidas_sdk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 423.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tidas_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 67f0b8fff4c9d5871e69656c35f9e9b5f67575bd29e9746c06aeea4542f7727e
MD5 d77849187df137f9129e5d92b7546654
BLAKE2b-256 cda97701515703b884b77b07c69c9d4b6c0b7b4b455f9c2b4f0d8f33ff344224

See more details on using hashes here.

Provenance

The following attestation bundles were made for tidas_sdk-0.2.0-py3-none-any.whl:

Publisher: publish.yml on tiangong-lca/tidas-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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