tlaplus-cli 0.8.1__tar.gz → 0.8.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.
Files changed (77) hide show
  1. tlaplus_cli-0.8.3/PKG-INFO +41 -0
  2. tlaplus_cli-0.8.3/README.md +17 -0
  3. {tlaplus_cli-0.8.1 → tlaplus_cli-0.8.3}/pyproject.toml +8 -15
  4. tlaplus_cli-0.8.3/src/tlaplus_cli/__init__.py +1 -0
  5. tlaplus_cli-0.8.3/src/tlaplus_cli/cli.py +16 -0
  6. tlaplus_cli-0.8.3/src/tlaplus_cli.egg-info/PKG-INFO +41 -0
  7. tlaplus_cli-0.8.3/src/tlaplus_cli.egg-info/SOURCES.txt +12 -0
  8. tlaplus_cli-0.8.3/src/tlaplus_cli.egg-info/requires.txt +1 -0
  9. tlaplus_cli-0.8.1/MANIFEST.in +0 -4
  10. tlaplus_cli-0.8.1/PKG-INFO +0 -70
  11. tlaplus_cli-0.8.1/README.md +0 -40
  12. tlaplus_cli-0.8.1/src/tlaplus_cli/__init__.py +0 -6
  13. tlaplus_cli-0.8.1/src/tlaplus_cli/cache/__init__.py +0 -0
  14. tlaplus_cli-0.8.1/src/tlaplus_cli/cache/github.py +0 -28
  15. tlaplus_cli-0.8.1/src/tlaplus_cli/cli.py +0 -62
  16. tlaplus_cli-0.8.1/src/tlaplus_cli/cmd/__init__.py +0 -0
  17. tlaplus_cli-0.8.1/src/tlaplus_cli/cmd/check_java.py +0 -19
  18. tlaplus_cli-0.8.1/src/tlaplus_cli/cmd/config/__init__.py +0 -6
  19. tlaplus_cli-0.8.1/src/tlaplus_cli/cmd/config/edit.py +0 -34
  20. tlaplus_cli-0.8.1/src/tlaplus_cli/cmd/config/list.py +0 -16
  21. tlaplus_cli-0.8.1/src/tlaplus_cli/cmd/fetch_cache/__init__.py +0 -5
  22. tlaplus_cli-0.8.1/src/tlaplus_cli/cmd/fetch_cache/clear.py +0 -11
  23. tlaplus_cli-0.8.1/src/tlaplus_cli/cmd/modules/__init__.py +0 -16
  24. tlaplus_cli-0.8.1/src/tlaplus_cli/cmd/modules/add.py +0 -140
  25. tlaplus_cli-0.8.1/src/tlaplus_cli/cmd/modules/list.py +0 -45
  26. tlaplus_cli-0.8.1/src/tlaplus_cli/cmd/modules/path.py +0 -68
  27. tlaplus_cli-0.8.1/src/tlaplus_cli/cmd/modules/remove.py +0 -22
  28. tlaplus_cli-0.8.1/src/tlaplus_cli/cmd/tlc.py +0 -291
  29. tlaplus_cli-0.8.1/src/tlaplus_cli/cmd/tools/__init__.py +0 -8
  30. tlaplus_cli-0.8.1/src/tlaplus_cli/cmd/tools/dir.py +0 -16
  31. tlaplus_cli-0.8.1/src/tlaplus_cli/cmd/tools/install.py +0 -79
  32. tlaplus_cli-0.8.1/src/tlaplus_cli/cmd/tools/list.py +0 -81
  33. tlaplus_cli-0.8.1/src/tlaplus_cli/cmd/tools/meta/__init__.py +0 -5
  34. tlaplus_cli-0.8.1/src/tlaplus_cli/cmd/tools/meta/sync.py +0 -34
  35. tlaplus_cli-0.8.1/src/tlaplus_cli/cmd/tools/path.py +0 -33
  36. tlaplus_cli-0.8.1/src/tlaplus_cli/cmd/tools/pin.py +0 -31
  37. tlaplus_cli-0.8.1/src/tlaplus_cli/cmd/tools/uninstall.py +0 -104
  38. tlaplus_cli-0.8.1/src/tlaplus_cli/cmd/tools/upgrade.py +0 -76
  39. tlaplus_cli-0.8.1/src/tlaplus_cli/config/__init__.py +0 -0
  40. tlaplus_cli-0.8.1/src/tlaplus_cli/config/loader.py +0 -87
  41. tlaplus_cli-0.8.1/src/tlaplus_cli/config/schema.py +0 -52
  42. tlaplus_cli-0.8.1/src/tlaplus_cli/java/__init__.py +0 -7
  43. tlaplus_cli-0.8.1/src/tlaplus_cli/java/classpath.py +0 -197
  44. tlaplus_cli-0.8.1/src/tlaplus_cli/java/inspector.py +0 -86
  45. tlaplus_cli-0.8.1/src/tlaplus_cli/project/__init__.py +0 -3
  46. tlaplus_cli-0.8.1/src/tlaplus_cli/project/core.py +0 -31
  47. tlaplus_cli-0.8.1/src/tlaplus_cli/resources/__init__.py +0 -1
  48. tlaplus_cli-0.8.1/src/tlaplus_cli/resources/default_config.yaml +0 -28
  49. tlaplus_cli-0.8.1/src/tlaplus_cli/tlc/__init__.py +0 -0
  50. tlaplus_cli-0.8.1/src/tlaplus_cli/tlc/codes.py +0 -314
  51. tlaplus_cli-0.8.1/src/tlaplus_cli/tlc/compiler.py +0 -12
  52. tlaplus_cli-0.8.1/src/tlaplus_cli/tlc/components.py +0 -287
  53. tlaplus_cli-0.8.1/src/tlaplus_cli/tlc/formatter.py +0 -348
  54. tlaplus_cli-0.8.1/src/tlaplus_cli/tlc/models.py +0 -132
  55. tlaplus_cli-0.8.1/src/tlaplus_cli/tlc/parser.py +0 -258
  56. tlaplus_cli-0.8.1/src/tlaplus_cli/tlc/run_cache.py +0 -61
  57. tlaplus_cli-0.8.1/src/tlaplus_cli/tlc/runner.py +0 -285
  58. tlaplus_cli-0.8.1/src/tlaplus_cli/tlc/sany.py +0 -94
  59. tlaplus_cli-0.8.1/src/tlaplus_cli/tlc/values.py +0 -186
  60. tlaplus_cli-0.8.1/src/tlaplus_cli/ui.py +0 -21
  61. tlaplus_cli-0.8.1/src/tlaplus_cli/versioning/__init__.py +0 -61
  62. tlaplus_cli-0.8.1/src/tlaplus_cli/versioning/api.py +0 -113
  63. tlaplus_cli-0.8.1/src/tlaplus_cli/versioning/app_version.py +0 -62
  64. tlaplus_cli-0.8.1/src/tlaplus_cli/versioning/downloader.py +0 -90
  65. tlaplus_cli-0.8.1/src/tlaplus_cli/versioning/metadata.py +0 -92
  66. tlaplus_cli-0.8.1/src/tlaplus_cli/versioning/paths.py +0 -97
  67. tlaplus_cli-0.8.1/src/tlaplus_cli/versioning/resolver.py +0 -92
  68. tlaplus_cli-0.8.1/src/tlaplus_cli/versioning/schema.py +0 -27
  69. tlaplus_cli-0.8.1/src/tlaplus_cli.egg-info/PKG-INFO +0 -70
  70. tlaplus_cli-0.8.1/src/tlaplus_cli.egg-info/SOURCES.txt +0 -68
  71. tlaplus_cli-0.8.1/src/tlaplus_cli.egg-info/requires.txt +0 -7
  72. {tlaplus_cli-0.8.1 → tlaplus_cli-0.8.3}/LICENSE +0 -0
  73. {tlaplus_cli-0.8.1 → tlaplus_cli-0.8.3}/setup.cfg +0 -0
  74. {tlaplus_cli-0.8.1 → tlaplus_cli-0.8.3}/src/tlaplus_cli/py.typed +0 -0
  75. {tlaplus_cli-0.8.1 → tlaplus_cli-0.8.3}/src/tlaplus_cli.egg-info/dependency_links.txt +0 -0
  76. {tlaplus_cli-0.8.1 → tlaplus_cli-0.8.3}/src/tlaplus_cli.egg-info/entry_points.txt +0 -0
  77. {tlaplus_cli-0.8.1 → tlaplus_cli-0.8.3}/src/tlaplus_cli.egg-info/top_level.txt +0 -0
@@ -0,0 +1,41 @@
1
+ Metadata-Version: 2.4
2
+ Name: tlaplus-cli
3
+ Version: 0.8.3
4
+ Summary: Renamed to tlaup. This package only installs tlaup and forwards the old tla command to it.
5
+ Author-email: Denis Nikolskiy <nikolskiy@users.noreply.github.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/nikolskiy/tlaup
8
+ Project-URL: Repository, https://github.com/nikolskiy/tlaup
9
+ Project-URL: Old repository, https://github.com/nikolskiy/tlaplus-cli
10
+ Project-URL: Changelog, https://github.com/nikolskiy/tlaplus-cli/blob/main/CHANGELOG.md
11
+ Classifier: Development Status :: 7 - Inactive
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Topic :: Software Development :: Build Tools
18
+ Classifier: Topic :: Utilities
19
+ Requires-Python: >=3.11
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: tlaup>=0.8.2
23
+ Dynamic: license-file
24
+
25
+ # tlaplus-cli has moved to tlaup
26
+
27
+ This project is now **tlaup**.
28
+
29
+ * Repository: https://github.com/nikolskiy/tlaup
30
+ * PyPI: https://pypi.org/project/tlaup/
31
+
32
+ `tlaplus-cli` is no longer maintained, and this repository is archived. The last release, 0.8.3, contains no code of its own: it installs `tlaup` and keeps the old `tla` command working by printing a notice and running the same command through `tlaup`.
33
+
34
+ ## Switching
35
+
36
+ ```bash
37
+ uv tool uninstall tlaplus-cli
38
+ uv tool install tlaup
39
+ ```
40
+
41
+ Then use `tlaup` wherever you used `tla`, for example `tlaup tools install` and `tlaup tlc MySpec`. Installed toolsets, custom modules and the config file stay where they are, so nothing needs to be reinstalled.
@@ -0,0 +1,17 @@
1
+ # tlaplus-cli has moved to tlaup
2
+
3
+ This project is now **tlaup**.
4
+
5
+ * Repository: https://github.com/nikolskiy/tlaup
6
+ * PyPI: https://pypi.org/project/tlaup/
7
+
8
+ `tlaplus-cli` is no longer maintained, and this repository is archived. The last release, 0.8.3, contains no code of its own: it installs `tlaup` and keeps the old `tla` command working by printing a notice and running the same command through `tlaup`.
9
+
10
+ ## Switching
11
+
12
+ ```bash
13
+ uv tool uninstall tlaplus-cli
14
+ uv tool install tlaup
15
+ ```
16
+
17
+ Then use `tlaup` wherever you used `tla`, for example `tlaup tools install` and `tlaup tlc MySpec`. Installed toolsets, custom modules and the config file stay where they are, so nothing needs to be reinstalled.
@@ -4,25 +4,19 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "tlaplus-cli"
7
- version = "0.8.1"
8
- description = "TLA+ tools: download TLC, compile custom modules, run model checker"
7
+ version = "0.8.3"
8
+ description = "Renamed to tlaup. This package only installs tlaup and forwards the old tla command to it."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
11
11
  dependencies = [
12
- "typer>=0.22.0,<1.0.0",
13
- "requests>=2.31.0,<3.0.0",
14
- "pyyaml>=6.0,<7.0",
15
- "platformdirs>=4.0,<5.0",
16
- "pydantic>=2.12.5,<3.0.0",
17
- "truststore>=0.9.0,<1.0.0",
18
- "rich>=13.7.0,<14.0.0",
12
+ "tlaup>=0.8.2",
19
13
  ]
20
14
  authors = [
21
- {name = "Denis Nikolskiy", email = "codeomatics@gmail.com"}
15
+ {name = "Denis Nikolskiy", email = "nikolskiy@users.noreply.github.com"}
22
16
  ]
23
17
  license = "MIT"
24
18
  classifiers = [
25
- "Development Status :: 3 - Alpha",
19
+ "Development Status :: 7 - Inactive",
26
20
  "Programming Language :: Python :: 3",
27
21
  "Programming Language :: Python :: 3.11",
28
22
  "Programming Language :: Python :: 3.12",
@@ -33,9 +27,9 @@ classifiers = [
33
27
  ]
34
28
 
35
29
  [project.urls]
36
- Homepage = "https://github.com/nikolskiy/tlaplus-cli"
37
- Repository = "https://github.com/nikolskiy/tlaplus-cli"
38
- Issues = "https://github.com/nikolskiy/tlaplus-cli/issues"
30
+ Homepage = "https://github.com/nikolskiy/tlaup"
31
+ Repository = "https://github.com/nikolskiy/tlaup"
32
+ "Old repository" = "https://github.com/nikolskiy/tlaplus-cli"
39
33
  Changelog = "https://github.com/nikolskiy/tlaplus-cli/blob/main/CHANGELOG.md"
40
34
 
41
35
  [project.scripts]
@@ -47,7 +41,6 @@ include = ["tlaplus_cli*"]
47
41
 
48
42
  [tool.setuptools.package-data]
49
43
  tlaplus_cli = ["py.typed"]
50
- "tlaplus_cli.resources" = ["*.yaml"]
51
44
 
52
45
  [dependency-groups]
53
46
  dev = [
@@ -0,0 +1 @@
1
+ """tlaplus-cli was renamed to tlaup. This package only forwards the old ``tla`` command to tlaup."""
@@ -0,0 +1,16 @@
1
+ """The ``tla`` command: print a notice, then run the same command through tlaup."""
2
+
3
+ import sys
4
+
5
+ NOTICE = (
6
+ "Notice: tlaplus-cli is now called tlaup and is no longer maintained. "
7
+ "Switch with 'uv tool uninstall tlaplus-cli && uv tool install tlaup', then use 'tlaup' instead of 'tla'."
8
+ )
9
+
10
+
11
+ def main() -> None:
12
+ """Entry point for [project.scripts]."""
13
+ print(NOTICE, file=sys.stderr)
14
+ from tlaup.cli import main as tlaup_main # noqa: PLC0415
15
+
16
+ tlaup_main()
@@ -0,0 +1,41 @@
1
+ Metadata-Version: 2.4
2
+ Name: tlaplus-cli
3
+ Version: 0.8.3
4
+ Summary: Renamed to tlaup. This package only installs tlaup and forwards the old tla command to it.
5
+ Author-email: Denis Nikolskiy <nikolskiy@users.noreply.github.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/nikolskiy/tlaup
8
+ Project-URL: Repository, https://github.com/nikolskiy/tlaup
9
+ Project-URL: Old repository, https://github.com/nikolskiy/tlaplus-cli
10
+ Project-URL: Changelog, https://github.com/nikolskiy/tlaplus-cli/blob/main/CHANGELOG.md
11
+ Classifier: Development Status :: 7 - Inactive
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Topic :: Software Development :: Build Tools
18
+ Classifier: Topic :: Utilities
19
+ Requires-Python: >=3.11
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: tlaup>=0.8.2
23
+ Dynamic: license-file
24
+
25
+ # tlaplus-cli has moved to tlaup
26
+
27
+ This project is now **tlaup**.
28
+
29
+ * Repository: https://github.com/nikolskiy/tlaup
30
+ * PyPI: https://pypi.org/project/tlaup/
31
+
32
+ `tlaplus-cli` is no longer maintained, and this repository is archived. The last release, 0.8.3, contains no code of its own: it installs `tlaup` and keeps the old `tla` command working by printing a notice and running the same command through `tlaup`.
33
+
34
+ ## Switching
35
+
36
+ ```bash
37
+ uv tool uninstall tlaplus-cli
38
+ uv tool install tlaup
39
+ ```
40
+
41
+ Then use `tlaup` wherever you used `tla`, for example `tlaup tools install` and `tlaup tlc MySpec`. Installed toolsets, custom modules and the config file stay where they are, so nothing needs to be reinstalled.
@@ -0,0 +1,12 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/tlaplus_cli/__init__.py
5
+ src/tlaplus_cli/cli.py
6
+ src/tlaplus_cli/py.typed
7
+ src/tlaplus_cli.egg-info/PKG-INFO
8
+ src/tlaplus_cli.egg-info/SOURCES.txt
9
+ src/tlaplus_cli.egg-info/dependency_links.txt
10
+ src/tlaplus_cli.egg-info/entry_points.txt
11
+ src/tlaplus_cli.egg-info/requires.txt
12
+ src/tlaplus_cli.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ tlaup>=0.8.2
@@ -1,4 +0,0 @@
1
- include LICENSE
2
- include README.md
3
- recursive-include src/tlaplus_cli/resources *.yaml
4
- include src/tlaplus_cli/py.typed
@@ -1,70 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: tlaplus-cli
3
- Version: 0.8.1
4
- Summary: TLA+ tools: download TLC, compile custom modules, run model checker
5
- Author-email: Denis Nikolskiy <codeomatics@gmail.com>
6
- License-Expression: MIT
7
- Project-URL: Homepage, https://github.com/nikolskiy/tlaplus-cli
8
- Project-URL: Repository, https://github.com/nikolskiy/tlaplus-cli
9
- Project-URL: Issues, https://github.com/nikolskiy/tlaplus-cli/issues
10
- Project-URL: Changelog, https://github.com/nikolskiy/tlaplus-cli/blob/main/CHANGELOG.md
11
- Classifier: Development Status :: 3 - Alpha
12
- Classifier: Programming Language :: Python :: 3
13
- Classifier: Programming Language :: Python :: 3.11
14
- Classifier: Programming Language :: Python :: 3.12
15
- Classifier: Programming Language :: Python :: 3.13
16
- Classifier: Operating System :: OS Independent
17
- Classifier: Topic :: Software Development :: Build Tools
18
- Classifier: Topic :: Utilities
19
- Requires-Python: >=3.11
20
- Description-Content-Type: text/markdown
21
- License-File: LICENSE
22
- Requires-Dist: typer<1.0.0,>=0.22.0
23
- Requires-Dist: requests<3.0.0,>=2.31.0
24
- Requires-Dist: pyyaml<7.0,>=6.0
25
- Requires-Dist: platformdirs<5.0,>=4.0
26
- Requires-Dist: pydantic<3.0.0,>=2.12.5
27
- Requires-Dist: truststore<1.0.0,>=0.9.0
28
- Requires-Dist: rich<14.0.0,>=13.7.0
29
- Dynamic: license-file
30
-
31
- # TLA+ CLI
32
-
33
- Command-line tool for working with TLA+ specifications and the TLC model checker.
34
-
35
- ## Project Goals
36
-
37
- 1. Simplify managing TLA+ tools such as TLC, community modules, custom modules, etc.
38
- 2. Run TLA tools in a single CLI interface.
39
- 3. Manage and display the tool outputs.
40
-
41
- ## Quick Start & Usage
42
-
43
- ### 1. Toolset Management (`tla tools`)
44
- * `tla check-java`: Verify Java installation and compatibility.
45
- * `tla tools list`: List available and installed toolset versions (`tla2tools.jar`).
46
- * `tla tools install [vX.Y.Z]`: Download and install a toolset version.
47
- * `tla tools pin <version>`: Set default toolset version for TLC runs.
48
-
49
- ### 2. Model Checking (`tla tlc`)
50
- * `tla tlc <spec>`: Execute TLC model checker on a specification.
51
- * `tla tlc <spec> --show-command`: Inspect exact JVM command before execution.
52
-
53
- ### 3. Custom Java Modules (`tla modules`)
54
- * `tla modules add <path>`: Compile Java operator overrides and register module in CLI cache.
55
- * `tla modules list`: Display cached custom modules.
56
- * `tla modules remove <name>`: Remove custom module from cache.
57
-
58
- For complete, runnable specifications and Java module examples, see [docs/examples](docs/examples/).
59
-
60
- ## Quick Installation
61
-
62
- ### Via `uv tool`
63
- ```bash
64
- uv tool install tlaplus-cli
65
- ```
66
-
67
- ### Via Nix Flakes
68
- ```bash
69
- nix profile install github:nikolskiy/tlaplus-cli
70
- ```
@@ -1,40 +0,0 @@
1
- # TLA+ CLI
2
-
3
- Command-line tool for working with TLA+ specifications and the TLC model checker.
4
-
5
- ## Project Goals
6
-
7
- 1. Simplify managing TLA+ tools such as TLC, community modules, custom modules, etc.
8
- 2. Run TLA tools in a single CLI interface.
9
- 3. Manage and display the tool outputs.
10
-
11
- ## Quick Start & Usage
12
-
13
- ### 1. Toolset Management (`tla tools`)
14
- * `tla check-java`: Verify Java installation and compatibility.
15
- * `tla tools list`: List available and installed toolset versions (`tla2tools.jar`).
16
- * `tla tools install [vX.Y.Z]`: Download and install a toolset version.
17
- * `tla tools pin <version>`: Set default toolset version for TLC runs.
18
-
19
- ### 2. Model Checking (`tla tlc`)
20
- * `tla tlc <spec>`: Execute TLC model checker on a specification.
21
- * `tla tlc <spec> --show-command`: Inspect exact JVM command before execution.
22
-
23
- ### 3. Custom Java Modules (`tla modules`)
24
- * `tla modules add <path>`: Compile Java operator overrides and register module in CLI cache.
25
- * `tla modules list`: Display cached custom modules.
26
- * `tla modules remove <name>`: Remove custom module from cache.
27
-
28
- For complete, runnable specifications and Java module examples, see [docs/examples](docs/examples/).
29
-
30
- ## Quick Installation
31
-
32
- ### Via `uv tool`
33
- ```bash
34
- uv tool install tlaplus-cli
35
- ```
36
-
37
- ### Via Nix Flakes
38
- ```bash
39
- nix profile install github:nikolskiy/tlaplus-cli
40
- ```
@@ -1,6 +0,0 @@
1
- import truststore
2
-
3
- # Inject truststore as early as possible so that all standard library
4
- # and third-party tools relying on `ssl` (such as `requests` and `urllib3`)
5
- # utilize the native OS trust store.
6
- truststore.inject_into_ssl()
File without changes
@@ -1,28 +0,0 @@
1
- import json
2
- from dataclasses import asdict
3
- from pathlib import Path
4
-
5
- from tlaplus_cli.ui import warn
6
- from tlaplus_cli.versioning.schema import RemoteVersion
7
-
8
-
9
- def load_github_cache(cache_file: Path) -> list[RemoteVersion] | None:
10
- """Load the remote versions cache from disk."""
11
- if cache_file.exists():
12
- try:
13
- with cache_file.open("r", encoding="utf-8") as f:
14
- data = json.load(f)
15
- return [RemoteVersion(**item) for item in data]
16
- except (json.JSONDecodeError, OSError, KeyError, TypeError) as e:
17
- warn(f"Failed to read cache: {e}")
18
- return None
19
-
20
-
21
- def save_github_cache(cache_file: Path, versions: list[RemoteVersion]) -> None:
22
- """Save the remote versions cache to disk."""
23
- try:
24
- cache_file.parent.mkdir(parents=True, exist_ok=True)
25
- with cache_file.open("w", encoding="utf-8") as f:
26
- json.dump([asdict(v) for v in versions], f)
27
- except OSError as e:
28
- warn(f"Failed to save cache: {e}")
@@ -1,62 +0,0 @@
1
- """TLA+ CLI tool - entry point."""
2
-
3
- import importlib.metadata
4
-
5
- import typer
6
-
7
- from tlaplus_cli.cmd.check_java import check_java
8
- from tlaplus_cli.cmd.config import app as config_app
9
- from tlaplus_cli.cmd.fetch_cache import app as fetch_cache_app
10
- from tlaplus_cli.cmd.modules import app as modules_app
11
- from tlaplus_cli.cmd.tlc import tlc as run_tlc_cmd
12
- from tlaplus_cli.cmd.tools import app as tools_app
13
- from tlaplus_cli.config.loader import load_config
14
- from tlaplus_cli.versioning import get_app_version
15
-
16
- app = typer.Typer(
17
- name="tla",
18
- help="TLA+ tools: download TLA+ toolset distribution, compile custom modules, run model checker.",
19
- no_args_is_help=True,
20
- add_completion=False,
21
- )
22
-
23
-
24
- def version_callback(value: bool) -> None:
25
- if value:
26
- meta = importlib.metadata.metadata("tlaplus-cli")
27
- app_ver = get_app_version(base_version=meta["Version"])
28
- typer.echo(f"{meta['Name']} v{app_ver}")
29
- typer.echo(meta["Summary"])
30
- raise typer.Exit()
31
-
32
-
33
- @app.callback()
34
- def root(
35
- _: bool = typer.Option(
36
- None,
37
- "--version",
38
- "-v",
39
- help="Show the application's version and exit.",
40
- callback=version_callback,
41
- is_eager=True,
42
- ),
43
- ) -> None:
44
- """TLA+ CLI tool."""
45
- # Load config early to trigger first-run copy
46
- load_config()
47
-
48
-
49
- # --- Subcommands ---
50
-
51
- app.add_typer(modules_app, name="modules")
52
- app.add_typer(tools_app, name="tools")
53
- app.add_typer(fetch_cache_app, name="fetch-cache")
54
- app.add_typer(config_app, name="config")
55
-
56
- app.command(name="tlc")(run_tlc_cmd)
57
- app.command(name="check-java")(check_java)
58
-
59
-
60
- def main() -> None:
61
- """Entry point for [project.scripts]."""
62
- app()
File without changes
@@ -1,19 +0,0 @@
1
- import typer
2
-
3
- from tlaplus_cli.config.loader import load_config
4
- from tlaplus_cli.java import get_java_version, validate_java_version
5
-
6
-
7
- def check_java() -> None:
8
- """Check if Java is installed and meets the minimum version requirement."""
9
- config = load_config()
10
- version = get_java_version()
11
- if version:
12
- typer.echo(f"Detected Java version: {version}")
13
-
14
- try:
15
- validate_java_version(config.java.min_version)
16
- typer.echo(f"Java version is compatible (>= {config.java.min_version}).")
17
- except RuntimeError as e:
18
- typer.echo(f"Error: {e}", err=True)
19
- raise typer.Exit(1) from None
@@ -1,6 +0,0 @@
1
- import typer
2
-
3
- app = typer.Typer(name="config", help="Manage application configuration.", no_args_is_help=True)
4
-
5
- from . import edit # noqa: F401, E402
6
- from . import list as list_cmd # noqa: F401, E402
@@ -1,34 +0,0 @@
1
- import os
2
- import shutil
3
- import subprocess
4
-
5
- import typer
6
-
7
- from tlaplus_cli.cmd.config import app
8
- from tlaplus_cli.config.loader import config_path, load_config
9
-
10
-
11
- @app.command(name="edit")
12
- def edit_config(
13
- editor: str | None = typer.Argument(None, help="The editor to use (defaults to $EDITOR or 'vim')."),
14
- ) -> None:
15
- """Open the configuration file in an editor."""
16
- cp = config_path()
17
-
18
- # Ensure config exists by loading it
19
- load_config()
20
-
21
- if not editor:
22
- editor = os.environ.get("EDITOR", "vim")
23
-
24
- editor_path = shutil.which(editor)
25
- if not editor_path:
26
- typer.echo(f"Error: Editor '{editor}' not found in PATH.", err=True)
27
- raise typer.Exit(1)
28
-
29
- typer.echo(f"Opening {cp} with {editor} ...")
30
- try:
31
- subprocess.run([editor_path, str(cp)], check=True)
32
- except subprocess.CalledProcessError as e:
33
- typer.echo(f"Editor exited with error: {e}", err=True)
34
- raise typer.Exit(1) from None
@@ -1,16 +0,0 @@
1
- import typer
2
-
3
- from tlaplus_cli.cmd.config import app
4
- from tlaplus_cli.config.loader import config_path
5
-
6
-
7
- @app.command(name="list")
8
- def list_config() -> None:
9
- """Display the current configuration file content."""
10
- cp = config_path()
11
- if not cp.exists():
12
- typer.echo("Configuration file not found.", err=True)
13
- raise typer.Exit(1)
14
-
15
- with cp.open(encoding="utf-8") as f:
16
- typer.echo(f.read())
@@ -1,5 +0,0 @@
1
- import typer
2
-
3
- app = typer.Typer(name="fetch-cache", help="Manage API fetch cache.", no_args_is_help=True)
4
-
5
- from . import clear # noqa: F401, E402
@@ -1,11 +0,0 @@
1
- import typer
2
-
3
- from tlaplus_cli.cmd.fetch_cache import app
4
- from tlaplus_cli.versioning import clear_cache
5
-
6
-
7
- @app.command(name="clear")
8
- def cmd_clear_cache() -> None:
9
- """Clear the local cache of remote GitHub versions."""
10
- clear_cache()
11
- typer.echo("GitHub versions cache cleared.")
@@ -1,16 +0,0 @@
1
- import typer
2
-
3
- app = typer.Typer(name="modules", help="Manage TLA+ Java modules.", no_args_is_help=True)
4
-
5
-
6
- # Import functions for new commands
7
- from .add import add_module # noqa: E402
8
- from .list import list_modules # noqa: E402
9
- from .path import show_modules_path # noqa: E402
10
- from .remove import remove_module # noqa: E402
11
-
12
- # Register new commands with the typer app
13
- app.command(name="add")(add_module)
14
- app.command(name="list")(list_modules)
15
- app.command(name="remove")(remove_module)
16
- app.command(name="path")(show_modules_path)
@@ -1,140 +0,0 @@
1
- import datetime
2
- import json
3
- import os
4
- import re
5
- import shutil
6
- import subprocess
7
- from pathlib import Path
8
-
9
- import typer
10
-
11
- from tlaplus_cli.config.loader import load_config
12
- from tlaplus_cli.java.classpath import ClasspathResolver, ResolveMode
13
- from tlaplus_cli.tlc.compiler import get_tlc_jar_path
14
- from tlaplus_cli.tlc.run_cache import clear_tlc_run_cache
15
- from tlaplus_cli.versioning.paths import get_modules_dir
16
-
17
-
18
- def find_override_classes(java_files: list[Path]) -> list[str]:
19
- """Find all class names implementing ITLCOverrides in Java files."""
20
- override_classes = []
21
- package_pattern = re.compile(r"package\s+([a-zA-Z0-9_.]+)\s*;")
22
- class_pattern = re.compile(
23
- r"\bclass\s+([a-zA-Z0-9_]+)\b[^{]*\bimplements\b[^{]*\b(tlc2\.overrides\.)?ITLCOverrides\b"
24
- )
25
-
26
- for jf in java_files:
27
- try:
28
- content = jf.read_text(encoding="utf-8", errors="ignore")
29
- except OSError:
30
- continue
31
-
32
- # Strip comments to prevent false matches
33
- content_no_comments = re.sub(r"//.*", "", content)
34
- content_no_comments = re.sub(r"/\*.*?\*/", "", content_no_comments, flags=re.DOTALL)
35
-
36
- package_match = package_pattern.search(content_no_comments)
37
- package_name = package_match.group(1) if package_match else ""
38
-
39
- for match in class_pattern.finditer(content_no_comments):
40
- class_name = match.group(1)
41
- full_class_name = f"{package_name}.{class_name}" if package_name else class_name
42
- override_classes.append(full_class_name)
43
-
44
- return override_classes
45
-
46
-
47
- def add_module( # noqa: PLR0912, PLR0915
48
- path: str = typer.Argument(..., help="Path to the module directory to add."),
49
- ) -> None:
50
- """Compile custom Java overrides and add/update the module in the cache."""
51
- source_dir = Path(path).resolve()
52
- if not source_dir.is_dir():
53
- typer.echo(f"Error: Path does not exist or is not a directory: {source_dir}", err=True)
54
- raise typer.Exit(1)
55
-
56
- config = load_config()
57
- module_name = source_dir.name
58
- target_dir = get_modules_dir() / module_name
59
-
60
- # Overwrite if exists
61
- if target_dir.exists():
62
- shutil.rmtree(target_dir)
63
- target_dir.mkdir(parents=True, exist_ok=True)
64
-
65
- # 1. Copy directories (lib, modules, tlc2, and test/tests)
66
- def copy_subfolder(subname: str) -> None:
67
- src = source_dir / subname
68
- if src.is_dir():
69
- shutil.copytree(src, target_dir / subname)
70
-
71
- typer.echo("Copying subfolders (lib, modules, test, tlc2)...")
72
- copy_subfolder("lib")
73
- copy_subfolder("modules")
74
- copy_subfolder("tlc2")
75
-
76
- if (source_dir / "test").is_dir():
77
- copy_subfolder("test")
78
- elif (source_dir / "tests").is_dir():
79
- copy_subfolder("tests")
80
-
81
- # 2. Compile Java overrides in cached version if tlc2/overrides exists
82
- java_files = []
83
- for candidate in [target_dir / "modules" / "tlc2" / "overrides", target_dir / "tlc2" / "overrides"]:
84
- if candidate.is_dir():
85
- java_files.extend(list(candidate.rglob("*.java")))
86
-
87
- if java_files:
88
- # Build classpath including tool_jar and local libs from the cached folder
89
- cached_lib = target_dir / "lib"
90
- extra_libs = []
91
- if cached_lib.is_dir():
92
- extra_libs.extend([str(j.absolute()) for j in cached_lib.glob("*.jar")])
93
-
94
- tool_jar = get_tlc_jar_path()
95
- if not tool_jar.exists():
96
- typer.echo("Error: tla2tools.jar not found. Run 'tla tools install' first.", err=True)
97
- shutil.rmtree(target_dir, ignore_errors=True)
98
- raise typer.Exit(1)
99
-
100
- resolver = ClasspathResolver(config, project_root=None, tool_jar=tool_jar, extra_libs=extra_libs)
101
- classpath = os.pathsep.join(resolver.resolve(ResolveMode.COMPILE))
102
-
103
- classes_dir = target_dir / "classes"
104
- classes_dir.mkdir(parents=True, exist_ok=True)
105
-
106
- cmd = ["javac", "-cp", classpath, "-d", str(classes_dir), *[str(f) for f in java_files]]
107
- typer.echo("Compiling Java files in cached tlc2/overrides...")
108
- try:
109
- subprocess.run(cmd, check=True, capture_output=True, text=True)
110
- except FileNotFoundError as err:
111
- typer.echo("Error: 'javac' not found. Ensure JDK is installed.", err=True)
112
- shutil.rmtree(target_dir, ignore_errors=True)
113
- raise typer.Exit(1) from err
114
- except subprocess.CalledProcessError as err:
115
- typer.echo("Compilation failed!", err=True)
116
- typer.echo(err.stdout, err=True)
117
- typer.echo(err.stderr, err=True)
118
- shutil.rmtree(target_dir, ignore_errors=True)
119
- raise typer.Exit(1) from err
120
-
121
- # Write service file
122
- meta_inf = classes_dir / "META-INF" / "services"
123
- meta_inf.mkdir(parents=True, exist_ok=True)
124
- service_file = meta_inf / "tlc2.overrides.ITLCOverrides"
125
-
126
- override_classes = find_override_classes(java_files)
127
- if not override_classes:
128
- override_classes = [config.tlc.overrides_class]
129
-
130
- with service_file.open("w") as f:
131
- for cls in override_classes:
132
- f.write(f"{cls}\n")
133
-
134
- # 3. Create metadata.json
135
- metadata = {"name": module_name, "built_at": datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")}
136
- with (target_dir / "metadata.json").open("w") as f:
137
- json.dump(metadata, f, indent=2)
138
-
139
- clear_tlc_run_cache()
140
- typer.echo(f"Module '{module_name}' successfully added to cache.")