Skip to content

Commit

Permalink
Updated dependencies and tools (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
francis-clairicia authored Nov 1, 2023
1 parent 68488ba commit a608191
Show file tree
Hide file tree
Showing 12 changed files with 331 additions and 276 deletions.
2 changes: 1 addition & 1 deletion .github/actions/setup-tox/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ runs:
shell: bash
- uses: pdm-project/setup-pdm@v3
with:
version: '2.9.2'
version: '2.10.0'
python-version: ${{ inputs.python-version }}
cache: true
cache-dependency-path: './pdm.lock'
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ci:

repos:
- repo: https://github.com/asottile/pyupgrade
rev: v3.11.0
rev: v3.15.0
hooks:
- id: pyupgrade
args: ['--py311-plus']
Expand Down Expand Up @@ -46,7 +46,7 @@ repos:
- id: isort
args: ['--filter-files', '--settings-file', 'pyproject.toml']
- repo: https://github.com/psf/black
rev: '23.9.1'
rev: '23.10.1'
hooks:
- id: black
args: ['--config', 'pyproject.toml']
Expand All @@ -73,7 +73,7 @@ repos:
types: [] # Overwrite with empty in order to fallback to types_or
types_or: [python, pyi]
- repo: https://github.com/pdm-project/pdm
rev: '2.9.2'
rev: '2.10.0'
hooks:
- id: pdm-lock-check
- repo: https://github.com/pre-commit/pygrep-hooks
Expand All @@ -85,7 +85,7 @@ repos:
- id: rst-directive-colons
- id: rst-inline-touching-normal
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 'v4.4.0'
rev: 'v4.5.0'
hooks:
- id: mixed-line-ending
args: [--fix=lf]
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build:
python: "3.11"
jobs:
post_create_environment:
- pip install --no-cache-dir pdm==2.9.2
- pip install --no-cache-dir pdm==2.10.0
- pdm config check_update false
- pdm use -f $READTHEDOCS_VIRTUALENV_PATH
post_install:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The easiest way to use sockets in Python!
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/easynetwork)

[![Test](https://github.com/francis-clairicia/EasyNetwork/actions/workflows/test.yml/badge.svg)](https://github.com/francis-clairicia/EasyNetwork/actions/workflows/test.yml)
[![Documentation Status](https://readthedocs.org/projects/easynetwork/badge/?version=latest)](https://easynetwork.readthedocs.io/en/latest/?badge=latest)
[![Codecov](https://img.shields.io/codecov/c/github/francis-clairicia/EasyNetwork)](https://codecov.io/gh/francis-clairicia/EasyNetwork)
[![CodeFactor Grade](https://img.shields.io/codefactor/grade/github/francis-clairicia/EasyNetwork)](https://www.codefactor.io/repository/github/francis-clairicia/easynetwork)

Expand Down
567 changes: 312 additions & 255 deletions pdm.lock

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,17 @@ keywords = [
]

[project.urls]
# TODO: "Homepage" will be the documentation URL
Homepage = "https://github.com/francis-clairicia/EasyNetwork"
Documentation = "https://easynetwork.readthedocs.io/en/latest/"
"Issue Tracker" = "https://github.com/francis-clairicia/EasyNetwork/issues"
"Release Notes" = "https://github.com/francis-clairicia/EasyNetwork/releases"
"Source Code" = "https://github.com/francis-clairicia/EasyNetwork"

[project.optional-dependencies]
cbor = [
"cbor2>=5.4,<6",
"cbor2>=5.5,<6",
]
msgpack = [
"msgpack>=1.0.5",
"msgpack>=1.0.7,<2",
]
encryption = [
"cryptography>=39",
Expand All @@ -80,7 +79,7 @@ format = [
"black>=22.6.0",
]
mypy = [
"mypy~=1.5.1",
"mypy~=1.6.0",
"types-cryptography>=3.3.23.2",
"msgpack-types>=0.2.0",
]
Expand Down
2 changes: 1 addition & 1 deletion src/easynetwork/lowlevel/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def prepend_argument(arg: _T_Arg) -> Callable[[Callable[Concatenate[_T_Arg, _P],
def decorator(func: Callable[Concatenate[_T_Arg, _P], _R], /) -> Callable[_P, _R]:
return functools.partial(func, arg)

return decorator # type: ignore[return-value]
return decorator


def error_from_errno(errno: int) -> OSError:
Expand Down
2 changes: 1 addition & 1 deletion src/easynetwork/lowlevel/api_async/backend/futures.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def _setup_func(self, func: Callable[_P, _T]) -> Callable[_P, _T]:
if _sniffio_current_async_library_cvar is not None:
ctx.run(_sniffio_current_async_library_cvar.set, None)

func = functools.partial(ctx.run, func) # type: ignore[assignment]
func = functools.partial(ctx.run, func)
return func


Expand Down
4 changes: 2 additions & 2 deletions src/easynetwork/lowlevel/socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ def getsockopt(self, *args: Any) -> int | bytes:
"""
Calls :meth:`ISocket.getsockopt <SupportsSocketOptions.getsockopt>`.
"""
return self.__execute(self.__socket.getsockopt, *args)
return self.__execute(self.__socket.getsockopt, *args) # type: ignore[arg-type]

@overload
def setsockopt(self, level: int, optname: int, value: int | bytes, /) -> None:
Expand All @@ -445,7 +445,7 @@ def setsockopt(self, *args: Any) -> None:
"""
Calls :meth:`ISocket.setsockopt <SupportsSocketOptions.setsockopt>`.
"""
return self.__execute(self.__socket.setsockopt, *args)
return self.__execute(self.__socket.setsockopt, *args) # type: ignore[arg-type]

def getpeername(self) -> _socket._RetAddress:
"""
Expand Down
4 changes: 2 additions & 2 deletions src/easynetwork/serializers/cbor.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ def __init__(
raise ModuleNotFoundError("cbor dependencies are missing. Consider adding 'cbor' extra") from exc

super().__init__(expected_load_error=(cbor2.CBORDecodeError, UnicodeError))
self.__encoder_cls: Callable[[IO[bytes]], cbor2.CBOREncoder] # type: ignore[no-any-unimported,unused-ignore]
self.__decoder_cls: Callable[[IO[bytes]], cbor2.CBORDecoder] # type: ignore[no-any-unimported,unused-ignore]
self.__encoder_cls: Callable[[IO[bytes]], cbor2.CBOREncoder]
self.__decoder_cls: Callable[[IO[bytes]], cbor2.CBORDecoder]

if encoder_config is None:
encoder_config = CBOREncoderConfig()
Expand Down
4 changes: 1 addition & 3 deletions src/easynetwork_asyncio/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,7 @@ async def run_in_thread(self, func: Callable[_P, _T], /, *args: _P.args, **kwarg
if _sniffio_current_async_library_cvar is not None:
ctx.run(_sniffio_current_async_library_cvar.set, None)

func_call: Callable[..., _T] = functools.partial(ctx.run, func, *args, **kwargs) # type: ignore[assignment]
future = loop.run_in_executor(None, func_call)
del func_call, func, args, kwargs
future = loop.run_in_executor(None, functools.partial(ctx.run, func, *args, **kwargs))
try:
await TaskUtils.cancel_shielded_wait_asyncio_futures({future})
return future.result()
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ allowlist_externals =
setenv =
{[base]setenv}
MYPY_CACHE_DIR = {envtmpdir}{/}.mypy_cache
MYPY_OPTS = --no-incremental --config-file {toxinidir}{/}pyproject.toml
MYPY_OPTS = --no-incremental --config-file {toxinidir}{/}pyproject.toml --new-type-inference
commands_pre =
{[pdm]sync} --dev --group=mypy
test: {[pdm]sync} --dev --group=test
Expand Down

0 comments on commit a608191

Please sign in to comment.