Skip to main content

PyTagManager

CI Version License PyPI

An AI-native analytics implementation platform: crawl a website, build a semantic DOM graph, generate tracking recommendations, export to seven analytics/tag-management platforms, track how a site's tracking surface changes over time, and (optionally) classify business intent with a local LLM — without hand-inspecting the DOM or writing CSS selectors by hand.

Current scope: web crawling + semantic DOM graph (Rust) → rule-based tracking recommendations (Python) → export to GTM, GA4, Segment, Snowplow, Tealium, RudderStack, and Adobe Tags → crawl-to-crawl diffing → optional Ollama-backed AI intent classification. This is a deliberately scoped slice of a much larger long-term vision — see docs/ARCHITECTURE.md for the full capability table and what's deliberately deferred (visual AI, runtime behavior capture, XDM modeling, an enterprise audit engine, and non-web platforms — each with a specific reason, not a blanket "not yet").

Architecture

  • Rust core (src/, via PyO3/maturin): async crawler (link discovery, sitemap.xml, robots.txt, BFS with dedup) and a semantic DOM graph engine (XPath/CSS/stable-selector generation per element).
  • Python layer (python/pytagmanager/): orchestration, rule-based tracking recommendations, exporters, crawl-snapshot diffing, and an optional local-LLM intent classifier, built on top of the compiled Rust extension.
pytagmanager crawl <url>
        │
        ▼
  Rust: crawl + parse each page into a SemanticGraph
        │
        ▼
  Python: recommend_for_graph() — rule-based CTA/form detection
    (or, optionally: intent.OllamaIntentClassifier — local-LLM-backed)
        │
        ├──▶ export/{gtm,ga4,segment,snowplow,tealium,rudderstack,adobe_tags}.py
        │
        └──▶ version_control/snapshot.py — save a snapshot for `pytagmanager diff`

Quickstart

python3 -m venv .venv
source .venv/bin/activate
pip install maturin pytest
maturin develop          # builds the Rust extension, installs pytagmanager editable

pytagmanager crawl https://example.com --max-pages 20 --export gtm -o out.json

--export accepts gtm, ga4, segment, snowplow, tealium, rudderstack, or adobe_tags (see python/pytagmanager/export/base.py's EXPORTERS registry).

Tracking crawl-to-crawl changes

pytagmanager crawl https://example.com --save-snapshot baseline.json
# ... site changes, or crawl again later ...
pytagmanager crawl https://example.com --save-snapshot latest.json
pytagmanager diff baseline.json latest.json

Reports added/removed pages, added/removed/changed DOM elements (matched by stable selector where available), and added/removed tracking recommendations. See python/pytagmanager/version_control/.

AI business intent classification (optional, local-only)

pytagmanager.intent.ollama_classifier.OllamaIntentClassifier implements the same IntentClassifier interface as the deterministic heuristics engine, but backed by a locally running Ollama model (default qwen2.5:0.5b) instead of keyword matching:

from pytagmanager.intent.ollama_classifier import OllamaIntentClassifier
from pytagmanager.intent.base import PageContext

classifier = OllamaIntentClassifier()  # talks to http://localhost:11434
result = classifier.classify(node, PageContext(url=page_url, page_title=title))

Requires ollama serve running locally with the model pulled (ollama pull qwen2.5:0.5b). If Ollama isn't reachable, classify() falls back automatically to the deterministic keyword heuristic rather than raising — this runs entirely locally, with no cloud LLM API calls or credentials required; see docs/ARCHITECTURE.md for where a future cloud-LLM-backed classifier would plug in via the same IntentClassifier interface.

Development

cargo test               # Rust unit tests (selectors, robots.txt, sitemap parsing, DOM parsing)
pytest tests/python -v   # Python tests (heuristics, exporters, diffing, intent classification)

macOS note: this repo includes .cargo/config.toml with the linker flags PyO3 extension-module crates need for plain cargo build/cargo test to work outside of maturin (maturin sets these automatically; raw cargo doesn't).

Known Issues

  • No open GitHub issues and no TODO/FIXME markers in src/ or python/ as of this pass — the gaps that exist are the deliberately deferred phases tracked in docs/ARCHITECTURE.md and docs/ROADMAP.md (runtime/visual grounding, AI intent classification beyond the local Ollama fallback, multi-platform data-layer export, XDM modeling, the audit engine, and non-web platforms), not undocumented rot.
  • ClaudeIntentClassifier referenced in docs/ROADMAP.md's Phase 2 is planned, not implemented; python/pytagmanager/intent/base.py's IntentClassifier protocol has only one real implementation today (OllamaIntentClassifier), plus the deterministic rule-based heuristics used by default.

Project layout

Cargo.toml / pyproject.toml   # Rust crate + maturin/Python packaging
src/                          # Rust: crawler/ + dom/ (semantic graph, selectors)
python/pytagmanager/          # Python: discovery/ recommend/ intent/ export/ version_control/ cli.py
tests/python/                 # Python tests + HTML fixtures (Rust tests live next to their modules)
docs/ARCHITECTURE.md          # implemented vs. deliberately deferred, plus the full long-term spec

Release files for pytagmanager 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytagmanager 0.1.3
File Size Uploaded
pytagmanager-0.1.3.tar.gz 77.9 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for pytagmanager 0.1.3
File
pytagmanager-0.1.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details
pytagmanager-0.1.3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details
pytagmanager-0.1.3-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details
pytagmanager-0.1.3-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details

Total release size: 8.4 MB

Release files / pytagmanager-0.1.3.tar.gz

Download URL pytagmanager-0.1.3.tar.gz
Size 77.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b9e8a4816dd6f088d5e2bc67e4e1609f8bad86e1064076c928f0d12520e8b1c7
BLAKE2b-256 checksum
How to use checksums
1e958af203ed57f258a561fd5686e3888774a6e8b6653f643b2e2e380f8282a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / pytagmanager-0.1.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL pytagmanager-0.1.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 2.1 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
4ea51cc56671f0958b7b4a371329236eb04f7b010fc92a5a4d4940bd46088bc9
BLAKE2b-256 checksum
How to use checksums
b13360c82f7d693734b9be9dda0c551d15a00ebbd1a96d7743ba532bea1492fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / pytagmanager-0.1.3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL pytagmanager-0.1.3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 2.2 MB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
9493d4d78f0c827dd908d402354280df04682e034a18df7fc7de05038193ec81
BLAKE2b-256 checksum
How to use checksums
11e95430a15cd0f86ed302f67376aff64db39d33da9d4ffdfcde949695c54d7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / pytagmanager-0.1.3-cp39-abi3-macosx_11_0_arm64.whl

Download URL pytagmanager-0.1.3-cp39-abi3-macosx_11_0_arm64.whl
Size 2.0 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
335ee140359476d11fb5d8a54dc8234979a758066ddcfa56a8b038a7722be417
BLAKE2b-256 checksum
How to use checksums
5f9557bd89c698c5bc48137a0c0ab710f23e7d665878be56b018f2ff86f19ab2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / pytagmanager-0.1.3-cp39-abi3-macosx_10_12_x86_64.whl

Download URL pytagmanager-0.1.3-cp39-abi3-macosx_10_12_x86_64.whl
Size 2.0 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
553db8824cec6647d266a2a00019d5137a05578e36d803c09ff1df29ace29e05
BLAKE2b-256 checksum
How to use checksums
9579736d1d034770dd06c1381180489a0b21d6e90bce97094c39549669b1d60f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

This release

0.1.3 This release

5 release files

0.1.2

1 release file

0.1.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page