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.1

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.1
File Size Uploaded Provenance
scry_parse-1.2.1.tar.gz 43.9 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 61.3 kB

Release files / scry_parse-1.2.1.tar.gz

Download URL scry_parse-1.2.1.tar.gz
Size 43.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a884746794209012f26b484f2591c625d202b9e14371d59d1ebf48e5eb7b3af7
BLAKE2b-256 checksum
How to use checksums
89ca37ee444589644c95488c72aca854178db2ce22f0698eba29878ef326374a
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.1-py3-none-any.whl

Download URL scry_parse-1.2.1-py3-none-any.whl
Size 17.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ebd11ab29a0c8d1e04b11322c8bb835a17bb5524284bb5c37622dfea8cd1dcc2
BLAKE2b-256 checksum
How to use checksums
a06edb4d6c12a21709ae77051706f58bfbc91cd66e06658fa5fba5f00d0a9253
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.1

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