Skip to content

Commit 486c42e

Browse files
Merge pull request #319 from OneBusAway/release-please--branches--main--changes--next
release: 1.17.1
2 parents 143b56c + 2dde76a commit 486c42e

File tree

7 files changed

+70
-102
lines changed

7 files changed

+70
-102
lines changed

.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.17.0"
2+
".": "1.17.1"
33
}

CHANGELOG.md

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

3+
## 1.17.1 (2025-09-06)
4+
5+
Full Changelog: [v1.17.0...v1.17.1](https://github.com/OneBusAway/python-sdk/compare/v1.17.0...v1.17.1)
6+
7+
### Chores
8+
9+
* **internal:** move mypy configurations to `pyproject.toml` file ([baa06e6](https://github.com/OneBusAway/python-sdk/commit/baa06e63b06e3082adc11f9a7930276c8777d527))
10+
* **tests:** simplify `get_platform` test ([0cced81](https://github.com/OneBusAway/python-sdk/commit/0cced81054c3e77548c7b34fe4899ccbbc9efb96))
11+
312
## 1.17.0 (2025-09-04)
413

514
Full Changelog: [v1.16.0...v1.17.0](https://github.com/OneBusAway/python-sdk/compare/v1.16.0...v1.17.0)

mypy.ini

Lines changed: 0 additions & 50 deletions
This file was deleted.

pyproject.toml

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "onebusaway"
3-
version = "1.17.0"
3+
version = "1.17.1"
44
description = "The official Python library for the onebusaway-sdk API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"
@@ -56,7 +56,6 @@ dev-dependencies = [
5656
"dirty-equals>=0.6.0",
5757
"importlib-metadata>=6.7.0",
5858
"rich>=13.7.1",
59-
"nest_asyncio==1.6.0",
6059
"pytest-xdist>=3.6.1",
6160
]
6261

@@ -157,6 +156,58 @@ reportOverlappingOverload = false
157156
reportImportCycles = false
158157
reportPrivateUsage = false
159158

159+
[tool.mypy]
160+
pretty = true
161+
show_error_codes = true
162+
163+
# Exclude _files.py because mypy isn't smart enough to apply
164+
# the correct type narrowing and as this is an internal module
165+
# it's fine to just use Pyright.
166+
#
167+
# We also exclude our `tests` as mypy doesn't always infer
168+
# types correctly and Pyright will still catch any type errors.
169+
exclude = ['src/onebusaway/_files.py', '_dev/.*.py', 'tests/.*']
170+
171+
strict_equality = true
172+
implicit_reexport = true
173+
check_untyped_defs = true
174+
no_implicit_optional = true
175+
176+
warn_return_any = true
177+
warn_unreachable = true
178+
warn_unused_configs = true
179+
180+
# Turn these options off as it could cause conflicts
181+
# with the Pyright options.
182+
warn_unused_ignores = false
183+
warn_redundant_casts = false
184+
185+
disallow_any_generics = true
186+
disallow_untyped_defs = true
187+
disallow_untyped_calls = true
188+
disallow_subclassing_any = true
189+
disallow_incomplete_defs = true
190+
disallow_untyped_decorators = true
191+
cache_fine_grained = true
192+
193+
# By default, mypy reports an error if you assign a value to the result
194+
# of a function call that doesn't return anything. We do this in our test
195+
# cases:
196+
# ```
197+
# result = ...
198+
# assert result is None
199+
# ```
200+
# Changing this codegen to make mypy happy would increase complexity
201+
# and would not be worth it.
202+
disable_error_code = "func-returns-value,overload-cannot-match"
203+
204+
# https://github.com/python/mypy/issues/12162
205+
[[tool.mypy.overrides]]
206+
module = "black.files.*"
207+
ignore_errors = true
208+
ignore_missing_imports = true
209+
210+
160211
[tool.ruff]
161212
line-length = 120
162213
output-format = "grouped"

requirements-dev.lock

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ multidict==6.4.4
7575
mypy==1.14.1
7676
mypy-extensions==1.0.0
7777
# via mypy
78-
nest-asyncio==1.6.0
7978
nodeenv==1.8.0
8079
# via pyright
8180
nox==2023.4.22

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.17.0" # x-release-please-version
4+
__version__ = "1.17.1" # x-release-please-version

tests/test_client.py

Lines changed: 6 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,11 @@
66
import os
77
import sys
88
import json
9-
import time
109
import asyncio
1110
import inspect
12-
import subprocess
1311
import tracemalloc
1412
import urllib.parse
1513
from typing import Any, Union, cast
16-
from textwrap import dedent
1714
from unittest import mock
1815
from typing_extensions import Literal
1916

@@ -24,14 +21,17 @@
2421

2522
from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK, APIResponseValidationError
2623
from onebusaway._types import Omit
24+
from onebusaway._utils import asyncify
2725
from onebusaway._models import BaseModel, FinalRequestOptions
2826
from onebusaway._exceptions import APIStatusError, APITimeoutError, APIResponseValidationError
2927
from onebusaway._base_client import (
3028
DEFAULT_TIMEOUT,
3129
HTTPX_DEFAULT_TIMEOUT,
3230
BaseClient,
31+
OtherPlatform,
3332
DefaultHttpxClient,
3433
DefaultAsyncHttpxClient,
34+
get_platform,
3535
make_request_options,
3636
)
3737

@@ -1628,50 +1628,9 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
16281628

16291629
assert response.http_request.headers.get("x-stainless-retry-count") == "42"
16301630

1631-
def test_get_platform(self) -> None:
1632-
# A previous implementation of asyncify could leave threads unterminated when
1633-
# used with nest_asyncio.
1634-
#
1635-
# Since nest_asyncio.apply() is global and cannot be un-applied, this
1636-
# test is run in a separate process to avoid affecting other tests.
1637-
test_code = dedent("""
1638-
import asyncio
1639-
import nest_asyncio
1640-
import threading
1641-
1642-
from onebusaway._utils import asyncify
1643-
from onebusaway._base_client import get_platform
1644-
1645-
async def test_main() -> None:
1646-
result = await asyncify(get_platform)()
1647-
print(result)
1648-
for thread in threading.enumerate():
1649-
print(thread.name)
1650-
1651-
nest_asyncio.apply()
1652-
asyncio.run(test_main())
1653-
""")
1654-
with subprocess.Popen(
1655-
[sys.executable, "-c", test_code],
1656-
text=True,
1657-
) as process:
1658-
timeout = 10 # seconds
1659-
1660-
start_time = time.monotonic()
1661-
while True:
1662-
return_code = process.poll()
1663-
if return_code is not None:
1664-
if return_code != 0:
1665-
raise AssertionError("calling get_platform using asyncify resulted in a non-zero exit code")
1666-
1667-
# success
1668-
break
1669-
1670-
if time.monotonic() - start_time > timeout:
1671-
process.kill()
1672-
raise AssertionError("calling get_platform using asyncify resulted in a hung process")
1673-
1674-
time.sleep(0.1)
1631+
async def test_get_platform(self) -> None:
1632+
platform = await asyncify(get_platform)()
1633+
assert isinstance(platform, (str, OtherPlatform))
16751634

16761635
async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
16771636
# Test that the proxy environment variables are set correctly

0 commit comments

Comments
 (0)