shellsmith 0.2.0__tar.gz → 0.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {shellsmith-0.2.0/src/shellsmith.egg-info → shellsmith-0.2.1}/PKG-INFO +1 -1
- {shellsmith-0.2.0 → shellsmith-0.2.1}/pyproject.toml +1 -1
- {shellsmith-0.2.0 → shellsmith-0.2.1}/src/shellsmith/__init__.py +1 -1
- {shellsmith-0.2.0 → shellsmith-0.2.1}/src/shellsmith/cli/commands/info.py +10 -5
- {shellsmith-0.2.0 → shellsmith-0.2.1/src/shellsmith.egg-info}/PKG-INFO +1 -1
- {shellsmith-0.2.0 → shellsmith-0.2.1}/tests/test_neo4j.py +21 -11
- {shellsmith-0.2.0 → shellsmith-0.2.1}/LICENSE +0 -0
- {shellsmith-0.2.0 → shellsmith-0.2.1}/README.md +0 -0
- {shellsmith-0.2.0 → shellsmith-0.2.1}/setup.cfg +0 -0
- {shellsmith-0.2.0 → shellsmith-0.2.1}/src/shellsmith/__main__.py +0 -0
- {shellsmith-0.2.0 → shellsmith-0.2.1}/src/shellsmith/cli/__init__.py +0 -0
- {shellsmith-0.2.0 → shellsmith-0.2.1}/src/shellsmith/cli/commands/__init__.py +0 -0
- {shellsmith-0.2.0 → shellsmith-0.2.1}/src/shellsmith/cli/commands/nuke.py +0 -0
- {shellsmith-0.2.0 → shellsmith-0.2.1}/src/shellsmith/cli/commands/shell.py +0 -0
- {shellsmith-0.2.0 → shellsmith-0.2.1}/src/shellsmith/cli/commands/sme.py +0 -0
- {shellsmith-0.2.0 → shellsmith-0.2.1}/src/shellsmith/cli/commands/submodel.py +0 -0
- {shellsmith-0.2.0 → shellsmith-0.2.1}/src/shellsmith/cli/commands/upload.py +0 -0
- {shellsmith-0.2.0 → shellsmith-0.2.1}/src/shellsmith/cli/main.py +0 -0
- {shellsmith-0.2.0 → shellsmith-0.2.1}/src/shellsmith/cli/parser.py +0 -0
- {shellsmith-0.2.0 → shellsmith-0.2.1}/src/shellsmith/config.py +0 -0
- {shellsmith-0.2.0 → shellsmith-0.2.1}/src/shellsmith/crud/__init__.py +0 -0
- {shellsmith-0.2.0 → shellsmith-0.2.1}/src/shellsmith/crud/shells.py +0 -0
- {shellsmith-0.2.0 → shellsmith-0.2.1}/src/shellsmith/crud/submodels.py +0 -0
- {shellsmith-0.2.0 → shellsmith-0.2.1}/src/shellsmith/neo4j.py +0 -0
- {shellsmith-0.2.0 → shellsmith-0.2.1}/src/shellsmith/services.py +0 -0
- {shellsmith-0.2.0 → shellsmith-0.2.1}/src/shellsmith/upload.py +0 -0
- {shellsmith-0.2.0 → shellsmith-0.2.1}/src/shellsmith/utils.py +0 -0
- {shellsmith-0.2.0 → shellsmith-0.2.1}/src/shellsmith.egg-info/SOURCES.txt +0 -0
- {shellsmith-0.2.0 → shellsmith-0.2.1}/src/shellsmith.egg-info/dependency_links.txt +0 -0
- {shellsmith-0.2.0 → shellsmith-0.2.1}/src/shellsmith.egg-info/entry_points.txt +0 -0
- {shellsmith-0.2.0 → shellsmith-0.2.1}/src/shellsmith.egg-info/requires.txt +0 -0
- {shellsmith-0.2.0 → shellsmith-0.2.1}/src/shellsmith.egg-info/top_level.txt +0 -0
- {shellsmith-0.2.0 → shellsmith-0.2.1}/tests/test_cli.py +0 -0
- {shellsmith-0.2.0 → shellsmith-0.2.1}/tests/test_cli_integration.py +0 -0
- {shellsmith-0.2.0 → shellsmith-0.2.1}/tests/test_crud.py +0 -0
- {shellsmith-0.2.0 → shellsmith-0.2.1}/tests/test_upload.py +0 -0
- {shellsmith-0.2.0 → shellsmith-0.2.1}/tests/test_utils.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "shellsmith"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.1"
|
|
8
8
|
description = "A Python toolkit and CLI for managing Asset Administration Shells"
|
|
9
9
|
authors = [{ name = "Peter Stein", email = "peterstein@dfki.de" }]
|
|
10
10
|
license = { file = "LICENSE" }
|
|
@@ -17,21 +17,25 @@ def print_unreferenced_submodels():
|
|
|
17
17
|
print("⚠️ Unreferenced Submodels:")
|
|
18
18
|
for submodel_id in submodel_ids:
|
|
19
19
|
submodel = shellsmith.get_submodel(submodel_id)
|
|
20
|
-
id_short = submodel
|
|
20
|
+
id_short = submodel.get("idShort", "<no idShort>")
|
|
21
21
|
print(f"- {id_short} ({submodel_id})")
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
def print_shells_tree():
|
|
25
25
|
shells = shellsmith.get_shells()
|
|
26
26
|
for shell in shells:
|
|
27
|
-
|
|
27
|
+
shell_id = shell['id']
|
|
28
|
+
shell_id_short = shell.get('idShort', "<no idShort>")
|
|
29
|
+
print(f"{shell_id_short}: {shell_id}")
|
|
28
30
|
|
|
29
|
-
submodels = services.get_shell_submodels(
|
|
31
|
+
submodels = services.get_shell_submodels(shell_id)
|
|
30
32
|
|
|
31
33
|
for i, submodel in enumerate(submodels):
|
|
32
34
|
is_last = i == len(submodels) - 1
|
|
33
35
|
prefix = "└──" if is_last else "├──"
|
|
34
|
-
|
|
36
|
+
submodel_id = submodel['id']
|
|
37
|
+
submodel_id_short = submodel.get('idShort', "<no idShort>")
|
|
38
|
+
print(f"{prefix} {submodel_id}: {submodel_id_short}")
|
|
35
39
|
|
|
36
40
|
|
|
37
41
|
def print_dangling_submodel_refs():
|
|
@@ -42,6 +46,7 @@ def print_dangling_submodel_refs():
|
|
|
42
46
|
print("⚠️ Dangling Submodel References:")
|
|
43
47
|
for shell_id, submodel_ids in dangling.items():
|
|
44
48
|
shell = shellsmith.get_shell(shell_id)
|
|
45
|
-
|
|
49
|
+
shell_id_short = shell.get('idShort', "<no idShort>")
|
|
50
|
+
print(f"- {shell_id_short}: {shell_id}")
|
|
46
51
|
for submodel_id in submodel_ids:
|
|
47
52
|
print(f" └── {submodel_id}")
|
|
@@ -3,16 +3,17 @@ import time
|
|
|
3
3
|
|
|
4
4
|
import pytest
|
|
5
5
|
|
|
6
|
-
from shellsmith import neo4j
|
|
7
|
-
from shellsmith.upload import upload_aas_folder
|
|
8
|
-
|
|
9
6
|
if not os.getenv("SHELLSMITH_NEO4J_ENABLED"):
|
|
10
7
|
pytest.skip(
|
|
11
8
|
reason="Skipping Neo4j tests. Set SHELLSMITH_NEO4J_ENABLED=1 to enable.",
|
|
12
9
|
allow_module_level=True,
|
|
13
10
|
)
|
|
14
11
|
|
|
15
|
-
|
|
12
|
+
from shellsmith import neo4j, services
|
|
13
|
+
from shellsmith.upload import upload_aas_folder
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
GRAPH_READY_TIMEOUT = 45 # seconds
|
|
16
17
|
EXPECTED_NODE_COUNT = 39
|
|
17
18
|
EXPECTED_SUBMODEL_ELEMENT_COUNT = 17 # or whatever your total is
|
|
18
19
|
|
|
@@ -20,31 +21,40 @@ EXPECTED_SUBMODEL_ELEMENT_COUNT = 17 # or whatever your total is
|
|
|
20
21
|
def wait_for_graph_node_count(
|
|
21
22
|
expected_count: int = EXPECTED_NODE_COUNT,
|
|
22
23
|
timeout: int = GRAPH_READY_TIMEOUT,
|
|
23
|
-
) -> bool:
|
|
24
|
+
) -> (bool, int):
|
|
24
25
|
query = "MATCH (n) RETURN count(n) AS count"
|
|
25
26
|
start = time.time()
|
|
26
27
|
|
|
28
|
+
last_count = 0
|
|
29
|
+
|
|
27
30
|
while True:
|
|
28
31
|
try:
|
|
29
32
|
with neo4j.get_driver().session() as session:
|
|
30
33
|
result = session.run(query)
|
|
31
34
|
record = result.single()
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
count = record["count"]
|
|
36
|
+
last_count = count
|
|
37
|
+
if record and count == expected_count:
|
|
38
|
+
return True, last_count
|
|
34
39
|
except Exception: # noqa
|
|
35
40
|
pass # wait and retry
|
|
36
41
|
|
|
37
42
|
if time.time() - start > timeout:
|
|
38
|
-
return False
|
|
43
|
+
return False, last_count
|
|
39
44
|
|
|
40
45
|
time.sleep(0.5)
|
|
41
46
|
|
|
42
47
|
|
|
43
48
|
def test_wait_for_graph():
|
|
44
|
-
neo4j.detach_delete_all()
|
|
45
|
-
|
|
49
|
+
# neo4j.detach_delete_all()
|
|
50
|
+
services.delete_all_shells()
|
|
51
|
+
services.delete_all_submodels()
|
|
52
|
+
success, count = wait_for_graph_node_count(0)
|
|
53
|
+
assert success, f"Graph was not fully destructed within timeout: {count}"
|
|
54
|
+
|
|
46
55
|
upload_aas_folder("aas")
|
|
47
|
-
|
|
56
|
+
success, count = wait_for_graph_node_count(39)
|
|
57
|
+
assert success, f"Graph was not fully built within timeout: {count}"
|
|
48
58
|
time.sleep(1)
|
|
49
59
|
|
|
50
60
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|