← 输入框|github.com|刷新
Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: finos/morphir-python
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: python-v0.0.2
Choose a base ref
...
head repository: finos/morphir-python
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: python-v0.0.3
Choose a head ref
  • 2 commits
  • 116 files changed
  • 1 contributor

Commits on Oct 27, 2026

  1. feat: maintain the Python compiler here with a native API, CLI and ex…

    …tension bundle (#41)
    
    * docs: plan Python binding migration
    
    Link the A4 migration to native Python API, CLI round trips and
    
    coordinated provider cutover without assuming a Rust speed advantage.
    
    Refs: morphir-ukvn.1.6
    
    * docs: ground Python bridge in community examples
    
    * feat(rust): move morphir-python-binding from morphir-rust
    
    Copy crates/morphir-python-binding from finos/morphir-rust main
    0aa60eb799d46f8a317ec47abef4a7a4e61dc8ac (no binding changes since the
    inspected f4298d0 snapshot) into a new rust/ Cargo workspace. Resolve
    morphir-core =0.2.0 and morphir-extension-sdk =0.3.0 from crates.io
    instead of sibling paths and keep the four Ruff crates pinned together
    at =0.0.15. Pin Rust 1.98.1 and wasm-tools in mise. Update README links
    for the new repository and document external Cargo use.
    
    * docs(openspec): mark standalone Rust compiler tasks done
    
    * fix(rust): initialize the MEP session in the binding examples
    
    The SDK refuses compile and generate requests before initialization, so
    both examples failed with RPC error -32014 at morphir-rust 0aa60eb too.
    Send the initialize handshake first, as the test support does.
    
    * feat(python): add the native compiler bridge and typed API
    
    Add rust/crates/morphir-python-native, a PyO3 0.30.1 bridge built as
    morphir_python_native._native. It extracts an owned request, detaches
    from the interpreter, calls the binding's Frontend and Backend traits,
    catches panics, and returns private JSON with IR as text. The compiler
    crate stays free of PyO3.
    
    Add the Maturin 1.15.0 distribution morphir-python-native 0.1.0 with
    stubs and py.typed, wired into the uv workspace. morphir-python pins it
    exactly. morphir_tools.python adds compile_sources, generate_python and
    native_compiler with frozen result unions, a severity enum, source
    locations separate from IR paths, centralized codes, and a lazy loader
    that rejects mismatched distribution, module or bridge versions.
    
    * feat(cli): add morphir-python compile and generate
    
    compile reads one file or a sorted directory tree without following
    symbolic links, and writes a v3 Library by default or draft v4 with
    --ir-version v4. Repeated --expose options select public modules. A
    failure keeps an existing output file. generate decodes with the shared
    format reader and codecs, validates artifact paths and collisions,
    requires a new or empty real directory, and publishes a staged tree as
    a whole. Both commands load the compiler lazily, so ir inspect and ir
    convert never initialize it.
    
    * docs: add the Python compiler guide and BDD scenarios
    
    Document installation, the typed API, diagnostics, CLI options, the
    supported subset and source builds. Add behave scenarios for compile,
    generate and recompile in both IR versions, rejection, output
    protection and in-process API use, and run the guide's example as a
    test. Exclude rust/ compiler inputs from Ruff.
    
    * chore: keep compiler sample imports out of TYPE_CHECKING blocks
    
    * build(native): qualify native wheels, source archives and clean installs
    
    Add scripts/qualify_native.py. It checks a native wheel's cp314-abi3
    name, module, stubs, py.typed, license and metadata against the crate
    version, the tools pin and EXPECTED_NATIVE_VERSION; builds a wheel from
    the source archive alone outside the checkout; and installs the exact
    core, native and tools wheels with Rust off PATH to exercise the API,
    the CLI round trip, a library-only install and refusal of a mismatched
    native install. Each check prints a digest receipt. The stub now
    declares __all__, so mypy.stubtest finds no difference.
    
    * build: add mise tasks for Rust, native and bundle checks
    
    rust:check formats, lints and tests the workspace, runs the examples,
    proves the compiler crate has no PyO3 and validates the release WASM
    imports only the Extism host. rust:consumer builds an independent Cargo
    consumer of HEAD. native:build and native:qualify build and qualify the
    native wheel and source archive. extension:bundle packages and checks
    the MEP bundle offline. install can reuse a prebuilt native wheel or
    skip it; typecheck covers the stubs and tests run stubtest.
    
    * feat(ir): read every v4 spelling the pinned schema accepts
    
    The finos/morphir v4 JSON profile at efa36060 says that readers MUST accept
    every spelling the v4 JSON Schema marks as valid. The draft v4 reader read
    only the expanded spelling, so it refused the compact canonical output of
    Rust morphir-core 0.2.0, which the migrated Python compiler writes.
    
    The reader now accepts:
    
    - bare FQName and lowercase-name strings and bare arrays at type position;
    - bare booleans, numbers (integer or float by lexeme), names, FQNames and
      arrays at value position (decision 0009);
    - the compact payloads of Variable, Reference (string or [fqn, args...]),
      Tuple, List, Literal, Constructor, FieldFunction, TuplePattern and
      LiteralPattern, and the {"value": x} literal payload;
    - legacy name, path and FQName arrays, legacy constructor and value
      specification input arrays, and legacy tagged-array type definitions and
      specifications;
    - doc flattened beside a definition or specification (decision 0010);
    - the Public/Private/public/private/pub access spellings, the legacy
      {"access", "value"} form and the flattened {"access", ...} form.
    
    Each spelling gives the same model as the expanded one, and the writer still
    emits the expanded spelling. Spellings the schema does not allow still fail
    with a located diagnostic. The reader now also refuses a DecimalLiteral that
    is not a decimal lexeme, a non-finite FloatLiteral, a DocumentLiteral in a
    LiteralPattern, and a doc on a let-bound value definition, which the Python
    model cannot hold.
    
    Tests decode the Python compiler output (morphir-python-binding 0.4.0) and
    the finos/morphir v4 examples at efa36060, which are checked in as fixtures.
    
    * build(extension): package and qualify the MEP bundle here
    
    rust/extension.toml declares the morphir-python extension and pins the
    canonical WASM packager (finos/morphir-rust 0aa60eb) and the Morphir CLI
    0.4.0-beta.10 by digest. The finos/morphir extension bundle command
    handles native process extensions only. scripts/extension_bundle.py runs
    the pinned packager unchanged on this repository's declaration, checks
    the bundle, then installs it with the pinned CLI, deletes the
    repository, blocks network access and round trips IR v3 and v4. The
    host's IR must equal the Python API's.
    
    * ci: select checks by change and qualify native and extension releases
    
    scripts/ci_changes.py maps changed paths to python, native, rust and
    bundle categories; unknown paths, workflow changes, pushes and release
    calls run everything. The All Checks aggregate fails for a failed,
    cancelled, missing or unexpectedly skipped job. CI builds one Linux
    x86_64 manylinux_2_28 wheel and source archive, audits it, and reuses it
    for tests, the bundle host check and clean-install qualification.
    
    release.yml adds native-v and extension/python/v tags: a five-platform
    wheel matrix that installs each exact wheel without Rust, candidate
    verification with a SHA256SUMS receipt, and approval-gated publication.
    A python-v release waits until its pinned native release is on PyPI.
    Document the extension, the release order and the new tasks.
    
    * fix(native): build the CPython module only with the python feature
    
    PyO3's build script needs an interpreter, and mise points VIRTUAL_ENV at
    a .venv that the Rust CI job does not create. Maturin now enables a
    python feature for the module; Rust tests, examples and benchmarks of
    the bridge logic build without Python, and rust:check lints the module
    with the feature. Expose compile_request so benchmarks time the same
    request. The wheel audit takes ownership of the container's output.
    
    * perf: add a reproducible compiler cost benchmark
    
    mise run bench builds and installs the release native wheel, then
    scripts/bench.py times the Rust trait calls and the JSON bridge (via a
    release-build Rust example), the CPython module, the public API, the v3
    and v4 codecs, the CLI in new processes, cold import, and ast.parse as a
    parsing-only baseline. It uses the checked-in sample and a generated
    multi-module input with scale parameters, records warmup, repetitions,
    input and IR sizes, toolchains, hardware and the native module digest,
    and writes raw samples plus an HTML report under .dev/bench.
    
    * perf: state observations in the benchmark report
    
    Derive per-input statements from the medians and re-render a report
    from saved results with --report-only.
    
    * fix(compiler): accept empty v4 documentation and test codec agreement
    
    IR that morphir.ir.migrate.v3_to_v4 produces carries the empty
    documentation every v3 member has. The v4 backend rejected any
    documentation, although the v3 reader already treats empty text as
    absent. Treat empty v4 documentation the same way; text is still
    rejected. Bump morphir-python-binding to 0.4.1, the first version
    released from this repository, so it never shares a version with a
    different finos/morphir-rust bundle.
    
    Add cross-codec tests: arbitrary v4 integers and nested tuples, the v3
    64-bit limit, compact and expanded v4 generating the same Python,
    explicit refusal of migrated typed values and of downgrades without
    documentation, warnings kept on success, and both type checkers on the
    documented example. Document the limits. Remove an invalid fmt comment.
    
    * chore: ignore built extension bundles
    
    * build(native): install and exercise the wheel built from the source archive
    
    * docs(openspec): mark API, CLI, packaging and benchmark tasks done
    
    * docs(openspec): record implementation findings in the design
    
    * fix: address review findings on output, errors, v4 names and release checks
    
    - generate and compile publish with the umask's mode, or keep an
      existing directory's or file's mode, instead of 0700 and 0600.
    - Non-UTF-8 sources and internal compiler errors end with a message,
      not a traceback.
    - v4 FQName strings need a package and a module path, as the schema's
      pattern requires.
    - The wheel audit matches auditwheel's verdict, not the file name, and
      runs with pipefail.
    - A python-v release tests the published native wheel and refuses if
      the compiler changed after its native-v tag.
    - Changes to extension_bundle.py run lint and type checks, and
      .gitignore changes run the packaging checks.
    
    * fix(ci): install the native wheel in release-check
    
    The CLI wheel now requires morphir-python-native, which is not on PyPI
    until its first release. release-check installs the wheel CI built, or
    for a python-v release resolves the published one, and leaves the
    first-party native package out of the third-party vulnerability audit.
    The Build job downloads the native artifact before this step.
    
    * docs(openspec): mark the morphir-rust removal branch prepared
    
    * docs(openspec): mark scoped CI and bundle qualification tasks done
    
    * fix(release): make native install qualification portable
    
    The aarch64 audit now takes ownership of the container's dist output,
    the Rust-free PATH also drops directories that hold only rustup, and
    the Windows virtual environment interpreter is Scripts/python.exe. The
    first five-platform qualification run built and checked every wheel but
    failed in these steps.
    
    * docs(openspec): mark the finos/morphir provider cutover branch prepared
    
    * docs(openspec): mark platform and release qualification tasks done
    
    * docs(openspec): mark the coordinated qualification record done
    
    * fix: address Codex review findings
    
    - Pass RELEASE_TAG to native qualification in CI, so a python-v release
      qualifies the published native wheel and refuses a compiler change
      since its native-v tag.
    - Report a decimal lexeme outside Python's Decimal range as
      invalid_literal instead of raising InvalidOperation.
    DamianReeves authored Oct 27, 2026
    Configuration menu
    Copy the full SHA
    58f2954 View commit details
    Browse the repository at this point in the history
  2. chore(release): prepare morphir 0.0.2 and morphir-python 0.0.3 (#44)

    morphir 0.0.2 publishes the v4 reader that accepts every schema-valid
    spelling, which compiler v4 output needs. morphir-python 0.0.3 adds the
    Python compiler API and compile/generate commands, requires morphir
    0.0.2 and pins morphir-python-native 0.1.0.
    DamianReeves authored Oct 27, 2026
    Configuration menu
    Copy the full SHA
    0d7e2eb View commit details
    Browse the repository at this point in the history
Loading