Skip to content

Commit 4d9e757

Browse files
authored
Merge pull request #162 from shadchin/patch-1
Add dependency setuptools
2 parents 9420889 + a8c7b58 commit 4d9e757

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

aiormq/connection.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from typing import Any, Dict, Optional, Tuple, Type, Union
1212

1313
import pamqp.frame
14-
import pkg_resources
1514
from pamqp import commands as spec
1615
from pamqp.base import Frame
1716
from pamqp.common import FieldTable
@@ -38,8 +37,15 @@
3837
)
3938
from .tools import Countdown, censor_url
4039

40+
# noinspection PyUnresolvedReferences
41+
try:
42+
from importlib.metadata import Distribution
43+
__version__ = Distribution.from_name("aiormq").version
44+
except ImportError:
45+
import pkg_resources
46+
__version__ = pkg_resources.get_distribution("aiormq").version
47+
4148

42-
__version__ = pkg_resources.get_distribution("aiormq").version
4349
log = logging.getLogger(__name__)
4450

4551
CHANNEL_CLOSE_RESPONSES = (spec.Channel.Close, spec.Channel.CloseOk)

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ packages = [{ include = "aiormq" }]
3939

4040
[tool.poetry.dependencies]
4141
python = "^3.7"
42-
pamqp= "3.2.1"
42+
pamqp = "3.2.1"
43+
setuptools = [{ version = '*', python = "< 3.8" }]
4344
yarl = [{ version = '*'}]
4445

4546
[tool.poetry.group.dev.dependencies]

0 commit comments

Comments
 (0)