py2pd 0.1.1__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.
py2pd/__init__.py ADDED
@@ -0,0 +1,86 @@
1
+ """
2
+ py2pd - Python to PureData
3
+ ==========================
4
+
5
+ Write PureData patches as Python programs.
6
+
7
+ Builder API example:
8
+ >>> from py2pd import Patcher
9
+ >>> p = Patcher('patch.pd')
10
+ >>> osc = p.add('osc~ 440')
11
+ >>> dac = p.add('dac~')
12
+ >>> p.link(osc, dac)
13
+ >>> p.link(osc, dac, inlet=1) # stereo
14
+ >>> p.save()
15
+
16
+ AST API example (round-trip):
17
+ >>> from py2pd import parse_file, serialize
18
+ >>> ast = parse_file('input.pd')
19
+ >>> # Modify the AST...
20
+ >>> with open('output.pd', 'w') as f:
21
+ ... f.write(serialize(ast))
22
+ """
23
+
24
+ # Builder API
25
+ from .api import (
26
+ COLUMN_WIDTH as COLUMN_WIDTH,
27
+ )
28
+ from .api import (
29
+ DEFAULT_MARGIN as DEFAULT_MARGIN,
30
+ )
31
+ from .api import (
32
+ # Layout constants
33
+ ROW_HEIGHT as ROW_HEIGHT,
34
+ )
35
+ from .api import (
36
+ SUBPATCH_CANVAS_HEIGHT as SUBPATCH_CANVAS_HEIGHT,
37
+ )
38
+ from .api import (
39
+ SUBPATCH_CANVAS_WIDTH as SUBPATCH_CANVAS_WIDTH,
40
+ )
41
+ from .api import (
42
+ ConnectionError as ConnectionError,
43
+ )
44
+ from .api import (
45
+ CycleWarning as CycleWarning,
46
+ )
47
+ from .api import (
48
+ GridLayoutManager as GridLayoutManager,
49
+ )
50
+ from .api import (
51
+ InvalidConnectionError as InvalidConnectionError,
52
+ )
53
+ from .api import (
54
+ LayoutManager as LayoutManager,
55
+ )
56
+ from .api import (
57
+ NodeNotFoundError as NodeNotFoundError,
58
+ )
59
+ from .api import (
60
+ Patcher as Patcher,
61
+ )
62
+ from .ast import (
63
+ ParseError as ParseError,
64
+ )
65
+ from .ast import (
66
+ from_builder as from_builder,
67
+ )
68
+
69
+ # AST API (node types available via: from py2pd.ast import PdPatch, PdObj, ...)
70
+ from .ast import (
71
+ parse as parse,
72
+ )
73
+ from .ast import (
74
+ parse_file as parse_file,
75
+ )
76
+ from .ast import (
77
+ serialize as serialize,
78
+ )
79
+ from .ast import (
80
+ serialize_to_file as serialize_to_file,
81
+ )
82
+ from .ast import (
83
+ to_builder as to_builder,
84
+ )
85
+
86
+ __version__ = "0.1.1"