Skip to content

Commit cbdc688

Browse files
Update ontoenv (#120)
* poetry -> uv, fix dependencies for ontoenv * working on tests * ci: Migrate GitHub Actions workflow to uv Co-authored-by: aider (gemini/gemini-2.5-flash) <[email protected]> * fix install * nolock * fix python? * add pytest * extras, python versions --------- Co-authored-by: aider (gemini/gemini-2.5-flash) <[email protected]>
1 parent 6c12073 commit cbdc688

File tree

8 files changed

+17333
-12176
lines changed

8 files changed

+17333
-12176
lines changed

.github/workflows/builds.yml

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,40 +13,26 @@ jobs:
1313
runs-on: ubuntu-latest
1414
strategy:
1515
matrix:
16-
python-version: ["3.9", "3.10", "3.11"]
16+
python-version: ["3.10", "3.11", "3.12", "3.13"]
1717
steps:
1818
- uses: actions/checkout@v4
1919
- name: Set up Python ${{ matrix.python-version }}
2020
uses: actions/setup-python@v5
2121
with:
2222
python-version: ${{ matrix.python-version }}
23-
- name: Install Poetry
24-
uses: snok/install-poetry@v1
23+
- name: Install uv and set the python version
24+
uses: astral-sh/setup-uv@v6
2525
with:
26-
virtualenvs-create: true
27-
virtualenvs-in-project: true
28-
installer-parallel: true
26+
python-version: ${{ matrix.python-version }}
27+
# Enable caching for uv
28+
enable-cache: true
2929
- name: Set up Java
3030
uses: actions/setup-java@v4
3131
with:
3232
distribution: 'temurin'
3333
java-version: '17'
34-
- name: Load cached venv
35-
id: cached-poetry-dependencies
36-
uses: actions/cache@v4
37-
with:
38-
path: .venv
39-
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
40-
- name: Install dependencies for Python 3.11
41-
# we do *not* install the dedupe extra because its dependency on PyLBFGS requires an older version
42-
# of Cython that is not available in python 3.11
43-
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' && matrix.python-version == '3.11'
44-
run: poetry install --no-interaction --no-root -E allegro -E brickify -E web -E orm -E reasonable -E persistence -E bacnet -E networkx
4534
- name: Install all dependencies for other Python versions
46-
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' && matrix.python-version != '3.11'
47-
run: poetry install --no-interaction --no-root --all-extras
35+
run: uv sync --all-extras
4836
- name: Run tests
49-
run: |
50-
source .venv/bin/activate
51-
pytest -s -vvvv
37+
run: uv run pytest -s -vvvv
5238

brickschema/graph.py

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,7 @@ def validate(
127127
allow_warnings=True,
128128
)
129129
elif engine == "topquadrant":
130-
# check if 'java' is in the path
131-
import shutil
132-
133-
if shutil.which("java") is None:
134-
raise Exception(
135-
"TopQuadrant SHACL validation requires Java to be installed and in the PATH"
136-
)
137-
from brickschema.topquadrant_shacl import validate
138-
130+
from brick_tq_shacl.pyshacl import validate
139131
if shape_graphs is not None and isinstance(shape_graphs, list):
140132
for sg in shape_graphs:
141133
shapes += sg
@@ -263,21 +255,12 @@ def expand(
263255
return
264256
elif profile == "shacl":
265257
if backend == "topquadrant":
266-
# check if 'java' is in the path
267-
import shutil
268-
269-
if shutil.which("java") is None:
270-
raise Exception(
271-
"TopQuadrant SHACL validation requires Java to be installed and in the PATH"
272-
)
273-
from brickschema.topquadrant_shacl import infer
274-
258+
from brick_tq_shacl.pyshacl import infer
275259
# 'res' is a de-skolemized graph. We want to replace the contents
276260
# of this graph with the de-skolemized version because topquadrant requires
277261
# that skolemization is applied to the input graph in order to preserve
278262
# identity of inferred subject/objects
279263
res = infer(self, og or rdflib.Graph())
280-
self.remove((None, None, None))
281264
self += res
282265
return self
283266
valid, _, report = pyshacl.validate(

0 commit comments

Comments
 (0)