tikzpics 0.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.
- tikzpics-0.1/PKG-INFO +60 -0
- tikzpics-0.1/README.md +28 -0
- tikzpics-0.1/pyproject.toml +54 -0
- tikzpics-0.1/setup.cfg +4 -0
- tikzpics-0.1/src/tikzpics/__init__.py +4 -0
- tikzpics-0.1/src/tikzpics/base.py +55 -0
- tikzpics-0.1/src/tikzpics/color.py +14 -0
- tikzpics-0.1/src/tikzpics/console/__init__.py +0 -0
- tikzpics-0.1/src/tikzpics/console/main.py +6 -0
- tikzpics-0.1/src/tikzpics/coordinate.py +43 -0
- tikzpics-0.1/src/tikzpics/figure.py +608 -0
- tikzpics-0.1/src/tikzpics/layer.py +70 -0
- tikzpics-0.1/src/tikzpics/linestyle.py +58 -0
- tikzpics-0.1/src/tikzpics/loop.py +60 -0
- tikzpics-0.1/src/tikzpics/node.py +88 -0
- tikzpics-0.1/src/tikzpics/path.py +106 -0
- tikzpics-0.1/src/tikzpics/plot.py +49 -0
- tikzpics-0.1/src/tikzpics/tests/unit/__init__.py +0 -0
- tikzpics-0.1/src/tikzpics/tests/unit/test_app.py +8 -0
- tikzpics-0.1/src/tikzpics/tests/unit/test_tikz_generation.py +72 -0
- tikzpics-0.1/src/tikzpics/variable.py +21 -0
- tikzpics-0.1/src/tikzpics/wrapper.py +10 -0
- tikzpics-0.1/src/tikzpics.egg-info/PKG-INFO +60 -0
- tikzpics-0.1/src/tikzpics.egg-info/SOURCES.txt +25 -0
- tikzpics-0.1/src/tikzpics.egg-info/dependency_links.txt +1 -0
- tikzpics-0.1/src/tikzpics.egg-info/requires.txt +24 -0
- tikzpics-0.1/src/tikzpics.egg-info/top_level.txt +1 -0
tikzpics-0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tikzpics
|
|
3
|
+
Version: 0.1
|
|
4
|
+
Summary: Python interface to generate (readable) Tikz figures.
|
|
5
|
+
Author: Max
|
|
6
|
+
Project-URL: Source, https://github.com/max-models/tikzpics
|
|
7
|
+
Keywords: python
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Requires-Python: >=3.8
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
Requires-Dist: pymupdf
|
|
12
|
+
Provides-Extra: test
|
|
13
|
+
Requires-Dist: pytest; extra == "test"
|
|
14
|
+
Requires-Dist: coverage; extra == "test"
|
|
15
|
+
Provides-Extra: dev
|
|
16
|
+
Requires-Dist: tikzpics[test]; extra == "dev"
|
|
17
|
+
Requires-Dist: black[jupyter]; extra == "dev"
|
|
18
|
+
Requires-Dist: isort; extra == "dev"
|
|
19
|
+
Requires-Dist: ruff; extra == "dev"
|
|
20
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
21
|
+
Requires-Dist: pyproject-fmt; extra == "dev"
|
|
22
|
+
Requires-Dist: jupyterlab; extra == "dev"
|
|
23
|
+
Requires-Dist: ipykernel; extra == "dev"
|
|
24
|
+
Requires-Dist: numpy; extra == "dev"
|
|
25
|
+
Requires-Dist: scipy; extra == "dev"
|
|
26
|
+
Provides-Extra: docs
|
|
27
|
+
Requires-Dist: myst-parser; extra == "docs"
|
|
28
|
+
Requires-Dist: nbconvert; extra == "docs"
|
|
29
|
+
Requires-Dist: nbsphinx; extra == "docs"
|
|
30
|
+
Requires-Dist: sphinx; extra == "docs"
|
|
31
|
+
Requires-Dist: sphinx_bootstrap_theme; extra == "docs"
|
|
32
|
+
|
|
33
|
+
# tikzpics
|
|
34
|
+
|
|
35
|
+
Python interface to generate (readable) Tikz figures.
|
|
36
|
+
|
|
37
|
+
Documentation: https://max-models.github.io/tikzpics/
|
|
38
|
+
|
|
39
|
+
# Install
|
|
40
|
+
|
|
41
|
+
Create and activate python environment
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
python -m venv env
|
|
45
|
+
source env/bin/activate
|
|
46
|
+
pip install --upgrade pip
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Install the code and requirements with pip
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
pip install -e .
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
To install optional dependencies:
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
pip install -e ".[test]" # For pytest
|
|
59
|
+
pip install -e ".[dev]" For developers
|
|
60
|
+
```
|
tikzpics-0.1/README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# tikzpics
|
|
2
|
+
|
|
3
|
+
Python interface to generate (readable) Tikz figures.
|
|
4
|
+
|
|
5
|
+
Documentation: https://max-models.github.io/tikzpics/
|
|
6
|
+
|
|
7
|
+
# Install
|
|
8
|
+
|
|
9
|
+
Create and activate python environment
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
python -m venv env
|
|
13
|
+
source env/bin/activate
|
|
14
|
+
pip install --upgrade pip
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Install the code and requirements with pip
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
pip install -e .
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
To install optional dependencies:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
pip install -e ".[test]" # For pytest
|
|
27
|
+
pip install -e ".[dev]" For developers
|
|
28
|
+
```
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "tikzpics"
|
|
7
|
+
version = "0.1"
|
|
8
|
+
description = "Python interface to generate (readable) Tikz figures."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
license = {file = "LICENSE.txt"}
|
|
12
|
+
keywords = ["python"]
|
|
13
|
+
authors = [{name = "Max"}]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 3 - Alpha",
|
|
16
|
+
]
|
|
17
|
+
dependencies = [
|
|
18
|
+
"pymupdf",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[project.optional-dependencies]
|
|
22
|
+
|
|
23
|
+
test = [
|
|
24
|
+
"pytest",
|
|
25
|
+
"coverage",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
dev = [
|
|
29
|
+
"tikzpics[test]",
|
|
30
|
+
"black[jupyter]",
|
|
31
|
+
"isort",
|
|
32
|
+
"ruff",
|
|
33
|
+
"pre-commit",
|
|
34
|
+
"pyproject-fmt",
|
|
35
|
+
"jupyterlab",
|
|
36
|
+
"ipykernel",
|
|
37
|
+
"numpy",
|
|
38
|
+
"scipy",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
# https://medium.com/@pratikdomadiya123/build-project-documentation-quickly-with-the-sphinx-python-2a9732b66594
|
|
42
|
+
docs = [
|
|
43
|
+
"myst-parser",
|
|
44
|
+
"nbconvert",
|
|
45
|
+
"nbsphinx",
|
|
46
|
+
"sphinx",
|
|
47
|
+
"sphinx_bootstrap_theme",
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
[project.urls]
|
|
51
|
+
"Source" = "https://github.com/max-models/tikzpics"
|
|
52
|
+
|
|
53
|
+
[tool.setuptools.packages.find]
|
|
54
|
+
where = ["src"]
|
tikzpics-0.1/setup.cfg
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
class TikzObject:
|
|
2
|
+
def __init__(
|
|
3
|
+
self,
|
|
4
|
+
label: str | None = None,
|
|
5
|
+
comment: str | None = None,
|
|
6
|
+
layer: int | None = 0,
|
|
7
|
+
options: list | None = None,
|
|
8
|
+
**kwargs,
|
|
9
|
+
) -> None:
|
|
10
|
+
|
|
11
|
+
if options is None:
|
|
12
|
+
options = []
|
|
13
|
+
|
|
14
|
+
self._label = label
|
|
15
|
+
self._comment = comment
|
|
16
|
+
self._layer = layer
|
|
17
|
+
self._options = options
|
|
18
|
+
self._kwargs = kwargs
|
|
19
|
+
|
|
20
|
+
@property
|
|
21
|
+
def label(self) -> str | None:
|
|
22
|
+
return self._label
|
|
23
|
+
|
|
24
|
+
@property
|
|
25
|
+
def comment(self) -> str | None:
|
|
26
|
+
return self._comment
|
|
27
|
+
|
|
28
|
+
@property
|
|
29
|
+
def layer(self) -> int:
|
|
30
|
+
return self._layer
|
|
31
|
+
|
|
32
|
+
@property
|
|
33
|
+
def options(self) -> list:
|
|
34
|
+
return self._options
|
|
35
|
+
|
|
36
|
+
@property
|
|
37
|
+
def kwargs(self) -> dict:
|
|
38
|
+
return self._kwargs
|
|
39
|
+
|
|
40
|
+
@property
|
|
41
|
+
def tikz_options(self) -> str:
|
|
42
|
+
if len(self.options) == 0:
|
|
43
|
+
options = ""
|
|
44
|
+
else:
|
|
45
|
+
options = ", ".join(self.options) + ", "
|
|
46
|
+
|
|
47
|
+
options += ", ".join(
|
|
48
|
+
f"{k.replace('_', ' ')}={v}" for k, v in self.kwargs.items()
|
|
49
|
+
)
|
|
50
|
+
return options
|
|
51
|
+
|
|
52
|
+
def add_comment(self, string_in) -> str:
|
|
53
|
+
if self.comment is not None:
|
|
54
|
+
return f"\n% {self.comment}\n{string_in}"
|
|
55
|
+
return string_in
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
class Color:
|
|
2
|
+
def __init__(self, color_spec):
|
|
3
|
+
"""
|
|
4
|
+
Initialize the Color object by parsing the color specification.
|
|
5
|
+
|
|
6
|
+
Parameters:
|
|
7
|
+
- color_spec: Can be a TikZ color string (e.g., 'blue!20'), a standard color name,
|
|
8
|
+
an RGB tuple, a hex code, etc.
|
|
9
|
+
"""
|
|
10
|
+
self._color_spec = color_spec
|
|
11
|
+
|
|
12
|
+
@property
|
|
13
|
+
def color_spec(self):
|
|
14
|
+
return self._color_spec
|
|
File without changes
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from tikzpics.base import TikzObject
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class TikzCoordinate(TikzObject):
|
|
5
|
+
def __init__(
|
|
6
|
+
self,
|
|
7
|
+
x: float,
|
|
8
|
+
y: float,
|
|
9
|
+
z: float | None = None,
|
|
10
|
+
layer: int = 0,
|
|
11
|
+
) -> None:
|
|
12
|
+
super().__init__(layer=layer, comment=None)
|
|
13
|
+
|
|
14
|
+
self._x = x
|
|
15
|
+
self._y = y
|
|
16
|
+
self._z = z
|
|
17
|
+
if z is None:
|
|
18
|
+
self._ndim = 2
|
|
19
|
+
else:
|
|
20
|
+
self._ndim = 3
|
|
21
|
+
|
|
22
|
+
@property
|
|
23
|
+
def x(self):
|
|
24
|
+
return self._x
|
|
25
|
+
|
|
26
|
+
@property
|
|
27
|
+
def y(self):
|
|
28
|
+
return self._y
|
|
29
|
+
|
|
30
|
+
@property
|
|
31
|
+
def z(self):
|
|
32
|
+
return self._z
|
|
33
|
+
|
|
34
|
+
@property
|
|
35
|
+
def coordinate(self):
|
|
36
|
+
if self.ndim == 2:
|
|
37
|
+
return ((self.x), self.y)
|
|
38
|
+
else:
|
|
39
|
+
return (self.x, self.y, self.z)
|
|
40
|
+
|
|
41
|
+
@property
|
|
42
|
+
def ndim(self):
|
|
43
|
+
return self._ndim
|