sysml2tikz 0.0.1__tar.gz → 0.0.2__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 (24) hide show
  1. {sysml2tikz-0.0.1 → sysml2tikz-0.0.2}/PKG-INFO +15 -6
  2. {sysml2tikz-0.0.1 → sysml2tikz-0.0.2}/README.md +14 -5
  3. {sysml2tikz-0.0.1 → sysml2tikz-0.0.2}/pyproject.toml +1 -1
  4. {sysml2tikz-0.0.1 → sysml2tikz-0.0.2}/src/sysml2tikz/__init__.py +16 -3
  5. {sysml2tikz-0.0.1 → sysml2tikz-0.0.2}/src/sysml2tikz/cli.py +4 -0
  6. sysml2tikz-0.0.2/src/sysml2tikz/install.py +76 -0
  7. {sysml2tikz-0.0.1 → sysml2tikz-0.0.2}/.gitignore +0 -0
  8. {sysml2tikz-0.0.1 → sysml2tikz-0.0.2}/ARCHITECTURE.md +0 -0
  9. {sysml2tikz-0.0.1 → sysml2tikz-0.0.2}/LICENSES/LPPL-1.3c.txt +0 -0
  10. {sysml2tikz-0.0.1 → sysml2tikz-0.0.2}/LICENSES/MPL-2.0.txt +0 -0
  11. {sysml2tikz-0.0.1 → sysml2tikz-0.0.2}/LICENSES/README.md +0 -0
  12. {sysml2tikz-0.0.1 → sysml2tikz-0.0.2}/PIPELINE.md +0 -0
  13. {sysml2tikz-0.0.1 → sysml2tikz-0.0.2}/docs/figures/fig-definition-and-usage.png +0 -0
  14. {sysml2tikz-0.0.1 → sysml2tikz-0.0.2}/docs/figures/fig-from-sysml-model.png +0 -0
  15. {sysml2tikz-0.0.1 → sysml2tikz-0.0.2}/docs/figures/fig-generated-from-ir.png +0 -0
  16. {sysml2tikz-0.0.1 → sysml2tikz-0.0.2}/docs/figures/fig-routed-layout.png +0 -0
  17. {sysml2tikz-0.0.1 → sysml2tikz-0.0.2}/examples/vehicle.sysml +0 -0
  18. {sysml2tikz-0.0.1 → sysml2tikz-0.0.2}/gen/model.json +0 -0
  19. {sysml2tikz-0.0.1 → sysml2tikz-0.0.2}/gen/sysml2tikz.sty +0 -0
  20. {sysml2tikz-0.0.1 → sysml2tikz-0.0.2}/src/sysml2tikz/emit.py +0 -0
  21. {sysml2tikz-0.0.1 → sysml2tikz-0.0.2}/src/sysml2tikz/layout.py +0 -0
  22. {sysml2tikz-0.0.1 → sysml2tikz-0.0.2}/src/sysml2tikz/project.py +0 -0
  23. {sysml2tikz-0.0.1 → sysml2tikz-0.0.2}/sysml2tikz.sty +0 -0
  24. {sysml2tikz-0.0.1 → sysml2tikz-0.0.2}/tools/verify.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: sysml2tikz
3
- Version: 0.0.1
3
+ Version: 0.0.2
4
4
  Summary: SysML v2 notation for LaTeX/TikZ: a .sty notation layer plus a model-to-figure pipeline
5
5
  Project-URL: Homepage, https://github.com/mycr0ft/sysml2tikz
6
6
  Project-URL: Issues, https://github.com/mycr0ft/sysml2tikz/issues
@@ -38,16 +38,25 @@ Two things live here:
38
38
  Two independent doors:
39
39
 
40
40
  ```bash
41
- # LaTeX only — drop the .sty in your document's directory (or install it from CTAN
42
- # once the package is accepted), then:
43
- \usepackage{sysml2tikz}
41
+ # LaTeX only, option A — put the .sty beside your document
42
+ # (from CTAN once the package is accepted, or copy it out of the Python package)
43
+
44
+ # LaTeX only, option B — install once into your TeX user tree, then it is found
45
+ # from every directory, no copying per document:
46
+ pip install sysml2tikz
47
+ sysml2tikz install-sty # -> $TEXMFHOME/tex/latex/sysml2tikz/sysml2tikz.sty
48
+ kpsewhich sysml2tikz.sty # sanity check
44
49
 
45
50
  # Python — the generator; the wheel carries the same .sty
46
51
  pip install sysml2tikz
47
- sysml2tikz emit model.json out.tex --copy-sty # --copy-sty puts the .sty beside the output
48
- tectonic out.tex
52
+ sysml2tikz emit model.json out.tex --copy-sty # portable: .sty lands beside the output
53
+ tectonic out.tex # or pdflatex/lualatex/latexmk
49
54
  ```
50
55
 
56
+ With TeX Live, `install-sty` needs the picture and extra packages present:
57
+ `texlive-pictures` (pgf/TikZ) and `texlive-latex-extra` (`standalone.cls`,
58
+ `xstring`). `tectonic` needs none of that — it fetches what a document uses.
59
+
51
60
  `--copy-sty` exists because tectonic resolves packages from its own bundle rather
52
61
  than from `TEXINPUTS`, and a plain TeX Live only finds `sysml2tikz.sty` after CTAN
53
62
  ships it. For a repo checkout the `gen/*.py` scripts are thin shims over
@@ -16,16 +16,25 @@ Two things live here:
16
16
  Two independent doors:
17
17
 
18
18
  ```bash
19
- # LaTeX only — drop the .sty in your document's directory (or install it from CTAN
20
- # once the package is accepted), then:
21
- \usepackage{sysml2tikz}
19
+ # LaTeX only, option A — put the .sty beside your document
20
+ # (from CTAN once the package is accepted, or copy it out of the Python package)
21
+
22
+ # LaTeX only, option B — install once into your TeX user tree, then it is found
23
+ # from every directory, no copying per document:
24
+ pip install sysml2tikz
25
+ sysml2tikz install-sty # -> $TEXMFHOME/tex/latex/sysml2tikz/sysml2tikz.sty
26
+ kpsewhich sysml2tikz.sty # sanity check
22
27
 
23
28
  # Python — the generator; the wheel carries the same .sty
24
29
  pip install sysml2tikz
25
- sysml2tikz emit model.json out.tex --copy-sty # --copy-sty puts the .sty beside the output
26
- tectonic out.tex
30
+ sysml2tikz emit model.json out.tex --copy-sty # portable: .sty lands beside the output
31
+ tectonic out.tex # or pdflatex/lualatex/latexmk
27
32
  ```
28
33
 
34
+ With TeX Live, `install-sty` needs the picture and extra packages present:
35
+ `texlive-pictures` (pgf/TikZ) and `texlive-latex-extra` (`standalone.cls`,
36
+ `xstring`). `tectonic` needs none of that — it fetches what a document uses.
37
+
29
38
  `--copy-sty` exists because tectonic resolves packages from its own bundle rather
30
39
  than from `TEXINPUTS`, and a plain TeX Live only finds `sysml2tikz.sty` after CTAN
31
40
  ships it. For a repo checkout the `gen/*.py` scripts are thin shims over
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "sysml2tikz"
7
- version = "0.0.1"
7
+ version = "0.0.2"
8
8
  description = "SysML v2 notation for LaTeX/TikZ: a .sty notation layer plus a model-to-figure pipeline"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -14,12 +14,25 @@ Two halves, usable separately:
14
14
  Nothing here is required to use the ``.sty``, and the ``.sty`` is not required
15
15
  to emit IR.
16
16
  """
17
+ import os
17
18
  from importlib.resources import files
18
19
 
19
- __version__ = "0.0.1"
20
+ __version__ = "0.0.2"
20
21
 
21
22
  def sty_path() -> str:
22
- """Absolute path of the bundled ``sysml2tikz.sty`` (for TEXINPUTS)."""
23
- return str(files(__name__).joinpath("sysml2tikz.sty"))
23
+ """Absolute path of ``sysml2tikz.sty``.
24
+
25
+ An installed wheel carries the file inside the package (force-included at
26
+ build time from the repo root); a source checkout does not, so fall back to
27
+ the canonical file at the repo root.
28
+ """
29
+ packaged = files(__name__).joinpath("sysml2tikz.sty")
30
+ if packaged.is_file():
31
+ return str(packaged)
32
+ root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
33
+ candidate = os.path.join(root, "sysml2tikz.sty")
34
+ if os.path.isfile(candidate):
35
+ return candidate
36
+ raise FileNotFoundError("sysml2tikz.sty not found (installed package or repo root)")
24
37
 
25
38
  __all__ = ["__version__", "sty_path"]
@@ -6,6 +6,7 @@
6
6
  sysml2tikz layout model.json out.tex IR -> measured + routed .tex
7
7
  sysml2tikz project model.sysml out.json SysML v2 text -> IR
8
8
  sysml2tikz sty print the bundled .sty path
9
+ sysml2tikz install-sty copy it into TEXMFHOME (TeX Live/MiKTeX)
9
10
  sysml2tikz version
10
11
  """
11
12
  from __future__ import annotations
@@ -32,6 +33,9 @@ def main(argv: list[str] | None = None) -> int:
32
33
  from . import sty_path
33
34
  print(sty_path())
34
35
  return 0
36
+ if cmd == "install-sty":
37
+ from .install import install
38
+ return install(rest)
35
39
  if cmd == "emit":
36
40
  from .emit import main as run
37
41
  return run(["emit"] + rest)
@@ -0,0 +1,76 @@
1
+ # SPDX-License-Identifier: MPL-2.0
2
+ # Copyright (c) 2026 Jon R. Fox and Hermes Agent
3
+ """Install the bundled ``sysml2tikz.sty`` where a TeX distribution will find it.
4
+
5
+ `--copy-sty` is the zero-configuration route (the file lands beside your
6
+ document). This is the other one: put it in the user tree once, then
7
+ ``\\usepackage{sysml2tikz}`` works from every document, in every directory.
8
+
9
+ Target is ``$TEXMFHOME/tex/latex/sysml2tikz/sysml2tikz.sty`` where TEXMFHOME comes
10
+ from ``kpsewhich -var-value TEXMFHOME`` (usually ``~/texmf``). No sudo anywhere —
11
+ a system-wide install belongs to the distribution package manager or CTAN.
12
+ """
13
+ from __future__ import annotations
14
+
15
+ import os
16
+ import shutil
17
+ import subprocess
18
+ import sys
19
+
20
+ TEX_SUBDIR = os.path.join("tex", "latex", "sysml2tikz")
21
+
22
+
23
+ def texmfhome() -> str:
24
+ try:
25
+ out = subprocess.run(["kpsewhich", "-var-value", "TEXMFHOME"],
26
+ capture_output=True, text=True, timeout=30)
27
+ path = out.stdout.strip()
28
+ if path:
29
+ return os.path.expanduser(path)
30
+ except (FileNotFoundError, subprocess.SubprocessError):
31
+ pass
32
+ return os.path.expanduser("~/texmf")
33
+
34
+
35
+ def install(argv: list[str]) -> int:
36
+ dest_root = texmfhome()
37
+ force = "--force" in argv
38
+ from . import sty_path
39
+
40
+ src = sty_path()
41
+ dest_dir = os.path.join(dest_root, TEX_SUBDIR)
42
+ dest = os.path.join(dest_dir, "sysml2tikz.sty")
43
+
44
+ if os.path.exists(dest) and not force:
45
+ same = open(src, "rb").read() == open(dest, "rb").read()
46
+ print("%s %s" % ("already current:" if same else "differs (use --force):", dest))
47
+ return 0 if same else 1
48
+
49
+ os.makedirs(dest_dir, exist_ok=True)
50
+ shutil.copyfile(src, dest)
51
+ # a user tree without ls-R is still searched, but refreshing costs nothing
52
+ for cmd in (["texhash", dest_root], ["mktexlsr", dest_root]):
53
+ try:
54
+ r = subprocess.run(cmd, capture_output=True, text=True, timeout=120)
55
+ if r.returncode == 0:
56
+ break
57
+ except (FileNotFoundError, subprocess.SubprocessError):
58
+ continue
59
+
60
+ print("installed", dest)
61
+ try:
62
+ found = subprocess.run(["kpsewhich", "sysml2tikz.sty"],
63
+ capture_output=True, text=True, timeout=30).stdout.strip()
64
+ except (FileNotFoundError, subprocess.SubprocessError):
65
+ found = ""
66
+ if found:
67
+ print("kpsewhich resolves sysml2tikz.sty ->", found)
68
+ return 0
69
+ print("note: kpsewhich does not see it yet. TEXMFHOME is %s — check that your TeX\n"
70
+ "distribution searches the user tree (TeX Live does by default; MiKTeX needs\n"
71
+ "the directory registered in its settings)." % dest_root)
72
+ return 0
73
+
74
+
75
+ if __name__ == "__main__":
76
+ raise SystemExit(install(sys.argv[1:]))
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes