Skip to content

Commit ccadbb1

Browse files
Merge pull request #279 from OneBusAway/release-please--branches--main--changes--next
release: 1.8.4
2 parents bd4f522 + 370fd65 commit ccadbb1

File tree

13 files changed

+68
-17
lines changed

13 files changed

+68
-17
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}
33

44
USER vscode
55

6-
RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.35.0" RYE_INSTALL_OPTION="--yes" bash
6+
RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.44.0" RYE_INSTALL_OPTION="--yes" bash
77
ENV PATH=/home/vscode/.rye/shims:$PATH
88

99
RUN echo "[[ -d .venv ]] && source .venv/bin/activate || export PATH=\$PATH" >> /home/vscode/.bashrc

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
curl -sSf https://rye.astral.sh/get | bash
2222
echo "$HOME/.rye/shims" >> $GITHUB_PATH
2323
env:
24-
RYE_VERSION: '0.35.0'
24+
RYE_VERSION: '0.44.0'
2525
RYE_INSTALL_OPTION: '--yes'
2626

2727
- name: Install dependencies
@@ -42,7 +42,7 @@ jobs:
4242
curl -sSf https://rye.astral.sh/get | bash
4343
echo "$HOME/.rye/shims" >> $GITHUB_PATH
4444
env:
45-
RYE_VERSION: '0.35.0'
45+
RYE_VERSION: '0.44.0'
4646
RYE_INSTALL_OPTION: '--yes'
4747

4848
- name: Bootstrap

.github/workflows/publish-pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
curl -sSf https://rye.astral.sh/get | bash
2222
echo "$HOME/.rye/shims" >> $GITHUB_PATH
2323
env:
24-
RYE_VERSION: '0.35.0'
24+
RYE_VERSION: '0.44.0'
2525
RYE_INSTALL_OPTION: '--yes'
2626

2727
- name: Publish to PyPI

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "1.8.3"
2+
".": "1.8.4"
33
}

.stats.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
configured_endpoints: 29
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-6f08502508c8ad25235971add3124a1cde4f1c3ec705d5df455d750e0adcb90b.yml
3+
openapi_spec_hash: 84d082f35446d29c7db3cfcd259e9859
4+
config_hash: c7e112ec9853ad18fe92551ae0d97656

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# Changelog
22

3+
## 1.8.4 (2025-03-27)
4+
5+
Full Changelog: [v1.8.3...v1.8.4](https://github.com/OneBusAway/python-sdk/compare/v1.8.3...v1.8.4)
6+
7+
### Bug Fixes
8+
9+
* **ci:** ensure pip is always available ([#284](https://github.com/OneBusAway/python-sdk/issues/284)) ([959d15e](https://github.com/OneBusAway/python-sdk/commit/959d15edcf912b2742e3598a35396041492ecbb7))
10+
* **ci:** remove publishing patch ([#285](https://github.com/OneBusAway/python-sdk/issues/285)) ([43691e0](https://github.com/OneBusAway/python-sdk/commit/43691e0b16c2c885b8e75d07e82f1ff26d961ac8))
11+
* **types:** handle more discriminated union shapes ([#283](https://github.com/OneBusAway/python-sdk/issues/283)) ([d55c08a](https://github.com/OneBusAway/python-sdk/commit/d55c08ad0ff636bf899c7a989185f30f431649bb))
12+
13+
14+
### Chores
15+
16+
* fix typos ([#286](https://github.com/OneBusAway/python-sdk/issues/286)) ([e45e047](https://github.com/OneBusAway/python-sdk/commit/e45e04798e64b912d4ba598ebc3ef0cdaf031203))
17+
* **internal:** bump rye to 0.44.0 ([#282](https://github.com/OneBusAway/python-sdk/issues/282)) ([217ce3f](https://github.com/OneBusAway/python-sdk/commit/217ce3f97be80d4861ffc277336ec196c6873788))
18+
* **internal:** remove extra empty newlines ([#280](https://github.com/OneBusAway/python-sdk/issues/280)) ([3ca5c73](https://github.com/OneBusAway/python-sdk/commit/3ca5c734669aad9252aca2761537f2cf6dc9cfab))
19+
320
## 1.8.3 (2025-03-04)
421

522
Full Changelog: [v1.8.2...v1.8.3](https://github.com/OneBusAway/python-sdk/compare/v1.8.2...v1.8.3)

bin/publish-pypi

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,4 @@
33
set -eux
44
mkdir -p dist
55
rye build --clean
6-
# Patching importlib-metadata version until upstream library version is updated
7-
# https://github.com/pypa/twine/issues/977#issuecomment-2189800841
8-
"$HOME/.rye/self/bin/python3" -m pip install 'importlib-metadata==7.2.1'
96
rye publish --yes --token=$PYPI_TOKEN

pyproject.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "onebusaway"
3-
version = "1.8.3"
3+
version = "1.8.4"
44
description = "The official Python library for the onebusaway-sdk API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"
@@ -38,7 +38,6 @@ Homepage = "https://github.com/OneBusAway/python-sdk"
3838
Repository = "https://github.com/OneBusAway/python-sdk"
3939

4040

41-
4241
[tool.rye]
4342
managed = true
4443
# version pins are in requirements-dev.lock
@@ -87,7 +86,7 @@ typecheck = { chain = [
8786
"typecheck:mypy" = "mypy ."
8887

8988
[build-system]
90-
requires = ["hatchling", "hatch-fancy-pypi-readme"]
89+
requires = ["hatchling==1.26.3", "hatch-fancy-pypi-readme"]
9190
build-backend = "hatchling.build"
9291

9392
[tool.hatch.build]
@@ -152,7 +151,6 @@ reportImplicitOverride = true
152151
reportImportCycles = false
153152
reportPrivateUsage = false
154153

155-
156154
[tool.ruff]
157155
line-length = 120
158156
output-format = "grouped"

scripts/test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ else
5252
echo
5353
fi
5454

55+
export DEFER_PYDANTIC_BUILD=false
56+
5557
echo "==> Running tests"
5658
rye run pytest "$@"
5759

src/onebusaway/_models.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
from ._constants import RAW_RESPONSE_HEADER
6666

6767
if TYPE_CHECKING:
68-
from pydantic_core.core_schema import ModelField, LiteralSchema, ModelFieldsSchema
68+
from pydantic_core.core_schema import ModelField, ModelSchema, LiteralSchema, ModelFieldsSchema
6969

7070
__all__ = ["BaseModel", "GenericModel"]
7171

@@ -646,15 +646,18 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any,
646646

647647
def _extract_field_schema_pv2(model: type[BaseModel], field_name: str) -> ModelField | None:
648648
schema = model.__pydantic_core_schema__
649+
if schema["type"] == "definitions":
650+
schema = schema["schema"]
651+
649652
if schema["type"] != "model":
650653
return None
651654

655+
schema = cast("ModelSchema", schema)
652656
fields_schema = schema["schema"]
653657
if fields_schema["type"] != "model-fields":
654658
return None
655659

656660
fields_schema = cast("ModelFieldsSchema", fields_schema)
657-
658661
field = fields_schema["fields"].get(field_name)
659662
if not field:
660663
return None
@@ -678,7 +681,7 @@ def set_pydantic_config(typ: Any, config: pydantic.ConfigDict) -> None:
678681
setattr(typ, "__pydantic_config__", config) # noqa: B010
679682

680683

681-
# our use of subclasssing here causes weirdness for type checkers,
684+
# our use of subclassing here causes weirdness for type checkers,
682685
# so we just pretend that we don't subclass
683686
if TYPE_CHECKING:
684687
GenericModel = BaseModel

src/onebusaway/_utils/_transform.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def _get_annotated_type(type_: type) -> type | None:
126126
def _maybe_transform_key(key: str, type_: type) -> str:
127127
"""Transform the given `data` based on the annotations provided in `type_`.
128128
129-
Note: this function only looks at `Annotated` types that contain `PropertInfo` metadata.
129+
Note: this function only looks at `Annotated` types that contain `PropertyInfo` metadata.
130130
"""
131131
annotated_type = _get_annotated_type(type_)
132132
if annotated_type is None:

src/onebusaway/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
__title__ = "onebusaway"
4-
__version__ = "1.8.3" # x-release-please-version
4+
__version__ = "1.8.4" # x-release-please-version

tests/test_models.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,3 +854,35 @@ class Model(BaseModel):
854854
m = construct_type(value={"cls": "foo"}, type_=Model)
855855
assert isinstance(m, Model)
856856
assert isinstance(m.cls, str)
857+
858+
859+
def test_discriminated_union_case() -> None:
860+
class A(BaseModel):
861+
type: Literal["a"]
862+
863+
data: bool
864+
865+
class B(BaseModel):
866+
type: Literal["b"]
867+
868+
data: List[Union[A, object]]
869+
870+
class ModelA(BaseModel):
871+
type: Literal["modelA"]
872+
873+
data: int
874+
875+
class ModelB(BaseModel):
876+
type: Literal["modelB"]
877+
878+
required: str
879+
880+
data: Union[A, B]
881+
882+
# when constructing ModelA | ModelB, value data doesn't match ModelB exactly - missing `required`
883+
m = construct_type(
884+
value={"type": "modelB", "data": {"type": "a", "data": True}},
885+
type_=cast(Any, Annotated[Union[ModelA, ModelB], PropertyInfo(discriminator="type")]),
886+
)
887+
888+
assert isinstance(m, ModelB)

0 commit comments

Comments
 (0)