Skip to content

Align lineardoc Python API with JavaScript implementation - #3

Draft
MrIbrahem with Copilot wants to merge 2 commits into
mainfrom
copilot/compare-python-js-code
Draft

Align lineardoc Python API with JavaScript implementation#3
MrIbrahem with Copilot wants to merge 2 commits into
mainfrom
copilot/compare-python-js-code

Conversation

Copilot AI commented Feb 5, 2026

Copy link
Copy Markdown
Contributor

Python's lineardoc module was exporting internal utilities (from .utils import *, get_prop) that JavaScript keeps private. This created API inconsistency between implementations.

Changes

  • Removed wildcard import from .utils import * - keeps utility functions (esc, find_all, is_reference, etc.) internal
  • Removed get_prop export - moves from public API to internal helper
  • Reordered imports to match JavaScript structure
  • Added detailed comparison report documenting all differences found

API Impact

Before:

from lib.lineardoc import Doc, Parser, esc, get_prop  # utils leaked

After:

from lib.lineardoc import Doc, Parser  # ✓
from lib.lineardoc import esc          # ImportError - internal only
from lib.lineardoc.utils import esc    # ✓ explicit access still works

Both implementations now export exactly 8 classes: Doc, TextBlock, TextChunk, Builder, Parser, Contextualizer, MwContextualizer, Normalizer.

See LINEARDOC_COMPARISON_REPORT.md for complete analysis of differences between implementations.

Original prompt

On init.py, Compare this python code with js code in https://github.com/wikimedia/mediawiki-services-cxserver/tree/master/lib/lineardoc, create report what missing or need to be updated or different


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: MrIbrahem <26301308+MrIbrahem@users.noreply.github.com>
Copilot AI changed the title [WIP] Compare Python implementation with JavaScript in CXServer Align lineardoc Python API with JavaScript implementation Feb 5, 2026
Copilot AI requested a review from MrIbrahem February 5, 2026 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants