figkit 0.1.0__py3-none-any.whl
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.
- figkit/__init__.py +114 -0
- figkit/audit.py +611 -0
- figkit/colors.py +304 -0
- figkit/component.py +110 -0
- figkit/components.py +727 -0
- figkit/connectors.py +689 -0
- figkit/core.py +1021 -0
- figkit/export.py +301 -0
- figkit/figure.py +312 -0
- figkit/fonts.py +462 -0
- figkit/frame.py +376 -0
- figkit/geom.py +497 -0
- figkit/image.py +308 -0
- figkit/layout.py +529 -0
- figkit/mathtext.py +320 -0
- figkit/paint.py +136 -0
- figkit/py.typed +0 -0
- figkit/shapes.py +764 -0
- figkit/style.py +502 -0
- figkit/svgdoc.py +133 -0
- figkit/svgpath.py +470 -0
- figkit/text.py +625 -0
- figkit/themes.py +163 -0
- figkit-0.1.0.dist-info/METADATA +277 -0
- figkit-0.1.0.dist-info/RECORD +28 -0
- figkit-0.1.0.dist-info/WHEEL +5 -0
- figkit-0.1.0.dist-info/licenses/LICENSE +21 -0
- figkit-0.1.0.dist-info/top_level.txt +1 -0
figkit/__init__.py
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"""figkit — design figures with Python code, export to SVG/PNG/PDF/HTML.
|
|
2
|
+
|
|
3
|
+
Quick start::
|
|
4
|
+
|
|
5
|
+
from figkit import *
|
|
6
|
+
|
|
7
|
+
with Figure(pad=24) as fig:
|
|
8
|
+
a = Box("Encoder", style="block", w=120)
|
|
9
|
+
b = Box("Decoder", style="blue").right_of(a, gap=60)
|
|
10
|
+
arrow(a.e, b.w, label="z")
|
|
11
|
+
fig.save("figure.svg")
|
|
12
|
+
|
|
13
|
+
Everything is explicit: you place things, figkit measures them accurately
|
|
14
|
+
(real font metrics), and anchors stay live so arrows follow their boxes.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
__version__ = "0.1.0"
|
|
20
|
+
|
|
21
|
+
# -- geometry ---------------------------------------------------------------
|
|
22
|
+
from .geom import Affine, BBox, Point, to_point
|
|
23
|
+
|
|
24
|
+
# -- colour -----------------------------------------------------------------
|
|
25
|
+
from .colors import (COLORMAPS, PALETTES, alpha, colormap, contrast_color,
|
|
26
|
+
darken, desaturate, lighten, luminance, mix, normalize,
|
|
27
|
+
palette, parse_color, rgba, saturate, to_hex)
|
|
28
|
+
|
|
29
|
+
# -- style ------------------------------------------------------------------
|
|
30
|
+
from .style import DEFAULT_THEME, MONO, SANS, SERIF, Style, Theme, use_theme
|
|
31
|
+
from .themes import (BLUEPRINT, DARK, MINIMAL, PAPER, SLIDE, SOFT, THEMES,
|
|
32
|
+
get_theme)
|
|
33
|
+
|
|
34
|
+
# -- core -------------------------------------------------------------------
|
|
35
|
+
from .core import Anchor, Element, Group
|
|
36
|
+
|
|
37
|
+
# -- content ----------------------------------------------------------------
|
|
38
|
+
from .text import Label, Span, Text, layout_text, measure_block
|
|
39
|
+
from .shapes import (Box, Chevron, Circle, Cylinder, Diamond, Dot, Ellipse,
|
|
40
|
+
Hexagon, Line, Marker, Parallelogram, Path, Pill, Polygon,
|
|
41
|
+
Polyline, Rect, Shape, Stadium, Star, Triangle, Note)
|
|
42
|
+
from .image import Image
|
|
43
|
+
from .component import Component
|
|
44
|
+
from .components import (Bracket, Brace, Callout, ColorBar, Heatmap,
|
|
45
|
+
LabelledMatrix, Legend, Matrix, Panel, Spacer,
|
|
46
|
+
Table, Vector)
|
|
47
|
+
|
|
48
|
+
# -- connectors -------------------------------------------------------------
|
|
49
|
+
from .connectors import (Connector, arrow, connect, curve, double_arrow,
|
|
50
|
+
elbow, line, self_loop)
|
|
51
|
+
|
|
52
|
+
# -- layout -----------------------------------------------------------------
|
|
53
|
+
from .layout import (align, align_h, align_v, baseline_of, between, bbox_of,
|
|
54
|
+
brace_around, center_on,
|
|
55
|
+
circular, distribute_h, distribute_v, fit, frame_around,
|
|
56
|
+
grid, group, hstack, midpoint, same_height, same_size,
|
|
57
|
+
same_width, shift, spread_h, spread_v, vstack)
|
|
58
|
+
|
|
59
|
+
# -- data / plots -----------------------------------------------------------
|
|
60
|
+
from .frame import Frame, nice_ticks
|
|
61
|
+
|
|
62
|
+
# -- fonts & math -----------------------------------------------------------
|
|
63
|
+
from .fonts import get_font, measure_text, register_font, text_extents
|
|
64
|
+
from .mathtext import (latex_available, math_available, render_math,
|
|
65
|
+
set_latex_preamble, set_math_fontset)
|
|
66
|
+
|
|
67
|
+
# -- checking ---------------------------------------------------------------
|
|
68
|
+
from .audit import Finding, Report, audit
|
|
69
|
+
|
|
70
|
+
# -- output -----------------------------------------------------------------
|
|
71
|
+
from .figure import Figure
|
|
72
|
+
from .export import ExportError, available_backends, save_figure
|
|
73
|
+
|
|
74
|
+
__all__ = [
|
|
75
|
+
"__version__",
|
|
76
|
+
# geometry
|
|
77
|
+
"Point", "BBox", "Affine", "to_point",
|
|
78
|
+
# colour
|
|
79
|
+
"parse_color", "to_hex", "rgba", "alpha", "mix", "lighten", "darken",
|
|
80
|
+
"saturate", "desaturate", "luminance", "contrast_color", "colormap",
|
|
81
|
+
"palette", "normalize", "PALETTES", "COLORMAPS",
|
|
82
|
+
# style / theme
|
|
83
|
+
"Style", "Theme", "use_theme", "DEFAULT_THEME", "SANS", "SERIF", "MONO",
|
|
84
|
+
"PAPER", "SLIDE", "DARK", "BLUEPRINT", "MINIMAL", "SOFT", "THEMES",
|
|
85
|
+
"get_theme",
|
|
86
|
+
# core
|
|
87
|
+
"Element", "Group", "Anchor",
|
|
88
|
+
# content
|
|
89
|
+
"Text", "Label", "Span", "layout_text", "measure_block",
|
|
90
|
+
"Shape", "Box", "Rect", "Pill", "Stadium", "Ellipse", "Circle", "Diamond",
|
|
91
|
+
"Triangle", "Hexagon", "Parallelogram", "Chevron", "Star", "Cylinder",
|
|
92
|
+
"Note", "Path", "Polygon", "Polyline", "Line", "Dot", "Marker",
|
|
93
|
+
"Image", "Matrix", "Vector", "Heatmap", "ColorBar", "Panel", "Brace",
|
|
94
|
+
"Bracket", "Legend", "Table", "Callout", "Spacer", "Component",
|
|
95
|
+
"LabelledMatrix",
|
|
96
|
+
# connectors
|
|
97
|
+
"Connector", "arrow", "line", "elbow", "curve", "connect", "double_arrow",
|
|
98
|
+
"self_loop",
|
|
99
|
+
# layout
|
|
100
|
+
"align", "align_h", "align_v", "distribute_h", "distribute_v", "spread_h",
|
|
101
|
+
"spread_v", "hstack", "vstack", "grid", "fit", "frame_around", "between",
|
|
102
|
+
"midpoint", "center_on", "group", "bbox_of", "circular", "same_width",
|
|
103
|
+
"same_height", "same_size", "shift", "baseline_of", "brace_around",
|
|
104
|
+
# data
|
|
105
|
+
"Frame", "nice_ticks",
|
|
106
|
+
# fonts / math
|
|
107
|
+
"get_font", "measure_text", "text_extents", "register_font",
|
|
108
|
+
"render_math", "math_available", "latex_available", "set_math_fontset",
|
|
109
|
+
"set_latex_preamble",
|
|
110
|
+
# checking
|
|
111
|
+
"audit", "Report", "Finding",
|
|
112
|
+
# output
|
|
113
|
+
"Figure", "save_figure", "available_backends", "ExportError",
|
|
114
|
+
]
|