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/*

Metadata

Release files for olca-schema 2.7.0

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.7.0
File Size Uploaded Provenance Actions
olca_schema-2.7.0.tar.gz 34.6 kB Without provenance Details for olca_schema-2.7.0.tar.gz

Built distribution (wheel)

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

Total release size: 64.3 kB

Release files / olca_schema-2.7.0.tar.gz

Download URL olca_schema-2.7.0.tar.gz
Size 34.6 kB
Tags Source
SHA-256 checksum
How to use checksums
66c394cbc78b6441b407a7e2c1ed8fa6c15b7218d0b386bf0af4e934f1e32a48
BLAKE2b-256 checksum
How to use checksums
ed7d96a68793154a28f8359c902520f873f5d2660cc9ce8c83849920d7218722
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.7

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

Download URL olca_schema-2.7.0-py3-none-any.whl
Size 29.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
60d0488adff446ab8ec312a5b1a6a903298a88c38ae4a981559789460bbe9ad7
BLAKE2b-256 checksum
How to use checksums
65a57f7e5d8e350e396a29be75f0fbfeb37c465eda7a5c19bfc39468f2b5c6a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.7

Security for olca-schema 2.7.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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