Skip to content

Releases

ecfr-md 0.2.0

Choose a tag to compare

@github-actions github-actions released this 19 Nov 13:07
c01922a

On PyPI: uv tool install ecfr-md or pip install ecfr-md, with the extras web, tui, mcp, docx, pdf and all.

Added

  • ecfr-md browse [CITATION] [--date DATE]: a full-screen terminal browser
    (the tui extra, Textual). The outline of the whole CFR beside the text,
    with a breadcrumb and the date of the text. Everything works with the
    arrow keys, Enter and Esc, shown in the footer: in the text, ↑/↓
    paragraphs, ←/→ cross-references, Enter follows one or opens an
    entry of contents, Esc goes back (from the first place, up a level; it
    never quits); in the outline, ↑/↓ move, →/← open and close
    branches or go in and out, Enter reads; tab moves between the two; in
    dialogs, ↓/↑ go from the box to the list and back, Enter chooses,
    Esc closes. Letter keys are shortcuts: g go to any citation
    (completed from the outline), / search, [/] previous and next
    section, j/k paragraphs, u up, b/f back and forward, d text
    as of a date, h changes with a redline of each, e export in every
    format, y copy the paragraph's citation, o the outline, ? keys.
    The mouse works too. The all extra includes tui.
  • An MCP server for AI agents: ecfr-md mcp (stdio, or streamable HTTP
    with --http), and ecfr_md.mcp.server(ecfr) for apps that serve it
    themselves. Needs the new mcp extra (FastMCP 4.2), which all now
    includes. Read-only tools with output schemas and Markdown results:
    list_titles, outline (token estimates per entry), read (the text
    that fits a token budget, with a cursor to continue, full pinpoint
    paragraph labels, paragraph ids and what's around it), search,
    changes, history, compare (located redline with the amendments
    between the dates), references, cited_by, resolve_citation,
    verify_quote, define and settings; export writes only under
    --export-dir, and configure exists only with
    --allow-config-changes. Resources cfr:{address}, cfr:titles and
    ecfr-md:settings, with subscriptions that notify when the eCFR changes
    the text; citation completions; prompts for summarizing obligations,
    what changed, comparing provisions and finding a term; progress and
    cancellation for large fetches.
  • ecfr_md.define() / ECFR.define(term, citation) and
    ecfr-md define TERM CITATION: the definition of a term that governs a
    place in the CFR, found in the place's text and the definitions sections
    that apply to it (Definition, Definitions).
  • ecfr_md.verify_quote() / ECFR.verify_quote(citation, text) and
    ecfr-md verify CITATION --quote TEXT: whether a quotation is word for
    word at a pinpoint, else where it is or the nearest text (QuoteCheck).
  • ecfr_md.passages: text cut to a token budget at paragraph boundaries
    with a cursor (passage, Passage), and the paragraph at any offset
    (TextIndex).
  • --json on get (the same as --format json), sync and
    cache clear, so every command can print JSON.
  • An agent skill, skills/ecfr-md/SKILL.md, that teaches the command
    line, and an AI agents guide with setup for Claude Code and other MCP
    clients.
  • Not-found errors suggest near misses: "did you mean 164.502?".
  • ecfr-md serve: a web navigator for the CFR, run on this computer
    (web extra: Starlette, uvicorn, Jinja2). Paths mirror ecfr.gov
    (/current/..., /on/DATE/..., /compare/LATER/to/EARLIER/...), and
    /go?cite= resolves any citation. Pages for titles, divisions (contents
    with section counts and sizes), text, history, comparisons (an inline
    word-level redline), search, export in every format (downloaded, or saved
    to --save-dir) and settings (every Settings field, applied at once and
    optionally written to the config file). A command palette (⌘K) for
    citations, headings, known names, words, dates and actions; hover
    previews of cross-references and "open beside"; defined terms underlined
    with their definitions; paragraph and range deep links; copy with
    citation (OFR or Bluebook); a versions timeline; outline, focus, text size,
    density, light and dark; j/k/[/]/u keys. Text streams with a
    progress hairline, neighbouring pages are prerendered, a service worker
    keeps read pages offline, and there is a print stylesheet. Every page is
    also .md and .json, with /llms.txt and /openapi.json. It answers
    only local host names unless --host opens it, and refuses cross-site
    requests that change anything. ecfr_md.web.create_app() is the ASGI app.
  • ECFR.definitions(citation): every defined term that governs a place,
    nearest first, as the web navigator underlines them.
  • ecfr_md.compare.aligned(): both texts block by block, unchanged blocks
    included, for a whole-text redline; Difference.kind is "unchanged"
    for those.
  • The HTML writer is a class, render.html_writer.Writer, with a method
    per kind of block to override; inline <ins> and <del> are kept as
    insertions and deletions.
  • The all extra includes web.
  • MIT license. Releases are published on GitHub from version tags, with the
    wheel and source distribution attached and build provenance attested.
  • A documentation site with an API reference, built from the README,
    changelog and docstrings.
  • Navigation: nodes from a client have next and previous (the
    neighbouring section or appendix, across parts, chapters and titles),
    up (the parent, or the division above the text fetched) and outline
    (their entry in the outline of the whole CFR). Outline entries have
    next, previous, up, siblings and read(date=), which fetches the
    text. Nodes from load() raise ECFRError for these.
  • ecfr_md.outline() / ECFR.outline() with no citation: the whole CFR,
    one entry per title, each title's structure loaded when first opened.
  • Cross-references: Node.references, find_references(text, context)
    and Reference (start, end, text, target, citation, url,
    kind). Sections, lists and ranges of them, paragraphs "of this section"
    or "of § X", parts, subparts and appendices relative to the text, other
    titles, and citations of the U.S. Code, the Federal Register and public
    laws, which link to uscode.house.gov, federalregister.gov and
    congress.gov (templates USC_URL, FR_URL, PUBLIC_LAW_URL).
  • ecfr_md.cited_by() / ECFR.cited_by() and ecfr-md cited-by: sections
    that may cite a section or part, found by search (approximate).
  • ecfr-md references CITATION: a section's cross-references and what
    they refer to.
  • Linked Markdown: links= on save(), Node.save() and --links /
    --no-links on get; to_markdown(links=True). Trees link their
    cross-references to each other's files by default, and to the eCFR for
    anything outside the tree. Front matter records links.
  • Node.anchor: the eCFR's id for a paragraph (p-164.502(a)(1)),
    section (164.502), subpart, part or appendix.
  • ecfr-md outline of a section or appendix ends with the previous and
    next ones.
  • Offline reading: when the eCFR can't be reached, the newest cached title
    list and text are used, with an ECFRWarning that they may be out of
    date.
  • ecfr-md titles, ecfr_md.titles() and ECFR.titles(): every title with
    the latest date of its text (TitleInfo). A bare ecfr-md outline lists
    them too.
  • ecfr-md compare CITATION --since DATE [--until DATE], ECFR.compare()
    and ecfr_md.compare(): what changed between two dates, paragraph by
    paragraph and word by word (Comparison, Difference). changes ends
    with the compare command for the latest change.
  • search --in CITATION (within= in Python, and on every search
    endpoint) limits a search to a title or any part of it. Unquoted words
    form one query.
  • get_many(..., errors="return") keeps going past citations that fail.
  • In a terminal, get indents paragraphs, shows the section and parent
    paragraphs above a paragraph, pages long text (--no-pager), shows
    footnote marks as superscripts, and ends with the citation, date and
    eCFR link.
  • get -o - prints to stdout; get --from - reads stdin; --from lines
    may have # comments, quotes and lists.
  • cache info --json.
  • Export formats besides Markdown: plain text, HTML, JSON, EPUB, Word and PDF.
    Node.export(path, format=None) and save(..., format=) on nodes, ECFR
    and ecfr_md pick the format from the file's suffix (hipaa.pdf) unless
    format= names one; ecfr-md get -o hipaa.pdf and --format likewise,
    and get --format json|text|html prints. HTML pages are standalone, light
    and dark, print well, and anchor paragraphs with the eCFR's ids
    (#p-164.502(a)(1)). JSON is the node tree with each node's own text and
    provenance. Word documents use Word's heading styles; PDFs have a bookmark
    per heading, a running head and page numbers. With tree=True (--tree,
    and --all), text and HTML get a file per section and an index page per
    level, and the others a file per part, written as the text is read.
  • Extras docx (python-docx), pdf (Typst, which needs no system libraries)
    and all. Without one, saving raises MissingDependencyError, which says
    what to install.
  • Addresses: one short, shell-safe name for every place in the CFR, e.g.
    45/164.502/a/1, 45/part-164/subpart-E, 12/part-1026/supplement-I,
    26/1.401.k-1 (26 CFR 1.401(k)-1), 45/164.501/1~2 (the second of two
    (1)s), 45/164.502@2020-01-01; lists (45/164.502,164.504) and ranges of
    paragraphs (45/164.502/b..d).
  • Address: Address.parse reads addresses, citations (now also Bluebook
    forms, spaced 164.502 a 1 and dotted 164.502.a.1 markers), eCFR, LII and
    GovInfo links, GovInfo granule ids, USLM identifiers, cfr: URIs and the
    names of saved files, old and new. str(), .citation() ("ofr" or
    "bluebook"), .url(), .uri(), .file_name(); Address.parse_many for
    lists.
  • Everything that takes a citat...
Read more

ecfr-md 0.2.0rc1

ecfr-md 0.2.0rc1 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 19 Nov 11:26
952d19f

Install from GitHub; ecfr-md is not on PyPI.

Added

  • ecfr-md browse [CITATION] [--date DATE]: a full-screen terminal browser
    (the tui extra, Textual). The outline of the whole CFR beside the text,
    with a breadcrumb and the date of the text. Keys: g go to any citation
    (completed from the outline), / search, [/] previous and next
    section, j/k paragraphs, tab and enter (or a click) to follow
    cross-references, u up, b/f back and forward, d text as of a
    date, h changes with a redline of each, e export in every format, y
    copy the paragraph's citation, o the outline, ? keys. The all
    extra includes tui.
  • An MCP server for AI agents: ecfr-md mcp (stdio, or streamable HTTP
    with --http), and ecfr_md.mcp.server(ecfr) for apps that serve it
    themselves. Needs the new mcp extra (FastMCP 4.2), which all now
    includes. Read-only tools with output schemas and Markdown results:
    list_titles, outline (token estimates per entry), read (the text
    that fits a token budget, with a cursor to continue, full pinpoint
    paragraph labels, paragraph ids and what's around it), search,
    changes, history, compare (located redline with the amendments
    between the dates), references, cited_by, resolve_citation,
    verify_quote, define and settings; export writes only under
    --export-dir, and configure exists only with
    --allow-config-changes. Resources cfr:{address}, cfr:titles and
    ecfr-md:settings, with subscriptions that notify when the eCFR changes
    the text; citation completions; prompts for summarizing obligations,
    what changed, comparing provisions and finding a term; progress and
    cancellation for large fetches.
  • ecfr_md.define() / ECFR.define(term, citation) and
    ecfr-md define TERM CITATION: the definition of a term that governs a
    place in the CFR, found in the place's text and the definitions sections
    that apply to it (Definition, Definitions).
  • ecfr_md.verify_quote() / ECFR.verify_quote(citation, text) and
    ecfr-md verify CITATION --quote TEXT: whether a quotation is word for
    word at a pinpoint, else where it is or the nearest text (QuoteCheck).
  • ecfr_md.passages: text cut to a token budget at paragraph boundaries
    with a cursor (passage, Passage), and the paragraph at any offset
    (TextIndex).
  • --json on get (the same as --format json), sync and
    cache clear, so every command can print JSON.
  • An agent skill, skills/ecfr-md/SKILL.md, that teaches the command
    line, and an AI agents guide with setup for Claude Code and other MCP
    clients.
  • Not-found errors suggest near misses: "did you mean 164.502?".
  • ecfr-md serve: a web navigator for the CFR, run on this computer
    (web extra: Starlette, uvicorn, Jinja2). Paths mirror ecfr.gov
    (/current/..., /on/DATE/..., /compare/LATER/to/EARLIER/...), and
    /go?cite= resolves any citation. Pages for titles, divisions (contents
    with section counts and sizes), text, history, comparisons (an inline
    word-level redline), search, export in every format (downloaded, or saved
    to --save-dir) and settings (every Settings field, applied at once and
    optionally written to the config file). A command palette (⌘K) for
    citations, headings, known names, words, dates and actions; hover
    previews of cross-references and "open beside"; defined terms underlined
    with their definitions; paragraph and range deep links; copy with
    citation (OFR or Bluebook); a versions timeline; outline, focus, text size,
    density, light and dark; j/k/[/]/u keys. Text streams with a
    progress hairline, neighbouring pages are prerendered, a service worker
    keeps read pages offline, and there is a print stylesheet. Every page is
    also .md and .json, with /llms.txt and /openapi.json. It answers
    only local host names unless --host opens it, and refuses cross-site
    requests that change anything. ecfr_md.web.create_app() is the ASGI app.
  • ECFR.definitions(citation): every defined term that governs a place,
    nearest first, as the web navigator underlines them.
  • ecfr_md.compare.aligned(): both texts block by block, unchanged blocks
    included, for a whole-text redline; Difference.kind is "unchanged"
    for those.
  • The HTML writer is a class, render.html_writer.Writer, with a method
    per kind of block to override; inline <ins> and <del> are kept as
    insertions and deletions.
  • The all extra includes web.
  • MIT license. Releases are published on GitHub from version tags, with the
    wheel and source distribution attached and build provenance attested.
  • A documentation site with an API reference, built from the README,
    changelog and docstrings.
  • Navigation: nodes from a client have next and previous (the
    neighbouring section or appendix, across parts, chapters and titles),
    up (the parent, or the division above the text fetched) and outline
    (their entry in the outline of the whole CFR). Outline entries have
    next, previous, up, siblings and read(date=), which fetches the
    text. Nodes from load() raise ECFRError for these.
  • ecfr_md.outline() / ECFR.outline() with no citation: the whole CFR,
    one entry per title, each title's structure loaded when first opened.
  • Cross-references: Node.references, find_references(text, context)
    and Reference (start, end, text, target, citation, url,
    kind). Sections, lists and ranges of them, paragraphs "of this section"
    or "of § X", parts, subparts and appendices relative to the text, other
    titles, and citations of the U.S. Code, the Federal Register and public
    laws, which link to uscode.house.gov, federalregister.gov and
    congress.gov (templates USC_URL, FR_URL, PUBLIC_LAW_URL).
  • ecfr_md.cited_by() / ECFR.cited_by() and ecfr-md cited-by: sections
    that may cite a section or part, found by search (approximate).
  • ecfr-md references CITATION: a section's cross-references and what
    they refer to.
  • Linked Markdown: links= on save(), Node.save() and --links /
    --no-links on get; to_markdown(links=True). Trees link their
    cross-references to each other's files by default, and to the eCFR for
    anything outside the tree. Front matter records links.
  • Node.anchor: the eCFR's id for a paragraph (p-164.502(a)(1)),
    section (164.502), subpart, part or appendix.
  • ecfr-md outline of a section or appendix ends with the previous and
    next ones.
  • Offline reading: when the eCFR can't be reached, the newest cached title
    list and text are used, with an ECFRWarning that they may be out of
    date.
  • ecfr-md titles, ecfr_md.titles() and ECFR.titles(): every title with
    the latest date of its text (TitleInfo). A bare ecfr-md outline lists
    them too.
  • ecfr-md compare CITATION --since DATE [--until DATE], ECFR.compare()
    and ecfr_md.compare(): what changed between two dates, paragraph by
    paragraph and word by word (Comparison, Difference). changes ends
    with the compare command for the latest change.
  • search --in CITATION (within= in Python, and on every search
    endpoint) limits a search to a title or any part of it. Unquoted words
    form one query.
  • get_many(..., errors="return") keeps going past citations that fail.
  • In a terminal, get indents paragraphs, shows the section and parent
    paragraphs above a paragraph, pages long text (--no-pager), shows
    footnote marks as superscripts, and ends with the citation, date and
    eCFR link.
  • get -o - prints to stdout; get --from - reads stdin; --from lines
    may have # comments, quotes and lists.
  • cache info --json.
  • Export formats besides Markdown: plain text, HTML, JSON, EPUB, Word and PDF.
    Node.export(path, format=None) and save(..., format=) on nodes, ECFR
    and ecfr_md pick the format from the file's suffix (hipaa.pdf) unless
    format= names one; ecfr-md get -o hipaa.pdf and --format likewise,
    and get --format json|text|html prints. HTML pages are standalone, light
    and dark, print well, and anchor paragraphs with the eCFR's ids
    (#p-164.502(a)(1)). JSON is the node tree with each node's own text and
    provenance. Word documents use Word's heading styles; PDFs have a bookmark
    per heading, a running head and page numbers. With tree=True (--tree,
    and --all), text and HTML get a file per section and an index page per
    level, and the others a file per part, written as the text is read.
  • Extras docx (python-docx), pdf (Typst, which needs no system libraries)
    and all. Without one, saving raises MissingDependencyError, which says
    what to install.
  • Addresses: one short, shell-safe name for every place in the CFR, e.g.
    45/164.502/a/1, 45/part-164/subpart-E, 12/part-1026/supplement-I,
    26/1.401.k-1 (26 CFR 1.401(k)-1), 45/164.501/1~2 (the second of two
    (1)s), 45/164.502@2020-01-01; lists (45/164.502,164.504) and ranges of
    paragraphs (45/164.502/b..d).
  • Address: Address.parse reads addresses, citations (now also Bluebook
    forms, spaced 164.502 a 1 and dotted 164.502.a.1 markers), eCFR, LII and
    GovInfo links, GovInfo granule ids, USLM identifiers, cfr: URIs and the
    names of saved files, old and new. str(), .citation() ("ofr" or
    "bluebook"), .url(), .uri(), .file_name(); Address.parse_many for
    lists.
  • Everything that takes a citation takes any of those: get, save,
    outline, changes, get_many, search(within=), get --from and the
    CLI's citation words.
  • A trailing year, as in a Bluebook citation (45 C.F.R. § 164.502 (2018)),
    means that year's annual edition of the title (January 1 for titles 1–16,
    April 1 for 17–27, July 1 for 28–41, October 1 for 42–50), instead of being
    an error. A date in an address (@2020-01-01) is used likewise.
  • Node.address, Node.uri (cfr:45/164.502@2024-01-01), Node.cite(style=, year=); `...
Read more

v0.1.0

Choose a tag to compare

@ptmorris05 ptmorris05 released this 10 Oct 03:15
fix tests on windows