Skip to content

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

Merged
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
msyyc merged 5 commits into
mainfrom
copilot/fix-python-emitter-numeric-mapping

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 29, 2026

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 linked an issue Apr 29, 2026 that may be closed by this pull request
4 tasks
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
Copilot AI requested a review from msyyc April 29, 2026 23:57
@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
Copy link
Copy Markdown

pkg-pr-new Bot commented May 11, 2026

Open in StackBlitz

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

commit: 26759a9

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 11, 2026

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 msyyc enabled auto-merge May 12, 2026 07:18
@msyyc 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 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