Skip to content

Commit

Permalink
build: Switch to pyproject.toml. Fix new mypy errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Sep 5, 2024
1 parent 776d155 commit a1080e3
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 51 deletions.
52 changes: 51 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,56 @@
requires = ["setuptools>=61.2"]
build-backend = "setuptools.build_meta"

[project]
name = "yapw"
version = "0.1.4"
authors = [{name = "Open Contracting Partnership", email = "[email protected]"}]
license = {text = "BSD"}
description = "A Pika wrapper with error handling, signal handling and good defaults."
classifiers = [
"License :: OSI Approved :: BSD License",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
]
urls = {Homepage = "https://github.com/open-contracting/yapw"}
requires-python = ">=3.10"
dependencies = [
"pika>=1.2.0",
"typing-extensions;python_version<'3.8'",
]

[project.readme]
file = "README.rst"
content-type = "text/x-rst"

[project.optional-dependencies]
perf = ["orjson"]
test = [
"coveralls",
"pytest",
"pytest-cov",
]
types = [
"mypy",
"types-orjson",
"types-pika",
]
docs = [
"furo",
"sphinx",
"sphinx-autobuild",
"sphinx-design",
]

[tool.setuptools.packages.find]
exclude = [
"tests",
"tests.*",
]

[tool.ruff]
line-length = 119
target-version = "py310"
Expand All @@ -11,7 +61,7 @@ select = ["ALL"]
ignore = [
"ANN", "COM", "EM",
# https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
"W191", "E501", "D206", "Q000", "Q001", "Q002", "Q003", "ISC001",
"W191", "D206", "Q000", "Q001", "Q002", "Q003", "ISC001",
"D203", "D212", # incompatible rules
"D200", # documentation preferences
"C901", "PLR091", # complexity preferences
Expand Down
47 changes: 0 additions & 47 deletions setup.cfg

This file was deleted.

6 changes: 3 additions & 3 deletions yapw/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from collections import namedtuple
from concurrent.futures import ThreadPoolExecutor
from functools import partial
from typing import TYPE_CHECKING, Any, Generic, NoReturn, TypeVar
from typing import TYPE_CHECKING, Any, Generic, TypeVar

import pika
from pika.adapters.asyncio_connection import AsyncioConnection
Expand Down Expand Up @@ -45,7 +45,7 @@ def _on_message(
method: pika.spec.Basic.Deliver,
properties: pika.BasicProperties,
body: bytes,
args: tuple[Callable[..., None], Decorator, Decode, ConsumerCallback, State[Any]],
args: tuple[Callable[..., Any], Decorator, Decode, ConsumerCallback, State[Any]],
) -> None:
(submit, decorator, decode, callback, state) = args
submit(decorator, decode, callback, state, channel, method, properties, body)
Expand Down Expand Up @@ -642,7 +642,7 @@ def consume(self, on_message_callback: ConsumerCallback, decorator: Decorator, q
"""
self.channel.add_on_cancel_callback(self.channel_cancel_callback)

submit: partial[Future[NoReturn]] = partial(self.connection.ioloop.run_in_executor, self.executor)
submit: partial[Future[Any]] = partial(self.connection.ioloop.run_in_executor, self.executor)
cb = partial(_on_message, args=(submit, decorator, self.decode, on_message_callback, self.state))

self.consumer_tag = self.channel.basic_consume(queue_name, cb, callback=self.channel_consumeok_callback)
Expand Down

0 comments on commit a1080e3

Please sign in to comment.