Skip to content

[http-client-python] Map numeric scalar to Python float - #10563

Merged
Yuchao Yan (msyyc) merged 5 commits into
mainfrom
copilot/fix-python-emitter-numeric-mapping
May 12, 2026
Merged

[http-client-python] Map numeric scalar to Python float#10563
Yuchao Yan (msyyc) merged 5 commits into
mainfrom
copilot/fix-python-emitter-numeric-mapping

Conversation

Copilot AI commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

The Python emitter mapped the TypeSpec numeric scalar to int, truncating floating-point values for operations like:

op nooooooo(): numeric;

Since numeric is the parent of both integer and float scalars, int is unsound — float is the correct Python representation.

Changes

  • packages/http-client-python/emitter/src/types.ts: In sdkScalarKindToPythonKind, change numeric: "integer"numeric: "float".
  • Changeset: Added a fix entry for @typespec/http-client-python.

Copilot AI changed the title [WIP] Fix Python emitter numeric mapped to int issue [http-client-python] Map numeric scalar to Python float Apr 29, 2026
@microsoft-github-policy-service microsoft-github-policy-service Bot added the emitter:client:python Issue for the Python client emitter: @typespec/http-client-python label Apr 29, 2026
@pkg-pr-new

pkg-pr-new Bot commented May 11, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/http-client-python@10563

commit: 26759a9

@github-actions

github-actions Bot commented May 11, 2026

Copy link
Copy Markdown
Contributor

All changed packages have been documented.

  • @typespec/http-client-python
Show changes

@typespec/http-client-python - fix ✏️

Fix TypeSpec numeric scalar type being emitted as int in Python; it is now emitted as float.

@azure-sdk

Copy link
Copy Markdown
Collaborator

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

@msyyc
Yuchao Yan (msyyc) added this pull request to the merge queue May 12, 2026
Merged via the queue into main with commit 36825c1 May 12, 2026
41 checks passed
@msyyc
Yuchao Yan (msyyc) deleted the copilot/fix-python-emitter-numeric-mapping branch May 12, 2026 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:client:python Issue for the Python client emitter: @typespec/http-client-python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Python Emitter: numeric mapped to int

4 participants