Skip to content

[typespec-python] simplify eng#4399

Draft
msyyc wants to merge 20 commits intomainfrom
python-update-eng
Draft

[typespec-python] simplify eng#4399
msyyc wants to merge 20 commits intomainfrom
python-update-eng

Conversation

@msyyc
Copy link
Copy Markdown
Member

@msyyc msyyc commented May 8, 2026

Summary

Reduce duplication between typespec-python (a thin wrapper) and upstream @typespec/http-client-python so we don't keep maintaining two copies of the same eng/test scaffolding by hand.

Approach

  • eng/scripts/sync.ts — new allow-list mirror that copies a curated set of shared files from a sibling checkout (<repo-root>/core/packages/http-client-python/) into this package. Supports --check for CI drift detection.
  • eng/scripts/ci/regenerate-common.ts — shared helpers / spec tables / prepareBaselineOfGeneratedCode, byte-identical with the upstream copy. Synced.
  • eng/scripts/ci/regenerate.ts — kept per-repo: wrapper does single-phase in-process regen; upstream does two-phase. Imports common helpers, owns only paths/argv/orchestration.
  • dev_requirements.txt — synced as a section (everything before the # additional dependency needed for development marker is replaced from upstream; wrapper-only deps like setuptools are preserved).
  • Synced shared CI runners: run_apiview.py, run_mypy.py, run_pylint.py, run_pyright.py, run_sphinx_build.py, util.py, plus mypy.ini, pylintrc, pyrightconfig.json.
  • Synced shared test assets / drivers: tests/data/, tests/mock_api/, tests/requirements/, tests/conftest.py, tests/install_packages.py, tests/tox.ini, and the generator/ (pygen) tree.
  • eng/scripts/setup/* is intentionally not synced — the wrapper owns its own setup pipeline (install.py, prepare.py, venvtools.py, …).
  • .gitignore updated so synced directories (mirrored on demand by pnpm sync) start empty in fresh checkouts.

Result

Most engineering files now have a single upstream source of truth; wrapper-specific divergence is limited to the orchestrator (regenerate.ts), the setup scripts, and the small wrapper-only tail of dev_requirements.txt. CI keeps everything honest via pnpm sync --check.

@microsoft-github-policy-service microsoft-github-policy-service Bot added the emitter:python Issues for @azure-tools/typespec-python emitter label May 8, 2026
@azure-sdk
Copy link
Copy Markdown
Collaborator

azure-sdk commented May 8, 2026

All changed packages have been documented.

  • @azure-tools/typespec-python
Show changes

@azure-tools/typespec-python - internal ✏️

Simplify eng system for typespec-python

@github-actions

This comment was marked as off-topic.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 8, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@azure-tools/typespec-python@4399

commit: 4ad8b90

@azure-sdk
Copy link
Copy Markdown
Collaborator

azure-sdk commented May 8, 2026

You can try these changes here

🛝 Playground 🌐 Website

@Azure Azure deleted a comment from github-actions Bot May 8, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

⚡ Benchmark Results

Comparing [5e8e90d] against baseline [f4ca533]

Metric Baseline Current Change
total 🔴 851.3ms 🔴 854.5ms +0.4%
loader 🟢 169.6ms 🟢 177.9ms +4.8%
resolver 🟢 18.8ms 🟢 19.3ms +2.9%
checker 🟡 205.3ms 🟡 206.8ms +0.8%
validation 🟢 42.6ms 🟢 41.7ms -2.2%
 ↳ validation/@azure-tools/typespec-azure-core 🟢 7.2ms 🟢 6.9ms -3.6%
 ↳ validation/@typespec/http 🟢 7.1ms 🟢 6.3ms -10.7% 🟢
 ↳ validation/@typespec/rest 🟢 0.6ms 🟢 0.5ms -7.6% 🟢
 ↳ validation/@typespec/versioning 🔴 26.3ms 🔴 26.4ms +0.2%
 ↳ validation/compiler 🟢 1.5ms 🟢 1.6ms +3.4%
linter 🟢 155.2ms 🟢 150.6ms -2.9%
 ↳ linter/@azure-tools/typespec-azure-core/auth-required 🟢 0.0ms 🟢 0.0ms -14.2% 🟢
 ↳ linter/@azure-tools/typespec-azure-core/bad-record-type 🟢 0.2ms 🟢 0.2ms +2.0%
 ↳ linter/@azure-tools/typespec-azure-core/byos 🟢 6.2ms 🟢 6.5ms +4.5%
 ↳ linter/@azure-tools/typespec-azure-core/casing-style 🟢 0.7ms 🟢 0.6ms -2.6%
 ↳ linter/@azure-tools/typespec-azure-core/composition-over-inheritance 🟢 0.1ms 🟢 0.1ms +0.8%
 ↳ linter/@azure-tools/typespec-azure-core/documentation-required 🟢 0.8ms 🟢 0.8ms +2.1%
 ↳ linter/@azure-tools/typespec-azure-core/friendly-name 🟢 0.7ms 🟢 0.7ms +0.6%
 ↳ linter/@azure-tools/typespec-azure-core/key-visibility-required 🟢 0.2ms 🟢 0.2ms -2.2%
 ↳ linter/@azure-tools/typespec-azure-core/known-encoding 🟢 0.2ms 🟢 0.2ms -2.8%
 ↳ linter/@azure-tools/typespec-azure-core/long-running-polling-operation-required 🟢 0.3ms 🟢 0.3ms +1.3%
 ↳ linter/@azure-tools/typespec-azure-core/no-case-mismatch 🟢 0.2ms 🟢 0.2ms +7.1% 🔴
 ↳ linter/@azure-tools/typespec-azure-core/no-closed-literal-union 🟢 0.3ms 🟢 0.3ms +0.3%
 ↳ linter/@azure-tools/typespec-azure-core/no-enum 🟢 0.0ms 🟢 0.0ms +1.0%
 ↳ linter/@azure-tools/typespec-azure-core/no-error-status-codes 🟢 0.1ms 🟢 0.1ms -2.9%
 ↳ linter/@azure-tools/typespec-azure-core/no-explicit-routes-resource-ops 🟢 0.1ms 🟢 0.1ms +9.5% 🔴
 ↳ linter/@azure-tools/typespec-azure-core/no-format 🟢 0.5ms 🟢 0.5ms +2.1%
 ↳ linter/@azure-tools/typespec-azure-core/no-generic-numeric 🟢 0.4ms 🟢 0.4ms +0.9%
 ↳ linter/@azure-tools/typespec-azure-core/no-header-explode 🔴 27.7ms 🔴 22.7ms -18.0% 🟢
 ↳ linter/@azure-tools/typespec-azure-core/no-legacy-usage 🟢 1.1ms 🟢 1.1ms -0.9%
 ↳ linter/@azure-tools/typespec-azure-core/no-multiple-discriminator 🟢 0.1ms 🟢 0.1ms +0.2%
 ↳ linter/@azure-tools/typespec-azure-core/no-nullable 🟢 0.2ms 🟢 0.2ms -3.0%
 ↳ linter/@azure-tools/typespec-azure-core/no-offsetdatetime 🟢 1.3ms 🟢 1.3ms +0.4%
 ↳ linter/@azure-tools/typespec-azure-core/no-openapi 🟢 2.2ms 🟢 1.9ms -14.0% 🟢
 ↳ linter/@azure-tools/typespec-azure-core/no-private-usage 🟢 1.9ms 🟢 2.1ms +11.1% 🔴
 ↳ linter/@azure-tools/typespec-azure-core/no-query-explode 🔴 22.2ms 🔴 22.8ms +2.6%
 ↳ linter/@azure-tools/typespec-azure-core/no-response-body 🔴 24.8ms 🔴 24.3ms -2.1%
 ↳ linter/@azure-tools/typespec-azure-core/no-rest-library-interfaces 🟢 0.0ms 🟢 0.0ms -4.5%
 ↳ linter/@azure-tools/typespec-azure-core/no-route-parameter-name-mismatch 🟢 6.1ms 🟢 5.9ms -3.8%
 ↳ linter/@azure-tools/typespec-azure-core/no-rpc-path-params 🟢 0.2ms 🟢 0.2ms +2.8%
 ↳ linter/@azure-tools/typespec-azure-core/no-string-discriminator 🟢 0.1ms 🟢 0.1ms -1.0%
 ↳ linter/@azure-tools/typespec-azure-core/no-unknown 🟢 0.2ms 🟢 0.2ms -0.9%
 ↳ linter/@azure-tools/typespec-azure-core/no-unnamed-union 🟢 0.3ms 🟢 0.3ms -3.1%
 ↳ linter/@azure-tools/typespec-azure-core/operation-missing-api-version 🟢 0.2ms 🟢 0.2ms +6.2% 🔴
 ↳ linter/@azure-tools/typespec-azure-core/request-body-problem 🟢 0.2ms 🟢 0.2ms -1.5%
 ↳ linter/@azure-tools/typespec-azure-core/require-versioned 🟢 0.0ms 🟢 0.0ms +6.4% 🔴
 ↳ linter/@azure-tools/typespec-azure-core/response-schema-problem 🔴 24.2ms 🔴 23.4ms -3.3%
 ↳ linter/@azure-tools/typespec-azure-core/rpc-operation-request-body 🟢 0.3ms 🟢 0.3ms +3.6%
 ↳ linter/@azure-tools/typespec-azure-core/spread-discriminated-model 🟢 0.3ms 🟢 0.3ms -0.1%
 ↳ linter/@azure-tools/typespec-azure-core/use-standard-names 🟢 5.4ms 🟢 5.5ms +2.1%
 ↳ linter/@azure-tools/typespec-azure-core/use-standard-operations 🟢 0.1ms 🟢 0.1ms +0.1%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-common-types-version 🟢 6.5ms 🟢 8.6ms +32.6% 🔴
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-custom-resource-no-key 🟢 0.1ms 🟢 0.1ms -1.5%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-custom-resource-usage-discourage 🟢 0.1ms 🟢 0.1ms -12.6% 🟢
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes 🟢 7.2ms 🟢 9.7ms +35.8% 🔴
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-no-record 🟢 0.4ms 🟢 0.4ms -9.4% 🟢
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-post-operation-response-codes 🟢 0.7ms 🟢 0.7ms -1.4%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes 🟢 0.0ms 🟢 0.0ms +15.7% 🔴
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-action-no-segment 🟢 0.3ms 🟢 0.2ms -5.0%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-duplicate-property 🟢 0.1ms 🟢 0.1ms -2.6%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator 🟢 0.0ms 🟢 0.0ms -14.8% 🟢
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-action-verb 🟢 0.1ms 🟢 0.1ms -4.0%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property 🟢 0.1ms 🟢 0.1ms -1.8%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-version-format 🟢 0.1ms 🟢 0.1ms +4.3%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-key-invalid-chars 🟢 0.3ms 🟢 0.3ms -5.3% 🟢
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-name-pattern 🟢 0.0ms 🟢 0.0ms +20.9% 🔴
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-operation 🟢 0.2ms 🟢 0.2ms -1.1%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-operation-response 🟢 8.4ms 🟡 10.3ms +23.6% 🔴
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-patch 🟢 0.4ms 🟢 0.4ms -2.7%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-path-segment-invalid-chars 🟢 0.2ms 🟢 0.2ms -4.8%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-provisioning-state 🟢 0.1ms 🟢 0.1ms +10.0% 🔴
 ↳ linter/@azure-tools/typespec-azure-resource-manager/beyond-nesting-levels 🟢 0.1ms 🟢 0.1ms +2.9%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/empty-updateable-properties 🟢 0.2ms 🟢 0.2ms +12.0% 🔴
 ↳ linter/@azure-tools/typespec-azure-resource-manager/improper-subscription-list-operation 🟢 0.0ms 🟢 0.0ms -10.9% 🟢
 ↳ linter/@azure-tools/typespec-azure-resource-manager/lro-location-header 🟡 18.9ms 🟡 16.9ms -10.4% 🟢
 ↳ linter/@azure-tools/typespec-azure-resource-manager/missing-operations-endpoint 🟢 0.0ms 🟢 0.0ms +9.7% 🔴
 ↳ linter/@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers 🟢 0.3ms 🟢 0.3ms -6.3% 🟢
 ↳ linter/@azure-tools/typespec-azure-resource-manager/no-empty-model 🟢 0.2ms 🟢 0.1ms -6.9% 🟢
 ↳ linter/@azure-tools/typespec-azure-resource-manager/no-resource-delete-operation 🟢 0.2ms 🟢 0.2ms -1.2%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/no-response-body 🔴 31.1ms 🔴 26.8ms -14.0% 🟢
 ↳ linter/@azure-tools/typespec-azure-resource-manager/patch-envelope 🟢 0.1ms 🟢 0.2ms +3.6%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/resource-name 🟢 0.2ms 🟢 0.2ms -1.0%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/secret-prop 🟢 2.6ms 🟢 3.1ms +20.5% 🔴
 ↳ linter/@azure-tools/typespec-azure-resource-manager/unsupported-type 🟢 0.5ms 🟢 0.4ms -6.6% 🟢
 ↳ linter/@azure-tools/typespec-azure-resource-manager/version-progression 🟢 0.0ms 🟢 0.0ms -2.5%
 ↳ linter/@azure-tools/typespec-client-generator-core/property-name-conflict 🟢 1.1ms 🟢 1.1ms -0.1%
 ↳ linter/@azure-tools/typespec-client-generator-core/require-client-suffix 🟢 0.2ms 🟢 0.4ms +126.7% 🔴
emit 🟡 259.8ms 🟡 258.1ms -0.6%
 ↳ emit/@azure-tools/typespec-autorest 🟢 163.2ms 🟢 162.3ms -0.6%
 ↳ emit/@typespec/openapi3 🟢 144.8ms 🟢 143.6ms -0.8%
 ↳ emit/@typespec/openapi3/compute 🟢 129.7ms 🟢 128.9ms -0.6%
 ↳ emit/@typespec/openapi3/write 🟢 15.0ms 🟢 14.6ms -2.5%

Averaged across 3 specs (azure-arm-resource-manager, azure-core-dataplane, azure-full).
Threshold: changes > ±5% are highlighted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:python Issues for @azure-tools/typespec-python emitter eng

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants