garphield 0.1.0__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 (31) hide show
  1. garphield-0.1.0/.gitignore +91 -0
  2. garphield-0.1.0/LICENSE +21 -0
  3. garphield-0.1.0/PKG-INFO +108 -0
  4. garphield-0.1.0/README.md +88 -0
  5. garphield-0.1.0/pyproject.toml +41 -0
  6. garphield-0.1.0/src/garphield/__init__.py +85 -0
  7. garphield-0.1.0/src/garphield/_bindings.py +322 -0
  8. garphield-0.1.0/src/garphield/_canonical.py +88 -0
  9. garphield-0.1.0/src/garphield/_chrome.py +57 -0
  10. garphield-0.1.0/src/garphield/_codegen.py +98 -0
  11. garphield-0.1.0/src/garphield/_colab.py +34 -0
  12. garphield-0.1.0/src/garphield/_environment.py +156 -0
  13. garphield-0.1.0/src/garphield/_html.py +153 -0
  14. garphield-0.1.0/src/garphield/_identity.py +251 -0
  15. garphield-0.1.0/src/garphield/_networkx.py +447 -0
  16. garphield-0.1.0/src/garphield/_pandas.py +452 -0
  17. garphield-0.1.0/src/garphield/_project.py +731 -0
  18. garphield-0.1.0/src/garphield/_scalars.py +157 -0
  19. garphield-0.1.0/src/garphield/_schema.py +56 -0
  20. garphield-0.1.0/src/garphield/_server.py +190 -0
  21. garphield-0.1.0/src/garphield/_snowpark.py +51 -0
  22. garphield-0.1.0/src/garphield/_transform_runtime.py +292 -0
  23. garphield-0.1.0/src/garphield/_transforms.py +135 -0
  24. garphield-0.1.0/src/garphield/_transport.py +568 -0
  25. garphield-0.1.0/src/garphield/_view.py +329 -0
  26. garphield-0.1.0/src/garphield/_widget.py +1232 -0
  27. garphield-0.1.0/src/garphield/data/message-transport-budget.v1.json +6 -0
  28. garphield-0.1.0/src/garphield/py.typed +1 -0
  29. garphield-0.1.0/src/garphield/schema/gfd.schema.json +4214 -0
  30. garphield-0.1.0/src/garphield/schema/transforms.v1.json +49 -0
  31. garphield-0.1.0/src/garphield/static/widget.js +935 -0
@@ -0,0 +1,91 @@
1
+ toms-air*
2
+ # dependencies
3
+ node_modules
4
+ .yarn/cache
5
+ .yarn/unplugged
6
+ .yarn/build-state.yml
7
+ .pnp.*
8
+ .npm
9
+ web_modules/
10
+
11
+ # blitz
12
+ /.blitz/
13
+ /.next/
14
+ /out/
15
+ *.sqlite
16
+ *.sqlite-journal
17
+ .now
18
+ .blitz-console-history
19
+ blitz-log.log
20
+ .blitz.config.compiled.js
21
+
22
+ # misc
23
+ .DS_Store
24
+
25
+ # local env files
26
+ .env
27
+ .env.local
28
+ .env.*.local
29
+ .env.*
30
+ !.env.example
31
+ .envrc
32
+
33
+ # Logs
34
+ logs
35
+ *.log
36
+
37
+ # Runtime data
38
+ pids
39
+ *.pid
40
+ *.seed
41
+ *.pid.lock
42
+
43
+ # Testing
44
+ .coverage
45
+ coverage
46
+ playwright-report
47
+ test-results
48
+ *.lcov
49
+ .nyc_output
50
+ lib-cov
51
+
52
+ # Caches
53
+ .astro/
54
+ *.tsbuildinfo
55
+ .eslintcache
56
+ .pnpm-store/
57
+ .node_repl_history
58
+ .yarn-integrity
59
+
60
+ # Serverless directories
61
+ .serverless/
62
+
63
+ # Stores VSCode versions used for testing VSCode extensions
64
+ .vscode-test
65
+
66
+ .nova
67
+ dist
68
+
69
+ # Bench screenshots (regenerated by scripts/test-node-size-cap.mjs)
70
+ screenshots/
71
+
72
+ # git worktrees created inside the repo (parallel agents / wt)
73
+ .worktrees/
74
+
75
+ # Python environments and their caches (scripts/bootstrap-python.sh,
76
+ # scripts/lock-python-requirements.sh) — all disposable, all rebuildable.
77
+ __pycache__/
78
+ *.py[cod]
79
+ /.venv-python/
80
+ /.venv-python-tools-py310/
81
+ /.venv-python-tools-py311/
82
+ /.venv-python-tools-py312/
83
+ /.cache/pip/
84
+ /.cache/pycache/
85
+ /.cache/ms-playwright/
86
+ /.tmp/python-lock/
87
+ /.tmp/python-bootstrap/
88
+
89
+ # Generated by `pnpm python:app:stage` immediately before Python packaging.
90
+ /python/src/garphield/static/app/
91
+ /python/THIRD_PARTY_NOTICES.md
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ammil Industries
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,108 @@
1
+ Metadata-Version: 2.4
2
+ Name: garphield
3
+ Version: 0.1.0
4
+ Summary: Validated Python round-trip primitives for Garphield projects
5
+ Author: Garphield contributors
6
+ License-Expression: MIT
7
+ License-File: LICENSE
8
+ Requires-Python: <3.15,>=3.10
9
+ Requires-Dist: anywidget<1,>=0.9
10
+ Requires-Dist: jsonschema<5,>=4.23
11
+ Requires-Dist: jupyter-ui-poll<2,>=1.0
12
+ Requires-Dist: rfc8785<0.2,>=0.1.4
13
+ Provides-Extra: networkx
14
+ Requires-Dist: networkx<3.5,>=3.4.2; (python_version == '3.10') and extra == 'networkx'
15
+ Requires-Dist: networkx<4,>=3.6.1; (python_version >= '3.11') and extra == 'networkx'
16
+ Requires-Dist: pandas<4,>=2.2; extra == 'networkx'
17
+ Provides-Extra: tables
18
+ Requires-Dist: pandas<3,>=2.2; extra == 'tables'
19
+ Description-Content-Type: text/markdown
20
+
21
+ # garphield for Python
22
+
23
+ Explore graphs visually from a notebook. Pass a NetworkX graph or pandas
24
+ DataFrame to `show()` and get an interactive Garphield view inline - then
25
+ open the full workbench to build stories, apply layouts, and return the
26
+ result to Python.
27
+
28
+ ```python
29
+ import garphield as gf
30
+ import networkx as nx
31
+
32
+ G = nx.karate_club_graph()
33
+ view = gf.show(
34
+ G,
35
+ node_color="club",
36
+ node_size=G.degree,
37
+ node_label=str,
38
+ )
39
+ ```
40
+
41
+ Once the view is displayed, drive it from Python:
42
+
43
+ ```python
44
+ view.select([0, 1, 2]).fit()
45
+ view.bind("node_color", gf.algorithm("louvain", resolution=1.1))
46
+ edited = view.to_project()
47
+ ```
48
+
49
+ ## Install
50
+
51
+ ```bash
52
+ pip install garphield
53
+ ```
54
+
55
+ With NetworkX and pandas adapters:
56
+
57
+ ```bash
58
+ pip install 'garphield[tables,networkx]'
59
+ ```
60
+
61
+ ## From pandas
62
+
63
+ ```python
64
+ import pandas as pd
65
+ from garphield import Project
66
+
67
+ edges = pd.DataFrame({"source": ["a"], "target": ["b"], "weight": [1.5]})
68
+ project = Project.from_pandas(edges)
69
+ tables = project.to_pandas()
70
+ ```
71
+
72
+ ## Project files
73
+
74
+ Read, validate, and write `.gph` project files:
75
+
76
+ ```python
77
+ from garphield import Project
78
+
79
+ project = Project.load("project.gph")
80
+ print(project.semantic_fingerprint())
81
+ project.save("project-copy.gph")
82
+ ```
83
+
84
+ `Project.save()` writes deterministic, human-readable JSON. Semantic and
85
+ project fingerprints use RFC 8785/JCS canonical bytes.
86
+
87
+ ## Notebook round-trip
88
+
89
+ The wheel carries a version-matched notebook renderer, so the view works
90
+ without a hosted renderer or CDN. Use **Open in Garphield** to continue
91
+ in the full workbench at [garphield.com](https://garphield.com), then
92
+ **Return to notebook** to bring the result back to Python.
93
+
94
+ Use `chrome=["minimap"]` or `chrome=["toolbar"]` to keep embeds
95
+ lightweight. `project.save_html("graph.html", chrome=["minimap"])` writes
96
+ a standalone interactive HTML file.
97
+
98
+ ## Environments
99
+
100
+ Local Jupyter, VS Code notebooks, JupyterHub, Google Colab, and Snowflake
101
+ Snowpark notebooks are resolved automatically. For Snowpark, use
102
+ `show_snowpark()` which materializes selected tables in the kernel before
103
+ handoff.
104
+
105
+ ## Links
106
+
107
+ - [garphield.com](https://garphield.com)
108
+ - [GitHub](https://github.com/ammil-industries/garphield)
@@ -0,0 +1,88 @@
1
+ # garphield for Python
2
+
3
+ Explore graphs visually from a notebook. Pass a NetworkX graph or pandas
4
+ DataFrame to `show()` and get an interactive Garphield view inline - then
5
+ open the full workbench to build stories, apply layouts, and return the
6
+ result to Python.
7
+
8
+ ```python
9
+ import garphield as gf
10
+ import networkx as nx
11
+
12
+ G = nx.karate_club_graph()
13
+ view = gf.show(
14
+ G,
15
+ node_color="club",
16
+ node_size=G.degree,
17
+ node_label=str,
18
+ )
19
+ ```
20
+
21
+ Once the view is displayed, drive it from Python:
22
+
23
+ ```python
24
+ view.select([0, 1, 2]).fit()
25
+ view.bind("node_color", gf.algorithm("louvain", resolution=1.1))
26
+ edited = view.to_project()
27
+ ```
28
+
29
+ ## Install
30
+
31
+ ```bash
32
+ pip install garphield
33
+ ```
34
+
35
+ With NetworkX and pandas adapters:
36
+
37
+ ```bash
38
+ pip install 'garphield[tables,networkx]'
39
+ ```
40
+
41
+ ## From pandas
42
+
43
+ ```python
44
+ import pandas as pd
45
+ from garphield import Project
46
+
47
+ edges = pd.DataFrame({"source": ["a"], "target": ["b"], "weight": [1.5]})
48
+ project = Project.from_pandas(edges)
49
+ tables = project.to_pandas()
50
+ ```
51
+
52
+ ## Project files
53
+
54
+ Read, validate, and write `.gph` project files:
55
+
56
+ ```python
57
+ from garphield import Project
58
+
59
+ project = Project.load("project.gph")
60
+ print(project.semantic_fingerprint())
61
+ project.save("project-copy.gph")
62
+ ```
63
+
64
+ `Project.save()` writes deterministic, human-readable JSON. Semantic and
65
+ project fingerprints use RFC 8785/JCS canonical bytes.
66
+
67
+ ## Notebook round-trip
68
+
69
+ The wheel carries a version-matched notebook renderer, so the view works
70
+ without a hosted renderer or CDN. Use **Open in Garphield** to continue
71
+ in the full workbench at [garphield.com](https://garphield.com), then
72
+ **Return to notebook** to bring the result back to Python.
73
+
74
+ Use `chrome=["minimap"]` or `chrome=["toolbar"]` to keep embeds
75
+ lightweight. `project.save_html("graph.html", chrome=["minimap"])` writes
76
+ a standalone interactive HTML file.
77
+
78
+ ## Environments
79
+
80
+ Local Jupyter, VS Code notebooks, JupyterHub, Google Colab, and Snowflake
81
+ Snowpark notebooks are resolved automatically. For Snowpark, use
82
+ `show_snowpark()` which materializes selected tables in the kernel before
83
+ handoff.
84
+
85
+ ## Links
86
+
87
+ - [garphield.com](https://garphield.com)
88
+ - [GitHub](https://github.com/ammil-industries/garphield)
@@ -0,0 +1,41 @@
1
+ [build-system]
2
+ requires = ["hatchling==1.27.0"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "garphield"
7
+ version = "0.1.0"
8
+ description = "Validated Python round-trip primitives for Garphield projects"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10,<3.15"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ authors = [{ name = "Garphield contributors" }]
14
+ dependencies = [
15
+ "anywidget>=0.9,<1",
16
+ "jsonschema>=4.23,<5",
17
+ "jupyter-ui-poll>=1.0,<2",
18
+ "rfc8785>=0.1.4,<0.2",
19
+ ]
20
+ [project.optional-dependencies]
21
+ tables = ["pandas>=2.2,<3"]
22
+ networkx = [
23
+ "pandas>=2.2,<4",
24
+ "networkx>=3.4.2,<3.5; python_version == '3.10'",
25
+ "networkx>=3.6.1,<4; python_version >= '3.11'",
26
+ ]
27
+
28
+ [tool.hatch.build.targets.wheel]
29
+ packages = ["src/garphield"]
30
+
31
+ [tool.hatch.build]
32
+ artifacts = ["/src/garphield/static/app/**"]
33
+
34
+ [tool.hatch.build.targets.sdist]
35
+ include = [
36
+ "/src/garphield",
37
+ "/LICENSE",
38
+ "/THIRD_PARTY_NOTICES.md",
39
+ "/README.md",
40
+ "/pyproject.toml",
41
+ ]
@@ -0,0 +1,85 @@
1
+ """Validated Python primitives for Garphield project files."""
2
+
3
+ from ._canonical import CanonicalizationError, canonicalize_jcs_v1
4
+ from ._bindings import AlgorithmSpec, BindingOptions, algorithm
5
+ from ._html import save_html
6
+ from ._identity import AttributeNameCodecV1, EdgeIdentityCodecV1, IdentityCodecV1
7
+ from ._project import (
8
+ DuplicatePropertyError,
9
+ Project,
10
+ ProjectValidationError,
11
+ canonicalize_project_v1,
12
+ canonicalize_semantic_graph_v1,
13
+ load,
14
+ )
15
+ from ._transport import (
16
+ AnyWidgetTransportEndpoint,
17
+ TRANSPORT_RUNTIME_CONFIG_V1,
18
+ PreparedBudgetedJson,
19
+ TransportError,
20
+ TransportRuntimeConfigV1,
21
+ prepare_budgeted_json,
22
+ receive_budgeted_json,
23
+ )
24
+ from ._transforms import Transformation, TransformSpec, transform
25
+ from ._view import GraphView
26
+ from ._widget import (
27
+ OwnershipError,
28
+ ProjectWidget,
29
+ WidgetEnvironmentUnsupportedError,
30
+ WidgetNotDisplayedError,
31
+ WidgetTransportError,
32
+ show,
33
+ show_snowpark,
34
+ )
35
+
36
+
37
+ def __getattr__(name: str) -> object:
38
+ if name == "Tables":
39
+ from ._pandas import Tables
40
+
41
+ return Tables
42
+ if name == "IdentityCollisionError":
43
+ from ._networkx import IdentityCollisionError
44
+
45
+ return IdentityCollisionError
46
+ raise AttributeError(name)
47
+
48
+
49
+ __all__ = [
50
+ "AttributeNameCodecV1",
51
+ "AlgorithmSpec",
52
+ "AnyWidgetTransportEndpoint",
53
+ "CanonicalizationError",
54
+ "BindingOptions",
55
+ "DuplicatePropertyError",
56
+ "EdgeIdentityCodecV1",
57
+ "IdentityCodecV1",
58
+ "GraphView",
59
+ "OwnershipError",
60
+ "Project",
61
+ "ProjectWidget",
62
+ "ProjectValidationError",
63
+ "PreparedBudgetedJson",
64
+ "TransportError",
65
+ "TransportRuntimeConfigV1",
66
+ "TransformSpec",
67
+ "Transformation",
68
+ "TRANSPORT_RUNTIME_CONFIG_V1",
69
+ "WidgetEnvironmentUnsupportedError",
70
+ "WidgetNotDisplayedError",
71
+ "WidgetTransportError",
72
+ "IdentityCollisionError",
73
+ "Tables",
74
+ "canonicalize_jcs_v1",
75
+ "algorithm",
76
+ "transform",
77
+ "canonicalize_project_v1",
78
+ "canonicalize_semantic_graph_v1",
79
+ "load",
80
+ "prepare_budgeted_json",
81
+ "receive_budgeted_json",
82
+ "show",
83
+ "show_snowpark",
84
+ "save_html",
85
+ ]