Repository navigation
0.4.0: top-level legaldown is the workflow and the model; Document.from_dict/to_dict; Template(text, resolve=) - #100
Merged
Conversation
…om_dict/to_dict; Template(text, resolve=) legaldown.__all__ goes from 81 names to 48: the workflow (load, parse, save, serialize, validate, the template and answers calls), the result types (now with Blank), is_template, the document model, and the deprecated names until 0.5.0. The lexer, fragment and definition helpers, render_block/render_item, the dict factories and BLOCK_DEFAULTS leave __all__ but still import from legaldown as the same objects, without a warning, so PactTrack and legaldown-render keep working; their supported home is legaldown.syntax / legaldown.grammar, which gain the definition readers (collect_definitions, definition_lookup, id_term, DefinitionRef, find_definition_anchors, DefinitionAnchor) and render_block/render_item. Document.from_dict(data) and document.to_dict() are the documented way to build and dump a document; Document() is a blank document (empty_document() is a starter contract, now said so). Template(text, *, resolve=None): path is set by load_template (still a readable attribute), and check= becomes private (_check), used only by tests and the conformance harness. Tests pin the new __all__ and `import *`, and check every name PactTrack and legaldown-render import from legaldown still imports, warning-free, as the same object as its new home. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013WmBAc5T7UCKVdpUmg9qxz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the last API-simplification step before the 0.4.0 release. The top-level package now shows the workflow and the model, and the tooling lives in
legaldown.syntaxandlegaldown.grammar. Nothing downstream breaks.Changes
legaldown.__all__: 81 → 48 namesload,parse,save,serialize,validate,load_template,parse_template,Template,Form,Question,load_answers,AnswersError,AssemblyResult,AssemblyError,LoadFile,file_loader,FrontmatterError;Blank;is_template;__all__: the lexer, fragment and definition helpers,render_block/render_item, the dict factories andBLOCK_DEFAULTS.legaldownas the same objects, with no warning. A test checks every name PactTrack and legaldown-render import fromlegaldown, with warnings treated as errors.legaldown.syntaxorlegaldown.grammar.syntaxgains the definition readers (collect_definitions,definition_lookup,id_term,DefinitionRef,find_definition_anchors,DefinitionAnchor) andrender_block/render_item.Document.from_dict(data)/document.to_dict()Document()is a blank document. The docs now say thatempty_document()returns a starter contract, not a blank one.Template(text, *, resolve=None)pathis set byload_templateand stays a readable attribute.check=becomes the private_check, used only by tests and the conformance harness.Templateis new in the unreleased 0.4.0.README
legaldownis the workflow and the model, andsyntax/grammarare the tooling API.to_dict/from_dict.Verification
ruffis clean.__all__and whatfrom legaldown import *yields. Each name removed from__all__is checked to be the same object as in its new home.legaldownimport statement in PactTrack (35) and legaldown-render (11) runs against this branch with-W error::DeprecationWarning.main.🤖 Generated with Claude Code
https://claude.ai/code/session_013WmBAc5T7UCKVdpUmg9qxz
Generated by Claude Code