Skip to main content

VQL — Visual Query Language for vector description of photographs and drawings

Project description

VQL - Visual Query Language

before

uri2vql pipeline-analyze --image /tmp/screen.png --out app.vql.json --llm

1.png

after

uri2vql vql-to-image --program app.vql.json --out app.render.png

2.png

VQL objects app.vql.json

{
  "version": "1.0",
  "render_target": "svg",
  "scene": {
    "width": 2560.0,
    "height": 1600.0,
    "background": "#FFFFFF",
    "url": "file:///tmp/screen.png",
    "app": "desktop",
    "layers": [
      {
        "id": "screen_regions",
        "objects": [
          {
            "id": "region_000",
            "primitives": [
              {
                "shape_type": "rectangle",
                "params": {
                  "width": 213.0,
                  "height": 133.0
                }
              }
            ],
            "style": {
              "color": "#2F342E",
              "fill": true,
              "stroke_width": 0.0,

AI Cost Tracking

PyPI Version Python License AI Cost Human Time Model

  • 🤖 LLM usage: $7.7792 (6 commits)
  • 👤 Human dev: ~$359 (3.6h @ $100/h, 30min dedup)

Generated on 2026-06-09 using openrouter/qwen/qwen3-coder-next


VQL (Visual Query Language) — język wektorowego opisu fotografii, rysunków i zrzutów ekranu.

Samodzielna paczka Python z IR (VQLProgram), kompilatorem NL→VQL, walidacją i rendererami SVG/PNG. Sterowana przez DSL i bus CQRS/ES w paczkach *2vql.

Ekosystem: SUMD (opis) → DOQL (deklaracja) → Makefile/taskfile (automation) → testql (weryfikacja)

Dokumentacja: docs/README.md · Przykłady: examples/README.md · SUMD: SUMD.md

Instalacja

pip install vql              # core
pip install vql[png]         # eksport PNG (cairosvg)
pip install vql[desktop]     # zrzut ekranu (pillow, mss)
bash install-dev.sh          # pełny stack dev

Szybki start — rysowanie

from vql import nl_to_program, render_to_svg

program = nl_to_program("narysuj czerwone koło", width=400, height=400)
svg = render_to_svg(program)
dsl2vql -c 'COMPILE "narysuj niebieski kwadrat"'
rest2vql serve --port 8216

Szybki start — zrzut ekranu → VQL

# Automatyzacja LLM: vdisplay → imgl (bez dialogu GNOME, gdy mirror działa)
imgl capture -o /tmp/screen.png --verify --analyze --lang eng+pol

# Alternatywa: portal GNOME (docs/desktop-capture.md)
uri2vql capture-screen --interactive --out /tmp/screen.png

# All-in-one
uri2vql capture-and-analyze --out app.vql.json --diagnose

# Lub krok po kroku
uri2vql analyze-window --image /tmp/screen.png --out app.vql.json --grid 12
uri2vql adopt-ui --image /tmp/screen.png --out ui.vql.json --locale pl
uri2img2svg query "img2svg://svg?path=/tmp/screen.png&out=/tmp/screen.svg"

uri2vql query "vql://window/summary?file=app.vql.json&live=1&image=/tmp/screen.png"

Pełny skrypt: bash examples/full-pipeline.sh

Fotografia ↔ VQL (roundtrip)

Opis z obrazu i odtworzenie z metadanych — zależnie od typu obrazu:

# Test roundtrip (próbki + raport fidelity)
python examples/photo-roundtrip-test.py
make test-roundtrip

# Opis mozaiką kolorów
img2svg vql photo.png --out photo.vql.json --grid 20

# Wektoryzacja kolorowa (lepsza dla płaskich kształtów)
pip install 'img2svg[vtracer]'
img2svg vql photo.png --out photo.vql.json --method vtracer

# Odtworzenie
python -c "
from vql import VQLProgram, render_to_png
import json
p = VQLProgram.from_dict(json.load(open('photo.vql.json')))
render_to_png(p, 'reconstructed.png')
"

Macierz jakości i biblioteki: docs/photo-roundtrip.md

Interfejsy

Warstwa Window / screenshot SVG
CLI uri2vql, img2vql img2svg, uri2img2svg, dsl2img2svg
URI vql://window/* img2svg://vectorize|svg|vql
REST POST /v1/window/* :8216 planowane
MCP vql_detect_ui, vql_diagnose_window, …

REST: docs/rest-window-api.md · URI: docs/window-uri.md · SVG: docs/img2svg-uri.md

Desktop adopt + img2nl

Etap Narzędzie Co robi
Capture imgl capture (vdisplay) / uri2vql capture-screen PNG + provenance / portal
Grid adopt analyze-window scalone regiony + fingerprint
UI detect img2vql / adopt-ui okna, przyciski, bbox, relations
Wektoryzacja img2svg / uri2img2svg PNG → SVG / VQL
Diagnose diagnose-window routing LLM + auto-OCR
Compare compare-window phash — zmiana ekranu?
OCR semantyczny adopt-imgl / imgl tekst + role + interakcja

Pipeline: docs/window-pipeline.md · LLM capture: docs/vdisplay-imgl-automation.md · Portal: docs/desktop-capture.md

Przykłady

bash examples/live-capture-test.sh
bash examples/full-pipeline.sh
bash examples/img2nl-vql-flow.sh /tmp/screen.png
VQL_TEST_IMAGE=/tmp/screen.png bash examples/full-pipeline.sh

Development

make install-dev    # pełny stack *2vql
make test           # pytest core + dsl2vql
make test-all       # wszystkie pakiety
make serve          # rest2vql :8216
make goal           # test + commit + publish (goal.yaml)
bash project.sh     # SUMD + DOQL + testql + analiza

Zmienne LLM: skopiuj .env.example.env (OPENROUTER_API_KEY, LLM_MODEL).

Struktura monorepo

src/vql/              — domena (schema, compiler, renderers, adopt/window)
packages/
  dsl2vql/ uri2vql/ nlp2vql/ cli2vql/ rest2vql/ mcp2vql/
  img2vql/            — detekcja UI + img2nl diagnose (v0.2)
  img2svg/            — obraz → SVG / VQL (v0.1)
  uri2img2svg/        — img2svg:// URI (v0.1)
  dsl2img2svg/        — VECTORIZE / TO_VQL DSL (v0.1)
docs/                 — dokumentacja
examples/             — skrypty demo (README w examples/)
testql-scenarios/     — kontrakty testql (CLI, pytest)

Skala (SUMD): 151 modułów · 278 funkcji · ~12.5k LOC · CC̄=4.2

Szczegóły: packages/README.md · docs/packages.md

Status

License

Licensed under Apache-2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vql-0.1.5.tar.gz (3.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vql-0.1.5-py3-none-any.whl (81.9 kB view details)

Uploaded Python 3

File details

Details for the file vql-0.1.5.tar.gz.

File metadata

  • Download URL: vql-0.1.5.tar.gz
  • Upload date:
  • Size: 3.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for vql-0.1.5.tar.gz
Algorithm Hash digest
SHA256 33a378c4273ede8c6b467a5abc6c65d655a8171c5b159fbac3b65f702e14eb23
MD5 62cda4bff0c73c74719730de9df2d477
BLAKE2b-256 a97f820afa9c3b8499c2f1b4c5ba68df9bb08bc465a74e04c167d49bac2d1251

See more details on using hashes here.

File details

Details for the file vql-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: vql-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 81.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for vql-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 73e1d113c98cf193a78dc561b05341e93e17dcd10b503c51083c1963789ef3b1
MD5 3d95c56889e4841909e7b14225897c22
BLAKE2b-256 3301d3af5649dd11b7118ca7632ecdf1a833d9f4ae426d0481e77ec746457d48

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page