tlaplus-cli 0.3.2__tar.gz → 0.3.3__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.
- {tlaplus_cli-0.3.2/src/tlaplus_cli.egg-info → tlaplus_cli-0.3.3}/PKG-INFO +1 -1
- {tlaplus_cli-0.3.2 → tlaplus_cli-0.3.3}/pyproject.toml +3 -2
- {tlaplus_cli-0.3.2 → tlaplus_cli-0.3.3}/src/tlaplus_cli/config.py +9 -5
- {tlaplus_cli-0.3.2 → tlaplus_cli-0.3.3}/src/tlaplus_cli/project.py +1 -5
- tlaplus_cli-0.3.3/src/tlaplus_cli/resources/__init__.py +1 -0
- {tlaplus_cli-0.3.2 → tlaplus_cli-0.3.3}/src/tlaplus_cli/run_tlc.py +10 -4
- {tlaplus_cli-0.3.2 → tlaplus_cli-0.3.3/src/tlaplus_cli.egg-info}/PKG-INFO +1 -1
- {tlaplus_cli-0.3.2 → tlaplus_cli-0.3.3}/src/tlaplus_cli.egg-info/SOURCES.txt +1 -0
- {tlaplus_cli-0.3.2 → tlaplus_cli-0.3.3}/tests/test_build_tlc_module.py +2 -2
- {tlaplus_cli-0.3.2 → tlaplus_cli-0.3.3}/tests/test_project.py +4 -0
- {tlaplus_cli-0.3.2 → tlaplus_cli-0.3.3}/LICENSE +0 -0
- {tlaplus_cli-0.3.2 → tlaplus_cli-0.3.3}/MANIFEST.in +0 -0
- {tlaplus_cli-0.3.2 → tlaplus_cli-0.3.3}/README.md +0 -0
- {tlaplus_cli-0.3.2 → tlaplus_cli-0.3.3}/setup.cfg +0 -0
- {tlaplus_cli-0.3.2 → tlaplus_cli-0.3.3}/src/tlaplus_cli/__init__.py +0 -0
- {tlaplus_cli-0.3.2 → tlaplus_cli-0.3.3}/src/tlaplus_cli/build_tlc_module.py +0 -0
- {tlaplus_cli-0.3.2 → tlaplus_cli-0.3.3}/src/tlaplus_cli/check_java.py +0 -0
- {tlaplus_cli-0.3.2 → tlaplus_cli-0.3.3}/src/tlaplus_cli/cli.py +0 -0
- {tlaplus_cli-0.3.2 → tlaplus_cli-0.3.3}/src/tlaplus_cli/py.typed +0 -0
- {tlaplus_cli-0.3.2 → tlaplus_cli-0.3.3}/src/tlaplus_cli/resources/default_config.yaml +0 -0
- {tlaplus_cli-0.3.2 → tlaplus_cli-0.3.3}/src/tlaplus_cli/settings.py +0 -0
- {tlaplus_cli-0.3.2 → tlaplus_cli-0.3.3}/src/tlaplus_cli/tools_manager.py +0 -0
- {tlaplus_cli-0.3.2 → tlaplus_cli-0.3.3}/src/tlaplus_cli/version_manager.py +0 -0
- {tlaplus_cli-0.3.2 → tlaplus_cli-0.3.3}/src/tlaplus_cli.egg-info/dependency_links.txt +0 -0
- {tlaplus_cli-0.3.2 → tlaplus_cli-0.3.3}/src/tlaplus_cli.egg-info/entry_points.txt +0 -0
- {tlaplus_cli-0.3.2 → tlaplus_cli-0.3.3}/src/tlaplus_cli.egg-info/requires.txt +0 -0
- {tlaplus_cli-0.3.2 → tlaplus_cli-0.3.3}/src/tlaplus_cli.egg-info/top_level.txt +0 -0
- {tlaplus_cli-0.3.2 → tlaplus_cli-0.3.3}/tests/test_check_java.py +0 -0
- {tlaplus_cli-0.3.2 → tlaplus_cli-0.3.3}/tests/test_cli.py +0 -0
- {tlaplus_cli-0.3.2 → tlaplus_cli-0.3.3}/tests/test_java_module_naming.py +0 -0
- {tlaplus_cli-0.3.2 → tlaplus_cli-0.3.3}/tests/test_run_tlc.py +0 -0
- {tlaplus_cli-0.3.2 → tlaplus_cli-0.3.3}/tests/test_spec_resolution.py +0 -0
- {tlaplus_cli-0.3.2 → tlaplus_cli-0.3.3}/tests/test_tools_manager.py +0 -0
- {tlaplus_cli-0.3.2 → tlaplus_cli-0.3.3}/tests/test_version_manager.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "tlaplus-cli"
|
|
7
|
-
version = "0.3.
|
|
7
|
+
version = "0.3.3"
|
|
8
8
|
description = "TLA+ tools: download TLC, compile custom modules, run model checker"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -45,7 +45,8 @@ where = ["src"]
|
|
|
45
45
|
include = ["tlaplus_cli*"]
|
|
46
46
|
|
|
47
47
|
[tool.setuptools.package-data]
|
|
48
|
-
tlaplus_cli = ["
|
|
48
|
+
tlaplus_cli = ["py.typed"]
|
|
49
|
+
"tlaplus_cli.resources" = ["*.yaml"]
|
|
49
50
|
|
|
50
51
|
[dependency-groups]
|
|
51
52
|
dev = [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import importlib.resources
|
|
2
2
|
from functools import lru_cache
|
|
3
3
|
from pathlib import Path
|
|
4
4
|
|
|
@@ -37,9 +37,12 @@ def cache_dir() -> Path:
|
|
|
37
37
|
return Path(platformdirs.user_cache_dir(_APP_NAME))
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
def
|
|
41
|
-
"""
|
|
42
|
-
|
|
40
|
+
def _default_config_content() -> str:
|
|
41
|
+
"""Read the default config shipped with the package."""
|
|
42
|
+
# Safer than __file__, correctly handles zipped wheels and zipapps.
|
|
43
|
+
return (
|
|
44
|
+
importlib.resources.files("tlaplus_cli.resources").joinpath("default_config.yaml").read_text(encoding="utf-8")
|
|
45
|
+
)
|
|
43
46
|
|
|
44
47
|
|
|
45
48
|
def _ensure_config() -> Path:
|
|
@@ -47,7 +50,8 @@ def _ensure_config() -> Path:
|
|
|
47
50
|
cp = config_path()
|
|
48
51
|
if not cp.exists():
|
|
49
52
|
cp.parent.mkdir(parents=True, exist_ok=True)
|
|
50
|
-
|
|
53
|
+
# Write default config to the newly created path
|
|
54
|
+
cp.write_text(_default_config_content(), encoding="utf-8")
|
|
51
55
|
return cp
|
|
52
56
|
|
|
53
57
|
|
|
@@ -5,11 +5,7 @@ from pathlib import Path
|
|
|
5
5
|
|
|
6
6
|
def _is_project_root(directory: Path, modules_dir: Path | str, classes_dir: Path | str, lib_dir: Path | str) -> bool:
|
|
7
7
|
"""Return True if directory contains at least one project structure marker."""
|
|
8
|
-
return (
|
|
9
|
-
(directory / classes_dir).is_dir()
|
|
10
|
-
or (directory / modules_dir).is_dir()
|
|
11
|
-
or (directory / lib_dir).is_dir()
|
|
12
|
-
)
|
|
8
|
+
return (directory / classes_dir).is_dir() or (directory / modules_dir).is_dir() or (directory / lib_dir).is_dir()
|
|
13
9
|
|
|
14
10
|
|
|
15
11
|
def find_project_root(
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Resources subpackage."""
|
|
@@ -69,8 +69,7 @@ def tlc(
|
|
|
69
69
|
|
|
70
70
|
# Spec resolution logic
|
|
71
71
|
spec_path = Path(spec)
|
|
72
|
-
candidates = [spec_path, spec_path.with_suffix(".tla"),
|
|
73
|
-
spec_path.parent / "spec" / (spec_path.name + ".tla")]
|
|
72
|
+
candidates = [spec_path, spec_path.with_suffix(".tla"), spec_path.parent / "spec" / (spec_path.name + ".tla")]
|
|
74
73
|
|
|
75
74
|
spec_file = next((c for c in candidates if c.is_file()), None)
|
|
76
75
|
if not spec_file:
|
|
@@ -97,8 +96,15 @@ def tlc(
|
|
|
97
96
|
if modules_path.is_dir():
|
|
98
97
|
extra_jvm_opts.append(f"-DTLA-Library={modules_path}")
|
|
99
98
|
|
|
100
|
-
cmd = [
|
|
101
|
-
|
|
99
|
+
cmd = [
|
|
100
|
+
"java",
|
|
101
|
+
*config.java.opts,
|
|
102
|
+
*extra_jvm_opts,
|
|
103
|
+
"-cp",
|
|
104
|
+
os.pathsep.join(classpath_parts),
|
|
105
|
+
config.tlc.java_class,
|
|
106
|
+
spec_file.name,
|
|
107
|
+
]
|
|
102
108
|
|
|
103
109
|
typer.echo(f"Running TLC on {spec_file.name} ...\nCommand: {' '.join(cmd)}")
|
|
104
110
|
result = subprocess.run(cmd, cwd=str(spec_file.parent))
|
|
@@ -19,6 +19,7 @@ src/tlaplus_cli.egg-info/dependency_links.txt
|
|
|
19
19
|
src/tlaplus_cli.egg-info/entry_points.txt
|
|
20
20
|
src/tlaplus_cli.egg-info/requires.txt
|
|
21
21
|
src/tlaplus_cli.egg-info/top_level.txt
|
|
22
|
+
src/tlaplus_cli/resources/__init__.py
|
|
22
23
|
src/tlaplus_cli/resources/default_config.yaml
|
|
23
24
|
tests/test_build_tlc_module.py
|
|
24
25
|
tests/test_check_java.py
|
|
@@ -100,8 +100,8 @@ def test_build_with_explicit_path(mocker, tmp_path, base_settings):
|
|
|
100
100
|
assert result.exit_code == 0
|
|
101
101
|
args, _ = mock_run.call_args
|
|
102
102
|
cmd = args[0]
|
|
103
|
-
assert str(project_dir / "classes") in cmd
|
|
104
|
-
assert str(modules_dir / "Foo.java") in cmd
|
|
103
|
+
assert str(project_dir / "classes") in cmd # -d target
|
|
104
|
+
assert str(modules_dir / "Foo.java") in cmd # source file
|
|
105
105
|
|
|
106
106
|
|
|
107
107
|
def test_build_without_path_uses_workspace_root(mocker, tmp_path, base_settings):
|
|
@@ -9,6 +9,7 @@ def test_project_root_at_spec_dir(tmp_path):
|
|
|
9
9
|
root = find_project_root(spec, modules_dir="modules", classes_dir="classes", lib_dir="lib")
|
|
10
10
|
assert root == tmp_path
|
|
11
11
|
|
|
12
|
+
|
|
12
13
|
def test_project_root_at_parent_of_spec_dir(tmp_path):
|
|
13
14
|
"""Root found one level up when spec is inside a spec/ subdirectory."""
|
|
14
15
|
spec_subdir = tmp_path / "spec"
|
|
@@ -19,6 +20,7 @@ def test_project_root_at_parent_of_spec_dir(tmp_path):
|
|
|
19
20
|
root = find_project_root(spec, modules_dir="modules", classes_dir="classes", lib_dir="lib")
|
|
20
21
|
assert root == tmp_path
|
|
21
22
|
|
|
23
|
+
|
|
22
24
|
def test_project_root_none_when_no_structure(tmp_path):
|
|
23
25
|
"""Returns None if neither spec dir nor its parent contain project directories."""
|
|
24
26
|
spec = tmp_path / "spec" / "queue.tla"
|
|
@@ -27,6 +29,7 @@ def test_project_root_none_when_no_structure(tmp_path):
|
|
|
27
29
|
root = find_project_root(spec, modules_dir="modules", classes_dir="classes", lib_dir="lib")
|
|
28
30
|
assert root is None
|
|
29
31
|
|
|
32
|
+
|
|
30
33
|
def test_project_root_detected_by_lib(tmp_path):
|
|
31
34
|
"""Root found based on lib/ directory even without classes/."""
|
|
32
35
|
spec = tmp_path / "tests" / "queue_test.tla"
|
|
@@ -36,6 +39,7 @@ def test_project_root_detected_by_lib(tmp_path):
|
|
|
36
39
|
root = find_project_root(spec, modules_dir="modules", classes_dir="classes", lib_dir="lib")
|
|
37
40
|
assert root == tmp_path
|
|
38
41
|
|
|
42
|
+
|
|
39
43
|
def test_project_root_detected_by_modules(tmp_path):
|
|
40
44
|
"""Root found based on modules/ directory alone."""
|
|
41
45
|
spec = tmp_path / "spec" / "queue.tla"
|
|
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
|