Skip to main content

olca-schema

This is a package for reading and writing data sets in the openLCA schema format version 2. It provides a typed class model of the schema elements, methods for reading and writing them in the JSON format, reading and writing data sets in zip packages, and some utility methods.

Usage

The package is published on PyPI and can be installed with pip:

pip install olca-schema

Here is a small example that creates a package that can be imported into openLCA 2:

import olca_schema as o
import olca_schema.zipio as zipio

# create a unit group and flow property
units = o.new_unit_group('Units of mass', 'kg')
kg = units.units[0]
mass = o.new_flow_property('Mass', units)

# create a product flow and a process with the product as output
steel = o.new_product('Steel', mass)
process = o.new_process('Steel production')
output = o.new_output(process, steel, 1, kg)
output.is_quantitative_reference = True

# prints the Json string of the process
print(process.to_json())

# write a zip package with the data sets
with zipio.ZipWriter('path/to/example.zip') as w:
    for entity in [units, mass, steel, process]:
        w.write(entity)

Tests and packaging

The Python library for the openLCA schema is part of the olca-schema project. It does not have any runtime dependencies. The optional test and packaging extras are used for local development tasks.

Run the tests with:

cd olca-schema/py
# easy with uv; initialize the virtual environment
uv venv [-p 3.12]
# install the test dependencies
uv sync --extra test
# run the tests
uv run pytest -v

Build and validate a release package with:

# install the packaging dependencies
uv sync --extra packaging
# build the source and wheel distributions
uv run python -m build
# validate the generated artifacts
uv run twine check dist/*

Release files for olca-schema 2.6.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for olca-schema 2.6.2
File Size Uploaded
olca_schema-2.6.2.tar.gz 34.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for olca-schema 2.6.2
File Interpreter ABI Platform
olca_schema-2.6.2-py3-none-any.whl Python 3 none any Details

Total release size: 63.8 kB

Release files / olca_schema-2.6.2.tar.gz

Download URL olca_schema-2.6.2.tar.gz
Size 34.3 kB
Tags Source
SHA-256 checksum
How to use checksums
899b29e3658aff8907b3c649fa0e27771b659613a50ce89c7c9672971b15c29f
BLAKE2b-256 checksum
How to use checksums
b5f3a0c0ff2ee54aecd68e56de9bd2b681c7ce2323056d9cd1f551b8e5b215c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / olca_schema-2.6.2-py3-none-any.whl

Download URL olca_schema-2.6.2-py3-none-any.whl
Size 29.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6bdc1de25ba09d893d2f730c9f876cd6489270e713900ccda7d4b9d869c9ef81
BLAKE2b-256 checksum
How to use checksums
7c80eec9837bc0124d94310ddc659fb8793be3a015adfa0053cfb8c4b02cae09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

2.6.2 This release

2 release files

2.4.0

2 release files

2.2.2

2 release files

2.2.1

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page