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.6.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| olca_schema-2.6.2.tar.gz | 34.3 kB | Without provenance | Details for olca_schema-2.6.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| olca_schema-2.6.2-py3-none-any.whl | Python 3 | none | any | Details for olca_schema-2.6.2-py3-none-any.whl |
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
|
Security for olca-schema 2.6.2
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.