Skip to content

release: 1.7.0#383

Open
stainless-app[bot] wants to merge 8 commits intomainfrom
release-please--branches--main--changes--next
Open

release: 1.7.0#383
stainless-app[bot] wants to merge 8 commits intomainfrom
release-please--branches--main--changes--next

Conversation

@stainless-app
Copy link
Contributor

@stainless-app stainless-app bot commented Aug 26, 2025

Automated Release PR

1.7.0 (2025-09-05)

Full Changelog: v1.6.1...v1.7.0

Features

  • improve future compat with pydantic v3 (f7fb91f)
  • types: replace List[str] with SequenceNotStr in params (710c462)

Bug Fixes

  • avoid newer type syntax (5c97e72)

Chores

  • internal: add Sequence related utils (520fe6e)
  • internal: change ci workflow machines (1881af9)
  • internal: move mypy configurations to pyproject.toml file (3f24a05)
  • internal: update pyright exclude list (84619ef)

This pull request is managed by Stainless's GitHub App.

The semver version number is based on included commit messages. Alternatively, you can manually set the version number in the title of this pull request.

For a better experience, it is recommended to use either rebase-merge or squash-merge when merging this pull request.

🔗 Stainless website
📚 Read the docs
🙋 Reach out for help or questions

@graphite-app
Copy link
Contributor

graphite-app bot commented Aug 26, 2025

How to use the Graphite Merge Queue

Add the label merge-queue to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@stainless-app
Copy link
Contributor Author

stainless-app bot commented Aug 26, 2025

🧪 Testing

To try out this version of the SDK, run:

pip install 'https://pkg.stainless.com/s/gentrace-python/b8d8ee11188ea151e160a295ff7b6e3e4db2d098/gentrace_py-1.6.1-py3-none-any.whl'

Expires: Mon, 06 Oct 2025 05:55:01 GMT

@stainless-app stainless-app bot force-pushed the release-please--branches--main--changes--next branch from c9e2f84 to 9df900b Compare August 27, 2025 09:21
@stainless-app stainless-app bot force-pushed the release-please--branches--main--changes--next branch from 9df900b to ee565ee Compare August 27, 2025 09:27
@stainless-app stainless-app bot force-pushed the release-please--branches--main--changes--next branch from ee565ee to def43ef Compare August 30, 2025 04:49
@stainless-app stainless-app bot force-pushed the release-please--branches--main--changes--next branch from def43ef to aa80db5 Compare September 3, 2025 04:08
@stainless-app stainless-app bot changed the title release: 1.6.2 release: 1.7.0 Sep 3, 2025
@stainless-app stainless-app bot force-pushed the release-please--branches--main--changes--next branch from aa80db5 to a04fde7 Compare September 3, 2025 04:08
@stainless-app stainless-app bot force-pushed the release-please--branches--main--changes--next branch from a04fde7 to a841dc4 Compare September 4, 2025 04:11
Comment on lines +637 to 662
if PYDANTIC_V1:
field_info = cast("dict[str, FieldInfo]", variant.__fields__).get(discriminator_field_name) # pyright: ignore[reportDeprecated, reportUnnecessaryCast]
if not field_info:
continue

# Note: if one variant defines an alias then they all should
discriminator_alias = field.get("serialization_alias")

field_schema = field["schema"]
discriminator_alias = field_info.alias

if field_schema["type"] == "literal":
for entry in cast("LiteralSchema", field_schema)["expected"]:
if (annotation := getattr(field_info, "annotation", None)) and is_literal_type(annotation):
for entry in get_args(annotation):
if isinstance(entry, str):
mapping[entry] = variant
else:
field_info = cast("dict[str, FieldInfo]", variant.__fields__).get(discriminator_field_name) # pyright: ignore[reportDeprecated, reportUnnecessaryCast]
if not field_info:
field = _extract_field_schema_pv2(variant, discriminator_field_name)
if not field:
continue

# Note: if one variant defines an alias then they all should
discriminator_alias = field_info.alias
discriminator_alias = field.get("serialization_alias")

if (annotation := getattr(field_info, "annotation", None)) and is_literal_type(annotation):
for entry in get_args(annotation):
field_schema = field["schema"]

if field_schema["type"] == "literal":
for entry in cast("LiteralSchema", field_schema)["expected"]:
if isinstance(entry, str):
mapping[entry] = variant
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There appears to be a logic error in the discriminated union handling code. The PYDANTIC_V1 and else branches have been swapped, but the internal logic within each branch wasn't updated to match.

In the current implementation:

  • The PYDANTIC_V1 branch (lines 637-649) is attempting to access v2-style field schemas with field['schema'] and field['serialization_alias'], but field_info from Pydantic v1 doesn't have these attributes.
  • The else branch (lines 650-662) is trying to access v1-style attributes like field_info.alias on v2 field schemas.

This will cause AttributeError exceptions at runtime when processing discriminated unions. The code inside each conditional branch needs to be updated to match the correct Pydantic version it's handling.

Spotted by Diamond

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@stainless-app stainless-app bot force-pushed the release-please--branches--main--changes--next branch from a841dc4 to 5ab5b4b Compare September 5, 2025 04:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants