Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ name: Build, test and upload to PyPI
on:
push:
branches: [ master ]
tags: [ 'v*' ]
pull_request:
branches: [ master ]

Expand Down Expand Up @@ -135,14 +136,11 @@ jobs:

upload_wheels:
name: Upload wheels to PyPI
needs: build_wheels
needs: [ tests, debug-tests, build_wheels ]
runs-on: ubuntu-latest

# Upload to PyPI on every tag starting with 'v'
# FIXME: for some reason, the job is skipped, although the configuration is
# almost identical to the one I use on pglast... let's try to temporarily
# remove the condition
#if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')

steps:
- uses: actions/download-artifact@v4
Expand Down
1 change: 1 addition & 0 deletions requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ mypy==2.1.0
pytest==9.1.1
pytz==2022.2
sphinx==8.2.3
typing-extensions==4.16.0
21 changes: 13 additions & 8 deletions typings/rapidjson/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#

import typing as t
from typing_extensions import disjoint_base # type: ignore[attr-defined]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I assume this requires adding typing-extensions to the requirements.txt, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, good catch. CI was receiving it transitively through mypy, which is why the exact-head run passed, but the stub now imports disjoint_base directly and needs an explicit typing-extensions dependency. I added typing-extensions==4.16.0 to requirements-test.txt (requirements.txt includes that file) in 98dd717. Local verification: stubtest found no issues in 1 module; pytest reported 929 passed, 17 skipped, and 2 xfailed; pip check is clean. The new exact-head CI is starting now.



__rapidjson_exact_version__: str
Expand Down Expand Up @@ -164,26 +165,28 @@ class JSONDecodeError(Exception): ...
class ValidationError(Exception): ...


@disjoint_base
class Decoder:
datetime_mode: _DatetimeMode
number_mode: _NumberMode
parse_mode: _ParseMode
uuid_mode: _UUIDMode

def __init__(
self,
def __new__(
cls,
datetime_mode: t.Optional[_DatetimeMode] = DM_NONE,
number_mode: t.Optional[_NumberMode] = NM_NAN,
parse_mode: t.Optional[_ParseMode] = PM_NONE,
uuid_mode: t.Optional[_UUIDMode] = UM_NONE,
) -> None: ...
) -> Decoder: ...
def __call__(
self,
json: t.Union[str, bytes, bytearray, t.IO],
chunk_size: t.Optional[int] = 65536,
) -> t.Any: ...


@disjoint_base
class Encoder:
bytes_mode: _BytesMode
datetime_mode: _DatetimeMode
Expand All @@ -198,8 +201,8 @@ class Encoder:
uuid_mode: _UUIDMode
write_mode: _WriteMode

def __init__(
self,
def __new__(
cls,
skip_invalid_keys: t.Optional[bool] = False,
ensure_ascii: t.Optional[bool] = True,
write_mode: t.Optional[_WriteMode] = WM_COMPACT,
Expand All @@ -211,7 +214,7 @@ class Encoder:
bytes_mode: t.Optional[_BytesMode] = BM_UTF8,
iterable_mode: t.Optional[_IterableMode] = IM_ANY_ITERABLE,
mapping_mode: t.Optional[_MappingMode] = MM_ANY_MAPPING,
) -> None: ...
) -> Encoder: ...
def __call__(
self,
obj: t.Any,
Expand All @@ -223,10 +226,12 @@ class Encoder:
@t.final
class RawJSON:
value: RawJSON
def __init__(self, value: str) -> None: ...
def __new__(cls, value: str) -> RawJSON: ...


@t.final
class Validator:
def __init__(self, json_schema: t.Union[str, bytes, bytearray]) -> None: ...
def __new__(
cls, json_schema: t.Union[str, bytes, bytearray]
) -> Validator: ...
def __call__(self, json: t.Union[str, bytes, bytearray]) -> None: ...
Loading