Skip to content

Commit

Permalink
Merge branch 'master' into feat/base-classses
Browse files Browse the repository at this point in the history
  • Loading branch information
droserasprout authored Nov 30, 2023
2 parents ffa31a3 + d9fd76a commit 44c8229
Show file tree
Hide file tree
Showing 7 changed files with 815 additions and 903 deletions.
158 changes: 32 additions & 126 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,126 +1,32 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
/.vs/slnx.sqlite-journal
/.vs/slnx.sqlite
.vscode/settings.json
.vscode/launch.json
# Containers code
./test/containers/code
#coverga
coverage_html
#venvwin
venvwin
# Ignore all
*
!*/

# Add metadata and build files
!.gitignore
!.dockerignore
!**/Dockerfile
!**/Makefile
!**/pyproject.toml
!**/requirements*
!**/pdm.lock
!**/README.md
!**/.keep

# Add Python code
!**/*.py
**/.*_cache
**/__pycache__

# Add configs and scripts (but not env!)
!**/*.graphql
!**/*.json
!**/*.sql
!**/*.yaml
!**/*.yml
!**/*.j2
!**/*.env.default

# Docs
!docs/**
docs/_build
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ The format is based on [Keep a Changelog], and this project adheres to [Semantic

### Added

- Python 3.12 support.
- `BaseJSONProtocol` and `BaseWebsocketTransport` classes for plain JSON over WebSockets and custom protocols.

### Other

- `websockets` library updated to 11.0.3.
- `websockets` library updated to 12.0.
- Use faster `orjson` library for JSON deserialization.

## [0.2.0] - 2023-04-07
Expand Down
1,519 changes: 760 additions & 759 deletions poetry.lock

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ classifiers = [
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Software Development :: Libraries :: Application Frameworks",
"Typing :: Typed",
Expand All @@ -35,8 +36,8 @@ packages = [
]

[tool.poetry.dependencies]
python = ">=3.8,<3.12"
websockets = "^11.0.3"
python = ">=3.8,<4"
websockets = "^12.0"
aiohttp = "^3.7.4"
msgpack = "^1.0.2"
orjson = "^3.9.0"
Expand All @@ -58,13 +59,13 @@ force_single_line = true

[tool.black]
line-length = 120
target-version = ["py38", "py39", "py310", "py311"]
target-version = ["py38", "py39", "py310", "py311", "py312"]
skip-string-normalization = true

[tool.ruff]
line-length = 120
ignore = ["E501", "B905"]
target-version = "py311"
target-version = "py312"
extend-select = ["B", "C4", "Q"] # todo: G, PTH, RET, RUF, S, TCH
flake8-quotes = {inline-quotes = "single", multiline-quotes = "double"}

Expand Down
22 changes: 11 additions & 11 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
aiohttp==3.8.4 ; python_version >= "3.8" and python_version < "3.12"
aiosignal==1.3.1 ; python_version >= "3.8" and python_version < "3.12"
async-timeout==4.0.2 ; python_version >= "3.8" and python_version < "3.12"
attrs==23.1.0 ; python_version >= "3.8" and python_version < "3.12"
charset-normalizer==3.1.0 ; python_version >= "3.8" and python_version < "3.12"
frozenlist==1.3.3 ; python_version >= "3.8" and python_version < "3.12"
idna==3.4 ; python_version >= "3.8" and python_version < "3.12"
msgpack==1.0.5 ; python_version >= "3.8" and python_version < "3.12"
multidict==6.0.4 ; python_version >= "3.8" and python_version < "3.12"
websockets==11.0.3 ; python_version >= "3.8" and python_version < "3.12"
yarl==1.9.2 ; python_version >= "3.8" and python_version < "3.12"
aiohttp==3.9.1 ; python_version >= "3.8" and python_version < "4"
aiosignal==1.3.1 ; python_version >= "3.8" and python_version < "4"
async-timeout==4.0.3 ; python_version >= "3.8" and python_version < "3.11"
attrs==23.1.0 ; python_version >= "3.8" and python_version < "4"
frozenlist==1.4.0 ; python_version >= "3.8" and python_version < "4"
idna==3.6 ; python_version >= "3.8" and python_version < "4"
msgpack==1.0.7 ; python_version >= "3.8" and python_version < "4"
multidict==6.0.4 ; python_version >= "3.8" and python_version < "4"
orjson==3.9.10 ; python_version >= "3.8" and python_version < "4"
websockets==12.0 ; python_version >= "3.8" and python_version < "4"
yarl==1.9.3 ; python_version >= "3.8" and python_version < "4"
2 changes: 1 addition & 1 deletion src/pysignalr/protocol/messagepack.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from typing import Union
from typing import cast

import msgpack # type: ignore[import]
import msgpack # type: ignore[import-untyped]
import orjson

from pysignalr.messages import CancelInvocationMessage
Expand Down
5 changes: 4 additions & 1 deletion src/pysignalr/transport/websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,10 @@ async def _set_state(self, state: ConnectionState) -> None:
self._state = state

async def _get_connection(self) -> WebSocketClientProtocol:
await self._connected.wait()
try:
await asyncio.wait_for(self._connected.wait(), self._connection_timeout)
except asyncio.TimeoutError as e:
raise RuntimeError('The socket was never run') from e
if not self._ws or self._ws.state != State.OPEN:
raise RuntimeError('Connection is closed')
return self._ws
Expand Down

0 comments on commit 44c8229

Please sign in to comment.