Skip to content

Commit

Permalink
Merge branch 'master' into importskip
Browse files Browse the repository at this point in the history
  • Loading branch information
jesper-friis authored Dec 14, 2024
2 parents 3a0e299 + 9890759 commit 225b9e7
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 106 deletions.
34 changes: 5 additions & 29 deletions .github/workflows/cd_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,55 +80,31 @@ jobs:
- os: ubuntu-20.04
system_type: ["manylinux", "_2_34"]
arch: x86_64
py_minors: 8,9,10,11,12
#- os: ubuntu-20.04
# system_type: ["manylinux", "2014"]
# arch: x86_64
# py_minors: 8,9,10,11,12
#- os: ubuntu-20.04
# system_type: ["manylinux", "2010"]
# arch: x86_64
# py_minors: 8,9
#- os: ubuntu-20.04
# system_type: ["manylinux", "_2_28"]
# arch: x86_64
# py_minors: 8,9,10,11,12
py_minors: 8,9,10,11,12,13

# 64-bit musllinux
- os: ubuntu-20.04
system_type: ["musllinux", "_1_2"]
arch: x86_64
py_minors: 8,9,10,11
#- os: ubuntu-20.04
# system_type: ["musllinux", "_1_1"]
# arch: x86_64
# py_minors: 8,9,10,11
py_minors: 8,9,10,11,12,13

# 32-bit manylinux
- os: ubuntu-20.04
system_type: ["manylinux", "2014"]
arch: i686
py_minors: 10,11
#- os: ubuntu-20.04
# system_type: ["manylinux", "2014"]
# arch: i686
# py_minors: 8,9,10,11
#- os: ubuntu-20.04
# system_type: ["manylinux", "2010"]
# arch: i686
# py_minors: 8,9
py_minors: 10,11,12,13

# 32-bit musllinux
- os: ubuntu-20.04
system_type: ["musllinux", "_1_2"]
arch: i686
py_minors: 8,9,10,11
py_minors: 9,10,11

# 64-bit Windows
- os: windows-2019
system_type: ["win", ""]
arch: amd64
py_minors: '8,9,10,11,12'
py_minors: '8,9,10,11,12,13'

# 32-bit Windows

Expand Down
45 changes: 9 additions & 36 deletions .github/workflows/ci_build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,68 +22,41 @@ jobs:
- os: ubuntu-20.04
system_type: ["manylinux", "_2_34"]
arch: x86_64
py_minors: 8,12
#- os: ubuntu-20.04
# system_type: ["manylinux", "_2_28"]
# arch: x86_64
# py_minors: 8,12
#- os: ubuntu-20.04
# system_type: ["manylinux", "2014"]
# arch: x86_64
# py_minors: 8,12
#- os: ubuntu-20.04
# system_type: ["manylinux", "2010"]
# arch: x86_64
# py_minors: 8,9
py_minors: 8,13

# 64-bit musllinux
- os: ubuntu-20.04
system_type: ["musllinux", "_1_2"]
arch: x86_64
py_minors: 8,11
# Python 3.12 fails since cibuildwheel still depends on distutils
# for musllinux
#- os: ubuntu-20.04
# system_type: ["musllinux", "_1_1"]
# arch: x86_64
# py_minors: 8,11
py_minors: 8,13

# 32-bit manylinux
# Python 3.8 does not have numpy2
- os: ubuntu-20.04
system_type: ["manylinux", "2014"]
arch: i686
py_minors: 10,12
# Python 3.12 fails since cibuildwheel still depends on distutils
# for musllinux
#- os: ubuntu-20.04
# system_type: ["manylinux", "2010"]
# arch: i686
# py_minors: 8,9
py_minors: 10,13

# 32-bit musllinux
# Python 3.8 does not have numpy2
# Python 3.12 fails since cibuildwheel still depends on distutils
- os: ubuntu-20.04
system_type: ["musllinux", "_1_2"]
arch: i686
py_minors: 8,11
# Python 3.12 fails since cibuildwheel still depends on distutils
# for musllinux
#- os: ubuntu-20.04
# system_type: ["musllinux", "_1_1"]
# arch: i686
# py_minors: 8,11
py_minors: 9,11

# 64-bit Windows
- os: windows-2019
system_type: ["win", ""]
arch: amd64
py_minors: 8,12
py_minors: 8,13

# 32-bit Windows
# See issue #220: https://github.com/SINTEF/dlite/issues/220
# - os: windows-2019
# system_type: ["win32", ""]
# arch: ""
# py_minors: 7,10
# py_minors: 8,13

# 64-bit (Intel) macOS
# See issue #221: https://github.com/SINTEF/dlite/issues/221
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
cmake_minimum_required(VERSION 3.14)

project(dlite
VERSION 0.5.24
VERSION 0.5.26
DESCRIPTION "Lightweight data-centric framework for semantic interoperability"
HOMEPAGE_URL "https://github.com/SINTEF/dlite"
LANGUAGES C
Expand Down
27 changes: 18 additions & 9 deletions bindings/python/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

# XXX TODO - Make a local cache of EMMO such that we only download it once
TS_EMMO = Triplestore("rdflib")
TS_EMMO.parse("https://w3id.org/emmo/1.0.0-rc1")
TS_EMMO.parse("https://w3id.org/emmo/1.0.0-rc3")

EMMO_VERSIONIRI = TS_EMMO.value("https://w3id.org/emmo", OWL.versionIRI)

Expand All @@ -38,6 +38,15 @@
triplestore=TS_EMMO,
)

# XXX TODO: Switch to EMMO.hasDimension when this relation is in EMMO.
# Please don't change the IRI when adding it.
#Dimension = EMMO.Dimension
Dimension = "https://w3id.org/emmo#EMMO_b4c97fa0_d82c_406a_bda7_597d6e190654"
#hasDimension = EMMO.hasDimension
hasDimension = "https://w3id.org/emmo#EMMO_0a9ae0cb_526d_4377_9a11_63d1ce5b3499"
#hasScalarData = EMMO.hasScalarData
hasScalarData = "https://w3id.org/emmo#EMMO_e5a34647_a955_40bc_8d81_9b784f0ac527"

EMMO_TYPES = {
"blob": "BinaryData",
"bool": "BooleanData",
Expand Down Expand Up @@ -133,7 +142,7 @@ def get_shape(ts, dimiri, dimensions=None, mappings=None, uri=None):
label = str(obj)
elif pred == EMMO.elucidation:
descr = str(obj)
elif pred == RDF.type and obj not in (EMMO.Dimension,):
elif pred == RDF.type and obj not in (Dimension,):
mapsto.append(obj)
if not label:
raise KBError("dimension has no prefLabel:", dimiri)
Expand All @@ -160,7 +169,7 @@ def get_unit_symbol(iri):
symbol = TS_EMMO.value(iri, EMMO.unitSymbol)
if symbol:
return str(symbol)
for r in TS_EMMO.restrictions(iri, EMMO.hasSymbolValue, type="value"):
for r in TS_EMMO.restrictions(iri, EMMO.unitSymbolValue, type="value"):
symbol = r["value"]
if symbol:
return str(symbol)
Expand Down Expand Up @@ -189,7 +198,7 @@ def get_unit_iri(unit):
for r, _, o in ts.triples(predicate=OWL.hasValue):
if (
ts.has(r, RDF.type, OWL.Restriction) and
ts.has(r, OWL.onProperty, EMMO.hasSymbolValue)
ts.has(r, OWL.onProperty, EMMO.unitSymbolValue)
):
s = ts.value(predicate=RDFS.subClassOf, object=r)
unit_cache[o.value] = s
Expand Down Expand Up @@ -289,7 +298,7 @@ def addmap(uri, iri):
triples.extend([
(prop_iri, RDFS.subClassOf, restriction_iri),
(restriction_iri, RDF.type, OWL.Restriction),
(restriction_iri, OWL.onProperty, EMMO.hasScalarData),
(restriction_iri, OWL.onProperty, hasScalarData),
(restriction_iri, OWL.someValuesFrom, EMMO[emmotype]),
])
else:
Expand All @@ -304,13 +313,13 @@ def addmap(uri, iri):
(prop_iri, RDFS.subClassOf, EMMO.Array),
(prop_iri, RDFS.subClassOf, restriction_iri),
(restriction_iri, RDF.type, OWL.Restriction),
(restriction_iri, OWL.onProperty, EMMO.hasDimension),
(restriction_iri, OWL.onProperty, hasDimension),
])
for i, dim in enumerate(prop.shape):
dim_iri = f"{iri}#{prop.name}_dimension{i}"
addmap(f"{meta.uri}#{dim}", dim_iri)
triples.extend([
(dim_iri, RDF.type, EMMO.Dimension),
(dim_iri, RDF.type, Dimension),
(dim_iri, EMMO.hasSymbolValue,
Literal(dim, datatype=XSD.string)),
(dim_iri, EMMO.elucidation, en(dim_descr[dim])),
Expand Down Expand Up @@ -448,9 +457,9 @@ def get_dataset(
someval = po.get(OWL.someValuesFrom)
if onprop == EMMO.hasMeasurementUnit:
unit = get_unit_symbol(oncls)
elif onprop == EMMO.hasScalarData:
elif onprop == hasScalarData:
emmotype = emmotypes[someval]
elif onprop == EMMO.hasDimension:
elif onprop == hasDimension:
shape = get_shape(
ts, onval, dimensions, mappings, uri
)
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/dlite-entity-python.i
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def get_instance(
if "meta" not in d or d["meta"] == dlite.ENTITY_SCHEMA:
if "dimensions" not in d:
d["dimensions"] = {}
inst = Instance.from_dict(d)
inst = Instance.from_dict(d)

if inst is None:
raise _dlite.DLiteMissingInstanceError(f"no such instance: {id}")
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/tests/test_dataset1_save.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
(FLUID.LJPotential, EMMO.isDescriptionFor, EMMO.MolecularEntity),
(FLUID.TemperatureField, MAP.mapsTo, EMMO.ThermodynamicTemperature),
(FLUID.ntimes, MAP.mapsTo, EMMO.Time),
(FLUID.npositions, MAP.mapsTo, EMMO.Position),
(FLUID.npositions, MAP.mapsTo, EMMO.PositionVector),
]
#add_dataset(ts, chem.meta, base_iri=base_iri)
add_dataset(ts, Fluid, iri=EX.FluidData, mappings=mappings)
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/tests/test_dataset2_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
(FLUID.LJPotential, EMMO.isDescriptionFor, EMMO.MolecularEntity),
(FLUID.TemperatureField, MAP.mapsTo, EMMO.ThermodynamicTemperature),
(FLUID.ntimes, MAP.mapsTo, EMMO.Time),
(FLUID.npositions, MAP.mapsTo, EMMO.Position),
(FLUID.npositions, MAP.mapsTo, EMMO.PositionVector),
}


Expand Down
15 changes: 7 additions & 8 deletions doc/getting_started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,13 @@ DLite uses [cibuildwheel] for providing binary releases for Linux and
Windows on various platforms and versions of Python. The provided
wheels are shown in the following table.


| Platform | Arch | 3.8 | 3.9 | 3.10 | 3.11 | 3.12 |
|------------------|--------|-----|-----|------|------|------|
| [manylinux_2_34] | x86_64 | x | x | x | x | x |
| [manylinux2014] | i686 | | | x | x | x |
| [musllinux_1_2] | x86_64 | x | x | x | x | x |
| [musllinux_1_2] | i686 | | x | x | x | |
| windows | x86_64 | x | x | x | x | x |
| Platform | Arch | 3.8 | 3.9 | 3.10 | 3.11 | 3.12 | 3.13 |
|------------------|--------|-----|-----|------|------|------|------|
| [manylinux_2_34] | x86_64 | x | x | x | x | x | x |
| [manylinux2014] | i686 | | | x | x | x | x |
| [musllinux_1_2] | x86_64 | x | x | x | x | x | x |
| [musllinux_1_2] | i686 | | x | x | x | | |
| windows | x86_64 | x | x | x | x | x | x |


Development installation
Expand Down
22 changes: 5 additions & 17 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
[build-system]
requires = [
"setuptools>=58",
"wheel>=0.37",
"numpy>=1.14.5,<2.1.3",
"swig==4.3.0",
"cmake==3.31.1",
"swig==4.1.1",
#"setuptools==57.5.0; python_version<'3.9'",
#"setuptools==75.3.0; python_version>='3.9'",
"setuptools==75.3.0",
"wheel==0.41.3",
]


#requires = [
# #"setuptools>=58; python_version<'3.12'",
# #"wheel>=0.37; python_version<'3.12'",
# "setuptools==67.6.1; python_version<'3.9'",
# "setuptools>=68.2.1; python_version>='3.9'",
# "wheel>=0.37",
# "numpy>=1.14.5,<2.1.3",
# "cmake==3.31.1",
# "swig==4.1.1",
#]
build-backend = "setuptools.build_meta"

[tool.cibuildwheel]
Expand All @@ -31,12 +21,10 @@ test-command = "python {package}\\..\\bindings\\python\\tests\\test_python_bindi
[tool.cibuildwheel.linux]
environment-pass = ["CI_BUILD_CMAKE_ARGS", "CI_PIP_CACHE_DIR"]
before-build = [
#"python -m pip install --cache-dir /ci/pip_cache --prefer-binary -r {project}/requirements.txt -r {project}/requirements_dev.txt",
"rm -rf {project}/python/build/temp*",
"export PYVER=$(python -c \"import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')\")",
"export ABITAG=$(python -c \"import sys; cp=f'cp{sys.version_info.major}{sys.version_info.minor}'; print(f'{cp}-{cp}{sys.abiflags}')\")",
]
before-test = "python -m pip install --cache-dir /ci/pip_cache --prefer-binary -r {project}/requirements.txt"
test-command = "python {package}/../bindings/python/tests/test_python_bindings.py"

[tool.cibuildwheel.linux.environment]
Expand Down
1 change: 1 addition & 0 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ def run(self):
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Software Development :: Libraries :: Python Modules",
],
build_requires=requirements_dev,
Expand Down
8 changes: 5 additions & 3 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Requirements building
swig==4.3.0
cmake==3.31.1
setuptools==67.6.1; python_version<"3.9"
setuptools>=68.2.1; python_version>="3.9"
#setuptools==67.5.0; python_version<"3.9"
#setuptools==75.3.0; python_version>="3.9"
setuptools==75.3.0
wheel==0.41.3

# Requirements for running tests
mongomock>=4.1.2,<5
mongomock==4.2.0.post1

0 comments on commit 225b9e7

Please sign in to comment.