Skip to content

Commit 939775f

Browse files
authored
Merge pull request #146 from casework/release-0.5.1
Release 0.5.1
2 parents 33d9565 + c72a582 commit 939775f

File tree

16 files changed

+107
-35
lines changed

16 files changed

+107
-35
lines changed

.github/workflows/cicd.yml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,35 @@ name: Continuous Integration
1313

1414
on:
1515
push:
16-
branches: [ main, develop ]
16+
branches:
17+
- main
18+
- develop
19+
- support-*
1720
pull_request:
18-
branches: [ main, develop ]
21+
branches:
22+
- main
23+
- develop
24+
- support-*
25+
release:
26+
types:
27+
- published
1928

2029
jobs:
2130
build:
2231

2332
runs-on: ubuntu-latest
2433
strategy:
2534
matrix:
26-
python-version: [ '3.7', '3.10' ]
35+
python-version:
36+
- '3.8'
37+
- '3.10'
2738

2839
steps:
2940
- uses: actions/checkout@v2
30-
- uses: actions/setup-java@v2
41+
- uses: actions/setup-java@v3
3142
with:
32-
distribution: 'adopt'
33-
java-version: '8'
43+
distribution: 'temurin'
44+
java-version: '11'
3445
- name: Set up Python ${{ matrix.python-version }}
3546
uses: actions/setup-python@v2
3647
with:
@@ -43,7 +54,7 @@ jobs:
4354
run: make clean
4455
- name: Run tests
4556
run: make PYTHON3=python check
46-
57+
4758
# Build the binary wheel as well as the source tar
4859
- name: Build Objects
4960
run: |
@@ -65,5 +76,5 @@ jobs:
6576
# If this commit is the result of a Git tag, push the wheel and tar packages
6677
# to the PyPi registry
6778
- name: Publish to PyPI
68-
if: startsWith(github.ref, 'refs/tags')
79+
if: github.event_name == 'release' && github.event.action == 'published'
6980
run: twine upload --repository-url https://upload.pypi.org/legacy/ -u __token__ -p ${{ secrets.PYPI_API_TOKEN }} --skip-existing --verbose dist/*

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
repos:
22
- repo: https://github.com/psf/black
3-
rev: 22.3.0
3+
rev: 23.12.0
44
hooks:
55
- id: black

case_utils/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
#
1212
# We would appreciate acknowledgement if the software is used.
1313

14-
__version__ = "0.5.0"
14+
__version__ = "0.5.1"
1515

1616
from . import local_uuid

case_utils/case_file/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
DEFAULT_PREFIX = "http://example.org/kb/"
3434

35+
3536
# Shortcut syntax for defining an immutable named tuple is noted here:
3637
# https://docs.python.org/3/library/typing.html#typing.NamedTuple
3738
# via the "See also" box here: https://docs.python.org/3/library/collections.html#collections.namedtuple

case_utils/case_sparql_construct/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def main() -> None:
9696
construct_query_result = in_graph.query(construct_query_object)
9797
_logger.debug("type(construct_query_result) = %r." % type(construct_query_result))
9898
_logger.debug("len(construct_query_result) = %d." % len(construct_query_result))
99-
for (row_no, row) in enumerate(construct_query_result):
99+
for row_no, row in enumerate(construct_query_result):
100100
if row_no == 0:
101101
_logger.debug("row[0] = %r." % (row,))
102102
out_graph.add(row)

case_utils/case_sparql_select/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ def main() -> None:
109109
select_query_object = rdflib.plugins.sparql.prepareQuery(
110110
select_query_text, initNs=nsdict
111111
)
112-
for (row_no, row) in enumerate(graph.query(select_query_object)):
112+
for row_no, row in enumerate(graph.query(select_query_object)):
113113
tally = row_no + 1
114114
record = []
115-
for (column_no, column) in enumerate(row):
115+
for column_no, column in enumerate(row):
116116
if column is None:
117117
column_value = ""
118118
elif (

case_utils/local_uuid.py

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,25 @@
3232
_logger = logging.getLogger(pathlib.Path(__file__).name)
3333

3434

35+
def _is_relative_to(p1: pathlib.Path, p2: pathlib.Path) -> bool:
36+
"""
37+
This function provides pathlib.is_relative_to to Pythons before 3.9. After the End of Life of Python 3.8, this function can be removed.
38+
"""
39+
if sys.version_info < (3, 9):
40+
try:
41+
_ = p1.relative_to(p2)
42+
return True
43+
except ValueError:
44+
return False
45+
else:
46+
return p1.is_relative_to(p2)
47+
48+
3549
def configure() -> None:
3650
global DEMO_UUID_BASE
3751

52+
# _logger.debug("sys.argv = %r.", sys.argv)
53+
3854
if os.getenv("DEMO_UUID_REQUESTING_NONRANDOM") == "NONRANDOM_REQUESTED":
3955
warnings.warn(
4056
"Environment variable DEMO_UUID_REQUESTING_NONRANDOM is deprecated. See case_utils.local_uuid.demo_uuid for usage notes on its replacement, CASE_DEMO_NONRANDOM_UUID_BASE. Proceeding with random UUIDs.",
@@ -82,18 +98,23 @@ def configure() -> None:
8298
demo_uuid_base_parts.append(sys.argv[0])
8399
else:
84100
command_original_path = pathlib.Path(sys.argv[0])
101+
# _logger.debug("command_original_path = %r.", command_original_path)
85102
command_resolved_path = command_original_path.resolve()
103+
# _logger.debug("command_resolved_path = %r.", command_resolved_path)
104+
105+
# The command could be a command embedded in a virtual
106+
# environment, or it could be a script external to any virtual
107+
# environment.
86108
venv_original_path = pathlib.Path(env_venv_name)
87109
venv_resolved_path = venv_original_path.resolve()
88-
try:
110+
if _is_relative_to(command_resolved_path, venv_resolved_path):
89111
command_relative_path = command_resolved_path.relative_to(
90112
venv_resolved_path
91113
)
92114
# _logger.debug("command_relative_path = %r.", command_relative_path)
93115
demo_uuid_base_parts.append(str(command_relative_path))
94-
except ValueError:
95-
# _logger.debug("Command path is not relative to virtual environment path.")
96-
demo_uuid_base_parts.append(str(command_resolved_path))
116+
else:
117+
demo_uuid_base_parts.append(str(command_original_path))
97118

98119
if len(sys.argv) > 1:
99120
# Component: Arguments of argument vector.

setup.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ include_package_data = true
2121
install_requires =
2222
pandas
2323
pyshacl
24-
rdflib >= 6.0.2
24+
rdflib >= 6.0.2, < 6.3.0
2525
requests
2626
tabulate
2727
packages = find:
28-
python_requires = >=3.7
28+
python_requires = >=3.8
2929

3030
[options.entry_points]
3131
console_scripts =

tests/Makefile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ all: \
2222

2323
.PHONY: \
2424
all-case_utils \
25+
all-lib \
2526
check-case_utils \
2627
check-isomorphic_diff \
2728
check-mypy \
@@ -53,10 +54,15 @@ all: \
5354
touch $@
5455

5556
all-case_utils: \
56-
.venv.done.log
57+
.venv.done.log \
58+
all-lib
5759
$(MAKE) \
5860
--directory case_utils
5961

62+
all-lib:
63+
$(MAKE) \
64+
--directory lib
65+
6066
# These check calls are provided in preferred run-order.
6167
check: \
6268
check-mypy \
@@ -68,7 +74,8 @@ check: \
6874
--log-level=DEBUG
6975

7076
check-case_utils: \
71-
.venv.done.log
77+
.venv.done.log \
78+
all-lib
7279
$(MAKE) \
7380
--directory case_utils \
7481
check

tests/case_utils/case_file/Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ top_srcdir := $(shell cd ../../.. ; pwd)
1717

1818
tests_srcdir := $(top_srcdir)/tests
1919

20-
case_srcdir := $(top_srcdir)/dependencies/CASE
21-
22-
RDF_TOOLKIT_JAR := $(case_srcdir)/lib/rdf-toolkit.jar
20+
RDF_TOOLKIT_JAR := $(tests_srcdir)/lib/rdf-toolkit.jar
2321

2422
all: \
2523
kb.json \

tests/case_utils/case_validate/case_test_examples/Makefile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,11 @@ SHELL := /bin/bash
1515

1616
top_srcdir := $(shell cd ../../../.. ; pwd)
1717

18-
case_srcdir := $(top_srcdir)/dependencies/CASE
19-
20-
examples_srcdir := $(case_srcdir)/tests/examples
18+
examples_srcdir := $(top_srcdir)/dependencies/CASE/tests/examples
2119

2220
tests_srcdir := $(top_srcdir)/tests
2321

24-
RDF_TOOLKIT_JAR := $(case_srcdir)/lib/rdf-toolkit.jar
22+
RDF_TOOLKIT_JAR := $(tests_srcdir)/lib/rdf-toolkit.jar
2523

2624
all: \
2725
investigative_action_PASS_validation.ttl \

tests/case_utils/case_validate/cli/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ examples_srcdir := $(case_srcdir)/tests/examples
2121

2222
tests_srcdir := $(top_srcdir)/tests
2323

24-
RDF_TOOLKIT_JAR := $(case_srcdir)/lib/rdf-toolkit.jar
24+
RDF_TOOLKIT_JAR := $(tests_srcdir)/lib/rdf-toolkit.jar
2525

2626
files_to_generate := \
2727
format_human_output_jsonld.jsonld \

tests/case_utils/case_validate/uco_test_examples/Makefile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,11 @@ SHELL := /bin/bash
1515

1616
top_srcdir := $(shell cd ../../../.. ; pwd)
1717

18-
case_srcdir := $(top_srcdir)/dependencies/CASE
19-
20-
uco_srcdir := $(case_srcdir)/dependencies/UCO
21-
22-
examples_srcdir := $(uco_srcdir)/tests/examples
18+
examples_srcdir := $(top_srcdir)/dependencies/CASE/dependencies/UCO/tests/examples
2319

2420
tests_srcdir := $(top_srcdir)/tests
2521

26-
RDF_TOOLKIT_JAR := $(case_srcdir)/lib/rdf-toolkit.jar
22+
RDF_TOOLKIT_JAR := $(tests_srcdir)/lib/rdf-toolkit.jar
2723

2824
all: \
2925
action_inheritance_PASS_validation.ttl \

tests/lib/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.jar

tests/lib/Makefile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/make -f
2+
3+
# Portions of this file contributed by NIST are governed by the
4+
# following statement:
5+
#
6+
# This software was developed at the National Institute of Standards
7+
# and Technology by employees of the Federal Government in the course
8+
# of their official duties. Pursuant to Title 17 Section 105 of the
9+
# United States Code, this software is not subject to copyright
10+
# protection within the United States. NIST assumes no responsibility
11+
# whatsoever for its use by other parties, and makes no guarantees,
12+
# expressed or implied, about its quality, reliability, or any other
13+
# characteristic.
14+
#
15+
# We would appreciate acknowledgement if the software is used.
16+
17+
# This Makefile is incorporated to support versions of case-utils since
18+
# 0.5.0 that had not yet incorporated rdf-toolkit-1.11.0.jar into their
19+
# testing process. The Makefile is adapted from the `/lib` directory of
20+
# UCO at version 1.2.0.
21+
22+
SHELL := /bin/bash
23+
24+
all: \
25+
rdf-toolkit.jar
26+
27+
rdf-toolkit.jar:
28+
test -r rdf-toolkit.jar.sha512
29+
rm -f $@_
30+
# Try retrieval from files.caseontology.org.
31+
wget \
32+
--output-document $@_ \
33+
https://files.caseontology.org/rdf-toolkit-1.11.0.jar
34+
test \
35+
"x$$(openssl dgst -sha512 $@_ | awk '{print($$NF)}')" \
36+
== \
37+
"x$$(head -n1 rdf-toolkit.jar.sha512)"
38+
mv $@_ $@

tests/lib/rdf-toolkit.jar.sha512

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
8131e5515da63f099a89a3ce2c7587fb6b228f1ec7c5eb49ff35710509e8511921bfc847e182ee994e575b1f7895c04ae5bed7e1b7826bb32c9475b43b74dc17

0 commit comments

Comments
 (0)