graphtty 0.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.
- graphtty-0.0.1/.claude/settings.local.json +20 -0
- graphtty-0.0.1/.github/workflows/cd.yml +76 -0
- graphtty-0.0.1/.github/workflows/ci.yml +22 -0
- graphtty-0.0.1/.github/workflows/commitlint.yml +47 -0
- graphtty-0.0.1/.github/workflows/lint.yml +39 -0
- graphtty-0.0.1/.github/workflows/publish-dev.yml +129 -0
- graphtty-0.0.1/.github/workflows/test.yml +37 -0
- graphtty-0.0.1/.gitignore +207 -0
- graphtty-0.0.1/.python-version +1 -0
- graphtty-0.0.1/CLAUDE.md +55 -0
- graphtty-0.0.1/LICENSE +21 -0
- graphtty-0.0.1/PKG-INFO +285 -0
- graphtty-0.0.1/README.md +268 -0
- graphtty-0.0.1/pyproject.toml +97 -0
- graphtty-0.0.1/samples/deep-agent/graph.json +112 -0
- graphtty-0.0.1/samples/react-agent/graph.json +62 -0
- graphtty-0.0.1/samples/supervisor-agent/graph.json +220 -0
- graphtty-0.0.1/samples/workflow-agent/graph.json +150 -0
- graphtty-0.0.1/screenshots/deep-agent.png +0 -0
- graphtty-0.0.1/screenshots/react-agent.png +0 -0
- graphtty-0.0.1/screenshots/supervisor-agent.png +0 -0
- graphtty-0.0.1/screenshots/workflow-agent.png +0 -0
- graphtty-0.0.1/scripts/generate_screenshots.py +198 -0
- graphtty-0.0.1/src/graphtty/__init__.py +16 -0
- graphtty-0.0.1/src/graphtty/__main__.py +126 -0
- graphtty-0.0.1/src/graphtty/canvas.py +258 -0
- graphtty-0.0.1/src/graphtty/renderer.py +660 -0
- graphtty-0.0.1/src/graphtty/themes.py +299 -0
- graphtty-0.0.1/src/graphtty/types.py +36 -0
- graphtty-0.0.1/tests/__init__.py +0 -0
- graphtty-0.0.1/tests/test_canvas.py +137 -0
- graphtty-0.0.1/tests/test_cli.py +172 -0
- graphtty-0.0.1/tests/test_renderer.py +321 -0
- graphtty-0.0.1/tests/test_themes.py +114 -0
- graphtty-0.0.1/uv.lock +676 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"Bash(find:*)",
|
|
5
|
+
"Bash(uv sync:*)",
|
|
6
|
+
"Bash(uv run pytest:*)",
|
|
7
|
+
"Bash(uv run python:*)",
|
|
8
|
+
"Bash(PYTHONIOENCODING=utf-8 uv run python:*)",
|
|
9
|
+
"Bash(pip show:*)",
|
|
10
|
+
"Bash(dir:*)",
|
|
11
|
+
"Bash(where python:*)",
|
|
12
|
+
"Bash(pip install:*)",
|
|
13
|
+
"Bash($env:PYTHONIOENCODING=\"utf-8\")",
|
|
14
|
+
"Bash(PYTHONIOENCODING=utf-8 uv run:*)",
|
|
15
|
+
"Bash(set:*)",
|
|
16
|
+
"Bash(uv run:*)",
|
|
17
|
+
"Bash(uv pip install:*)"
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
name: CD
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
push:
|
|
6
|
+
branches:
|
|
7
|
+
- main
|
|
8
|
+
paths:
|
|
9
|
+
- pyproject.toml
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
lint:
|
|
13
|
+
uses: ./.github/workflows/lint.yml
|
|
14
|
+
|
|
15
|
+
test:
|
|
16
|
+
uses: ./.github/workflows/test.yml
|
|
17
|
+
|
|
18
|
+
build:
|
|
19
|
+
name: Build
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
|
|
22
|
+
needs:
|
|
23
|
+
- lint
|
|
24
|
+
- test
|
|
25
|
+
|
|
26
|
+
if: ${{ github.repository == 'cristipufu/graphtty' }}
|
|
27
|
+
permissions:
|
|
28
|
+
contents: read
|
|
29
|
+
actions: write
|
|
30
|
+
|
|
31
|
+
steps:
|
|
32
|
+
- name: Checkout
|
|
33
|
+
uses: actions/checkout@v4
|
|
34
|
+
|
|
35
|
+
- name: Setup uv
|
|
36
|
+
uses: astral-sh/setup-uv@v5
|
|
37
|
+
with:
|
|
38
|
+
enable-cache: true
|
|
39
|
+
|
|
40
|
+
- name: Setup Python
|
|
41
|
+
uses: actions/setup-python@v5
|
|
42
|
+
with:
|
|
43
|
+
python-version-file: ".python-version"
|
|
44
|
+
|
|
45
|
+
- name: Install dependencies
|
|
46
|
+
run: uv sync --all-extras
|
|
47
|
+
|
|
48
|
+
- name: Build
|
|
49
|
+
run: uv build
|
|
50
|
+
|
|
51
|
+
- name: Upload artifacts
|
|
52
|
+
uses: actions/upload-artifact@v4
|
|
53
|
+
with:
|
|
54
|
+
name: release-dists
|
|
55
|
+
path: dist/
|
|
56
|
+
|
|
57
|
+
pypi-publish:
|
|
58
|
+
name: Upload release to PyPI
|
|
59
|
+
runs-on: ubuntu-latest
|
|
60
|
+
environment: pypi
|
|
61
|
+
|
|
62
|
+
needs:
|
|
63
|
+
- build
|
|
64
|
+
permissions:
|
|
65
|
+
contents: read
|
|
66
|
+
id-token: write
|
|
67
|
+
|
|
68
|
+
steps:
|
|
69
|
+
- name: Retrieve release distributions
|
|
70
|
+
uses: actions/download-artifact@v4
|
|
71
|
+
with:
|
|
72
|
+
name: release-dists
|
|
73
|
+
path: dist/
|
|
74
|
+
|
|
75
|
+
- name: Publish package distributions to PyPI
|
|
76
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
paths-ignore:
|
|
8
|
+
- pyproject.toml
|
|
9
|
+
pull_request:
|
|
10
|
+
branches:
|
|
11
|
+
- main
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
commit-lint:
|
|
15
|
+
if: ${{ github.event_name == 'pull_request' }}
|
|
16
|
+
uses: ./.github/workflows/commitlint.yml
|
|
17
|
+
|
|
18
|
+
lint:
|
|
19
|
+
uses: ./.github/workflows/lint.yml
|
|
20
|
+
|
|
21
|
+
test:
|
|
22
|
+
uses: ./.github/workflows/test.yml
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
name: Commit Lint
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_call
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
commitlint:
|
|
8
|
+
name: Commit Lint
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout
|
|
15
|
+
uses: actions/checkout@v4
|
|
16
|
+
with:
|
|
17
|
+
fetch-depth: 0
|
|
18
|
+
|
|
19
|
+
- name: Setup Node
|
|
20
|
+
uses: actions/setup-node@v3
|
|
21
|
+
with:
|
|
22
|
+
node-version: 22
|
|
23
|
+
|
|
24
|
+
- name: Install Git
|
|
25
|
+
run: |
|
|
26
|
+
if ! command -v git &> /dev/null; then
|
|
27
|
+
echo "Git is not installed. Installing..."
|
|
28
|
+
sudo apt-get update
|
|
29
|
+
sudo apt-get install -y git
|
|
30
|
+
else
|
|
31
|
+
echo "Git is already installed."
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
- name: Install commitlint
|
|
35
|
+
run: |
|
|
36
|
+
npm install conventional-changelog-conventionalcommits
|
|
37
|
+
npm install commitlint@latest
|
|
38
|
+
npm install @commitlint/config-conventional
|
|
39
|
+
|
|
40
|
+
- name: Configure
|
|
41
|
+
run: |
|
|
42
|
+
echo "export default { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js
|
|
43
|
+
|
|
44
|
+
- name: Validate PR commits with commitlint
|
|
45
|
+
run: |
|
|
46
|
+
git fetch origin pull/${{ github.event.pull_request.number }}/head:pr_branch
|
|
47
|
+
npx commitlint --from ${{ github.event.pull_request.base.sha }} --to pr_branch --verbose
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: Lint
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_call
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
lint:
|
|
8
|
+
name: Lint
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout
|
|
15
|
+
uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
- name: Setup uv
|
|
18
|
+
uses: astral-sh/setup-uv@v5
|
|
19
|
+
with:
|
|
20
|
+
enable-cache: true
|
|
21
|
+
|
|
22
|
+
- name: Setup Python
|
|
23
|
+
uses: actions/setup-python@v5
|
|
24
|
+
with:
|
|
25
|
+
python-version-file: ".python-version"
|
|
26
|
+
|
|
27
|
+
- name: Install dependencies
|
|
28
|
+
run: uv sync --locked --all-extras
|
|
29
|
+
|
|
30
|
+
- name: Check static types
|
|
31
|
+
run: uv run mypy --config-file pyproject.toml .
|
|
32
|
+
|
|
33
|
+
- name: Check linting
|
|
34
|
+
run: uv run ruff check .
|
|
35
|
+
|
|
36
|
+
- name: Check formatting
|
|
37
|
+
run: uv run ruff format --check .
|
|
38
|
+
|
|
39
|
+
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
name: Publish Dev Build
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types: [opened, synchronize, reopened, labeled]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
publish-dev:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
pull-requests: write
|
|
13
|
+
|
|
14
|
+
# Only run if PR has the build:dev label
|
|
15
|
+
if: contains(github.event.pull_request.labels.*.name, 'build:dev')
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- name: Checkout
|
|
19
|
+
uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- name: Setup uv
|
|
22
|
+
uses: astral-sh/setup-uv@v5
|
|
23
|
+
with:
|
|
24
|
+
enable-cache: true
|
|
25
|
+
|
|
26
|
+
- name: Setup Python
|
|
27
|
+
uses: actions/setup-python@v5
|
|
28
|
+
with:
|
|
29
|
+
python-version-file: ".python-version"
|
|
30
|
+
|
|
31
|
+
- name: Install dependencies
|
|
32
|
+
run: uv sync --all-extras
|
|
33
|
+
|
|
34
|
+
- name: Set development version
|
|
35
|
+
shell: pwsh
|
|
36
|
+
env:
|
|
37
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
38
|
+
run: |
|
|
39
|
+
$pyprojcontent = Get-Content pyproject.toml -Raw
|
|
40
|
+
|
|
41
|
+
$PROJECT_NAME = ($pyprojcontent | Select-String -Pattern '(?m)^\[(project|tool\.poetry)\][^\[]*?name\s*=\s*"([^"]*)"' -AllMatches).Matches[0].Groups[2].Value
|
|
42
|
+
$CURRENT_VERSION = ($pyprojcontent | Select-String -Pattern '(?m)^\[(project|tool\.poetry)\][^\[]*?version\s*=\s*"([^"]*)"' -AllMatches).Matches[0].Groups[2].Value
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
# Get PR number and run number with proper padding
|
|
46
|
+
$PR_NUM = [int]"${{ github.event.pull_request.number }}"
|
|
47
|
+
$PADDED_PR = "{0:D5}" -f [int]"${{ github.event.pull_request.number }}"
|
|
48
|
+
$PADDED_RUN = "{0:D4}" -f [int]"${{ github.run_number }}"
|
|
49
|
+
$PADDED_NEXT_PR = "{0:D5}" -f ($PR_NUM + 1)
|
|
50
|
+
|
|
51
|
+
# Create version range strings for PR
|
|
52
|
+
$MIN_VERSION = "$CURRENT_VERSION.dev1$PADDED_PR" + "0000"
|
|
53
|
+
$MAX_VERSION = "$CURRENT_VERSION.dev1$PADDED_NEXT_PR" + "0000"
|
|
54
|
+
|
|
55
|
+
# Create unique dev version with PR number and run ID
|
|
56
|
+
$DEV_VERSION = "$CURRENT_VERSION.dev1$PADDED_PR$PADDED_RUN"
|
|
57
|
+
|
|
58
|
+
# Update version in pyproject.toml
|
|
59
|
+
(Get-Content pyproject.toml) -replace "version = `"$CURRENT_VERSION`"", "version = `"$DEV_VERSION`"" | Set-Content pyproject.toml
|
|
60
|
+
|
|
61
|
+
Write-Output "Package version set to $DEV_VERSION"
|
|
62
|
+
|
|
63
|
+
$dependencyMessage = @"
|
|
64
|
+
## Development Package
|
|
65
|
+
|
|
66
|
+
- Add this package as a dependency in your pyproject.toml:
|
|
67
|
+
|
|
68
|
+
``````toml
|
|
69
|
+
[project]
|
|
70
|
+
dependencies = [
|
|
71
|
+
# Exact version:
|
|
72
|
+
"$PROJECT_NAME==$DEV_VERSION",
|
|
73
|
+
|
|
74
|
+
# Any version from PR
|
|
75
|
+
"$PROJECT_NAME>=$MIN_VERSION,<$MAX_VERSION"
|
|
76
|
+
]
|
|
77
|
+
|
|
78
|
+
[[tool.uv.index]]
|
|
79
|
+
name = "testpypi"
|
|
80
|
+
url = "https://test.pypi.org/simple/"
|
|
81
|
+
publish-url = "https://test.pypi.org/legacy/"
|
|
82
|
+
explicit = true
|
|
83
|
+
|
|
84
|
+
[tool.uv.sources]
|
|
85
|
+
$PROJECT_NAME = { index = "testpypi" }
|
|
86
|
+
``````
|
|
87
|
+
"@
|
|
88
|
+
|
|
89
|
+
# Get the owner and repo from the GitHub repository
|
|
90
|
+
$owner = "${{ github.repository_owner }}"
|
|
91
|
+
$repo = "${{ github.repository }}".Split('/')[1]
|
|
92
|
+
$prNumber = $PR_NUM
|
|
93
|
+
|
|
94
|
+
# Get the current PR description
|
|
95
|
+
$prUri = "https://api.github.com/repos/$owner/$repo/pulls/$prNumber"
|
|
96
|
+
$headers = @{
|
|
97
|
+
Authorization = "token $env:GITHUB_TOKEN"
|
|
98
|
+
Accept = "application/vnd.github.v3+json"
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
$pr = Invoke-RestMethod -Uri $prUri -Method Get -Headers $headers
|
|
102
|
+
$currentBody = $pr.body
|
|
103
|
+
|
|
104
|
+
# Check if there's already a development package section
|
|
105
|
+
if ($currentBody -match '## Development Package') {
|
|
106
|
+
# Replace the existing section with the new dependency message
|
|
107
|
+
$newBody = $currentBody -replace '## Development Package(\r?\n|.)*?(?=##|$)', $dependencyMessage
|
|
108
|
+
} else {
|
|
109
|
+
# Append the dependency message to the end of the description
|
|
110
|
+
$newBody = if ($currentBody) { "$currentBody`n`n$dependencyMessage" } else { $dependencyMessage }
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
# Update the PR description
|
|
114
|
+
$updateBody = @{
|
|
115
|
+
body = $newBody
|
|
116
|
+
} | ConvertTo-Json
|
|
117
|
+
|
|
118
|
+
Invoke-RestMethod -Uri $prUri -Method Patch -Headers $headers -Body $updateBody -ContentType "application/json"
|
|
119
|
+
|
|
120
|
+
Write-Output "Updated PR description with development package information"
|
|
121
|
+
|
|
122
|
+
- name: Build package
|
|
123
|
+
run: uv build
|
|
124
|
+
|
|
125
|
+
- name: Publish
|
|
126
|
+
run: uv publish --index testpypi
|
|
127
|
+
env:
|
|
128
|
+
UV_PUBLISH_TOKEN: ${{ secrets.TESTPYPI_TOKEN }}
|
|
129
|
+
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_call
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
test:
|
|
8
|
+
name: Test
|
|
9
|
+
runs-on: ${{ matrix.os }}
|
|
10
|
+
strategy:
|
|
11
|
+
matrix:
|
|
12
|
+
python-version: ["3.11"]
|
|
13
|
+
os: [ubuntu-latest, windows-latest]
|
|
14
|
+
|
|
15
|
+
permissions:
|
|
16
|
+
contents: read
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- name: Checkout
|
|
20
|
+
uses: actions/checkout@v4
|
|
21
|
+
|
|
22
|
+
- name: Setup uv
|
|
23
|
+
uses: astral-sh/setup-uv@v5
|
|
24
|
+
|
|
25
|
+
- name: Setup Python
|
|
26
|
+
uses: actions/setup-python@v5
|
|
27
|
+
with:
|
|
28
|
+
python-version: ${{ matrix.python-version }}
|
|
29
|
+
|
|
30
|
+
- name: Install dependencies
|
|
31
|
+
run: uv sync --all-extras
|
|
32
|
+
|
|
33
|
+
- name: Run tests
|
|
34
|
+
run: uv run pytest
|
|
35
|
+
|
|
36
|
+
continue-on-error: true
|
|
37
|
+
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
#uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
#poetry.lock
|
|
109
|
+
#poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
#pdm.lock
|
|
116
|
+
#pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
#pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# SageMath parsed files
|
|
135
|
+
*.sage.py
|
|
136
|
+
|
|
137
|
+
# Environments
|
|
138
|
+
.env
|
|
139
|
+
.envrc
|
|
140
|
+
.venv
|
|
141
|
+
env/
|
|
142
|
+
venv/
|
|
143
|
+
ENV/
|
|
144
|
+
env.bak/
|
|
145
|
+
venv.bak/
|
|
146
|
+
|
|
147
|
+
# Spyder project settings
|
|
148
|
+
.spyderproject
|
|
149
|
+
.spyproject
|
|
150
|
+
|
|
151
|
+
# Rope project settings
|
|
152
|
+
.ropeproject
|
|
153
|
+
|
|
154
|
+
# mkdocs documentation
|
|
155
|
+
/site
|
|
156
|
+
|
|
157
|
+
# mypy
|
|
158
|
+
.mypy_cache/
|
|
159
|
+
.dmypy.json
|
|
160
|
+
dmypy.json
|
|
161
|
+
|
|
162
|
+
# Pyre type checker
|
|
163
|
+
.pyre/
|
|
164
|
+
|
|
165
|
+
# pytype static type analyzer
|
|
166
|
+
.pytype/
|
|
167
|
+
|
|
168
|
+
# Cython debug symbols
|
|
169
|
+
cython_debug/
|
|
170
|
+
|
|
171
|
+
# PyCharm
|
|
172
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
173
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
174
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
175
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
176
|
+
#.idea/
|
|
177
|
+
|
|
178
|
+
# Abstra
|
|
179
|
+
# Abstra is an AI-powered process automation framework.
|
|
180
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
181
|
+
# Learn more at https://abstra.io/docs
|
|
182
|
+
.abstra/
|
|
183
|
+
|
|
184
|
+
# Visual Studio Code
|
|
185
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
186
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
188
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
189
|
+
# .vscode/
|
|
190
|
+
|
|
191
|
+
# Ruff stuff:
|
|
192
|
+
.ruff_cache/
|
|
193
|
+
|
|
194
|
+
# PyPI configuration file
|
|
195
|
+
.pypirc
|
|
196
|
+
|
|
197
|
+
# Cursor
|
|
198
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
|
199
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
200
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
201
|
+
.cursorignore
|
|
202
|
+
.cursorindexingignore
|
|
203
|
+
|
|
204
|
+
# Marimo
|
|
205
|
+
marimo/_static/
|
|
206
|
+
marimo/_lsp/
|
|
207
|
+
__marimo__/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.11
|
graphtty-0.0.1/CLAUDE.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# CLAUDE.md — Developer Guide for graphtty
|
|
2
|
+
|
|
3
|
+
## Architecture
|
|
4
|
+
|
|
5
|
+
- **Package**: `src/graphtty/` with `canvas.py`, `renderer.py`, `themes.py`, `types.py`, `__main__.py`
|
|
6
|
+
- **Import**: `from graphtty import render, AsciiGraph, AsciiNode, AsciiEdge`
|
|
7
|
+
- **CLI**: `uv run graphtty <file.json> [--theme NAME] [--ascii] [--no-types]`
|
|
8
|
+
- **Layout engine**: grandalf (Sugiyama algorithm) for hierarchical DAG layout
|
|
9
|
+
- **Data models**: `AsciiGraph`, `AsciiNode`, `AsciiEdge` in `types.py` (Pydantic, `ConfigDict(extra="ignore")`)
|
|
10
|
+
- **Dependencies**: `grandalf>=0.8`, `pydantic>=2.0` (standalone, no external runtime dependency)
|
|
11
|
+
|
|
12
|
+
## Key Design Decisions
|
|
13
|
+
|
|
14
|
+
- Canvas uses a parallel `_colors` grid (not inline ANSI) for clean color support
|
|
15
|
+
- Themes are frozen dataclasses with per-node-type styles; "default" theme = no colors
|
|
16
|
+
- `to_string(use_color=True)` emits ANSI codes with run-length optimization
|
|
17
|
+
- `_metadata_lines()` wraps `node.description` into display lines (max 40 chars)
|
|
18
|
+
- Type label shown ONLY in top border (not as content line) to avoid redundancy
|
|
19
|
+
- **Types are generic/agnostic** — legacy metadata mapping (`model_name`, `tool_names`) lives ONLY in `__main__.py` (`_preprocess_nodes`), not in the library types
|
|
20
|
+
- Node `description` field is the generic way to add detail lines under the node name
|
|
21
|
+
|
|
22
|
+
## Common Commands
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
uv sync # install dependencies
|
|
26
|
+
uv run pytest tests/ -v # run tests
|
|
27
|
+
uv run graphtty samples/react-agent/graph.json # render a sample
|
|
28
|
+
uv run graphtty samples/react-agent/graph.json --theme monokai # with theme
|
|
29
|
+
uv run python scripts/generate_screenshots.py # regenerate PNGs
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Edge Routing
|
|
33
|
+
|
|
34
|
+
- **Backward edges**: `_backward_edge_corridors()` computes global route_x (right of ALL boxes) so corridors never cut through other nodes
|
|
35
|
+
- **Near-straight edges**: `_STRAIGHT_TOLERANCE = 2` prevents Z-shapes when src/tgt centers differ by <=2 chars
|
|
36
|
+
- **Z-shape routing**: `mid_y = start_y + 2` keeps horizontal segment near source to avoid cutting through tall subgraph boxes
|
|
37
|
+
|
|
38
|
+
## Subgraph Rendering
|
|
39
|
+
|
|
40
|
+
- **CRITICAL**: Subgraphs rendered as Canvas objects via `_render_canvas()`, then blitted canvas-to-canvas with `blit_canvas()`
|
|
41
|
+
- Never render subgraphs as strings with ANSI codes — `len()` counts escape chars, which breaks box sizing
|
|
42
|
+
|
|
43
|
+
## Screenshots
|
|
44
|
+
|
|
45
|
+
- PNG screenshots in `screenshots/`, generated by `scripts/generate_screenshots.py` (uses Pillow + Cascadia Mono font)
|
|
46
|
+
- 4 samples: react-agent (monokai), deep-agent (ocean), workflow-agent (forest), supervisor-agent (dracula)
|
|
47
|
+
- GitHub strips SVG foreignObject/style elements, so use PNG not SVG for README
|
|
48
|
+
|
|
49
|
+
## Gotchas
|
|
50
|
+
|
|
51
|
+
- Windows cp1252 encoding: CLI uses `sys.stdout.reconfigure(encoding='utf-8')`
|
|
52
|
+
- `PYTHONIOENCODING=utf-8` needed when running from shell on Windows
|
|
53
|
+
- grandalf returns center coordinates; convert to top-left Box with `cx - w/2`
|
|
54
|
+
- Use combined ANSI sequences (`\033[2;32m`) not compound (`\033[2m\033[32m`)
|
|
55
|
+
- `to_string()` strips both leading AND trailing empty lines to avoid asymmetric padding
|
graphtty-0.0.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Cristi Pufu
|
|
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.
|