Skip to main content

scry-parse

Python parser for the scry-spec marker format. Conformant with scry-spec v1.1.2 (non-normative addition over v1.1.1 — no parser-relevant changes; the v1.1.2 "Recommended Operating Discipline" section binds consumer agents and tool-instruction surfaces, not parsers).

Install

uv pip install scry-parse
# or:
pip install scry-parse

Usage

from scry_parse import (
    parse_markers,
    validate_marker,
    check_cycles,
    mint_id,
    BASELINE_KINDS,
    BASELINE_STATUSES,
    EXTRAS_SIZE_CAP_BYTES,  # FR4.B (v1.1.0)
)

# Parse markers from file content
with open("my_file.md") as f:
    content = f.read()

result = parse_markers(content)

# Access by type
for entry in result.entries:
    print(entry.id, entry.kind, entry.summary)

for anchor in result.anchors:
    print(anchor.name, anchor.description)

for binding in result.bindings:
    print(binding.local_id, binding.ref)

# Or iterate all markers together
for marker in result.markers:
    print(type(marker).__name__, marker)

# Validate a parsed marker
vr = validate_marker(result.entries[0])
if not vr.valid:
    print(vr.errors)
if vr.warnings:
    print(vr.warnings)

# Detect cycles in depends_on relationships (FR12)
cycle_errors = check_cycles(result.entries)
if cycle_errors:
    for err in cycle_errors:
        print(err)  # "cycle detected: design.a~... → design.b~... → design.a~..."

# Generate a new marker ID
entry_id = mint_id("design", "auth-flow")           # random hash
entry_id = mint_id("design", "auth-flow", content)  # deterministic hash from content

Supported comment styles

Comment-prefix detection is automatic via YAML-key inference — no language hint required.

Line comments

Style Example
HTML/Markdown <!-- @scry.entry ... @scry.entry.end -->
Python/Shell # @scry.entry ... # @scry.entry.end
TypeScript/JS // @scry.entry ... // @scry.entry.end
SQL -- @scry.entry ... -- @scry.entry.end
Lisp ;; @scry.entry ... ;; @scry.entry.end

Block comments (v1.0.1+)

Style Example
JSDoc / Java /** @scry.entry ... * @scry.entry.end */ with * continuation
C / C++ /* @scry.entry ... @scry.entry.end */
OCaml (* @scry.entry ... @scry.entry.end *)
Haskell {- @scry.entry ... @scry.entry.end -}
PowerShell <# @scry.entry ... @scry.entry.end #>

Example JSDoc marker:

/**
 * @scry.entry
 * id: design.auth-flow~a1b2c3d4
 * kind: design
 * summary: JWT auth middleware
 * status: active
 * @scry.entry.end
 */

Public API

Symbol Description
parse_markers(content, language=None, file="") Parse all scry markers from text. Returns ParseResult.
validate_marker(marker) Validate a marker against spec rules. Returns ValidationResult.
check_cycles(markers) Detect cycles in depends_on graph. Returns list[str] of error messages.
mint_id(kind, name, content=None) Generate a spec-conformant marker ID.
BASELINE_KINDS Tuple of standard kind values from scry-spec v1.0.
BASELINE_STATUSES Tuple of standard status values (draft, active, deprecated).
EXTRAS_SIZE_CAP_BYTES FR4.B v1.1.0 size cap (4096) for serialized extras payload.

Dataclasses

  • ParseResult — entries: list[EntryMarker], anchors: list[AnchorMarker], bindings: list[BindingMarker], markers property (all three combined)
  • EntryMarker — id, kind, summary, status, weight, tags, rationale, applies, seeded_questions, depends_on, implements, supersedes, file, span, extras (FR4.B v1.1.0; dict[str, Any] | None, preserved structurally)
  • AnchorMarker — name, description, seeded_questions, file, span
  • BindingMarker — local_id, ref, comment, file, offset, span
  • ValidationResult — valid, errors, warnings (FR4.B SHOULD-diagnostics for extras: empty map, nested/list value, oversize)

License

MIT — see LICENSE.

Metadata

Release files for scry-parse 1.2.0

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

Source distribution (sdist)

Source distribution for scry-parse 1.2.0
File Size Uploaded Provenance
scry_parse-1.2.0.tar.gz 41.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for scry-parse 1.2.0
File Interpreter ABI Platform
scry_parse-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 58.4 kB

Release files / scry_parse-1.2.0.tar.gz

Download URL scry_parse-1.2.0.tar.gz
Size 41.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0918dab36f4fd8404c84cefb39d27fa2ca3f077b1c916a9ff131e4326a9588e0
BLAKE2b-256 checksum
How to use checksums
331f040ecfdff931b5b0b97934d74f2fdc9413b5a475ffb51c2b8e355c29a6e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / scry_parse-1.2.0-py3-none-any.whl

Download URL scry_parse-1.2.0-py3-none-any.whl
Size 17.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
baea81374c63fd404b06b5794fdbd5bd9dc8f80a0fd0cd4d4440bd159435e74f
BLAKE2b-256 checksum
How to use checksums
861254f3dde5e20148c09bb56eb51a9a656eb9e889201db18ce05539949e2cdc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for scry-parse 1.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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