Skip to content

fix(python): stabilize generated imports for 3.9.9 - #598

Merged
clemensv merged 1 commit into
masterfrom
fix/python-import-order-399-a392eeae
Nov 29, 2026
Merged

clemensv merged 1 commit into
masterfrom
fix/python-import-order-399-a392eeae

Conversation

@clemensv

Copy link
Copy Markdown
Owner

Draft and incomplete pull requests are welcome.

What changed and why?

Fixes #597. Sort named-type imports before rendering Python production classes and generated test modules. This follows the existing JSON Structure-to-Python converter pattern.

The regression runs the real converter in three fresh Python processes with different hash seeds and compares every production Python source byte. Every emitted Python file is also compiled. Avro test sample values remain random; neither generated output nor sample values are normalized.

Prepare immutable 3.9.9 release notes and align the MCP package metadata. Schema types, field order and serialization behavior are unchanged.

How did you check it?

$py denotes the isolated Python 3.11.9 validation interpreter; commands run from the repository root with local source imports.

  • Before the fix: & $py -m pytest test\test_avrotopython.py -k dependency_imports_are_reproducible_across_hash_seeds --no-header -q -p no:cacheprovider --basetemp tmp\597-red-work\pytest — 1 failed, as expected; the generated production record changed with hash seed 2.
  • After the fix: & $py -m pytest test\test_avrotopython.py -k 'dependency_imports_are_reproducible_across_hash_seeds or record_union_branches_accept_instances_and_dictionaries or nested_collection_records_preserve_temporal_and_binary_json_values or nullable_falsy_values_survive_json_and_avro_roundtrips or no_double_test_prefix_in_import_types' --no-header -q -p no:cacheprovider --basetemp tmp\597-green-work\pytest — 5 passed, 7 subtests passed.
  • Converter source-origin verification and compilation of both changed Python modules — passed.
  • git --no-pager diff --check — passed.
  • MCP top-level and package versions both equal 3.9.9 — passed. Full publisher schema validation remains the normal CI check.

The full multi-language suite and release publication were not run locally; normal exact-head CI and tag gates must pass before publication.

Anything else? (optional)

The downstream xrcg 0.11.5 repair for xregistry/codegen#723 requires this released converter fix. Its local combined regression run passed with this source, but that is not PyPI-byte qualification.

Existing tags remain unchanged. No hash-seed workaround, generated-file edit, deployment change or credential work.

Sort named-type imports before rendering Python classes and test modules.
Verify production source bytes across three fresh-process hash seeds while
retaining random Avro test sample values. Prepare the 3.9.9 patch release.

Fixes #597

Signed-off-by: Clemens Vasters <clemens@vasters.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@clemensv
clemensv merged commit 657c920 into master Nov 29, 2026
26 checks passed
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.

Python named-type imports vary across hash seeds

1 participant