Skip to content

Commit 0c68e5f

Browse files
Revnoplexpre-commit-ci[bot]LulalabyJustaSqu1d
authored
fix: Replace deprecated pkg_resources with importlib.metadata to clear DeprecationWarning (#2392)
Signed-off-by: Lala Sabathil <[email protected]> Signed-off-by: Revnoplex <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Lala Sabathil <[email protected]> Co-authored-by: JustaSqu1d <[email protected]>
1 parent 7c06892 commit 0c68e5f

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ These changes are available on the `master` branch, but have not yet been releas
1414

1515
- Fixed the type-hinting of `Member.move_to` and `Member.edit` to reflect actual
1616
behavior. ([#2386](https://github.com/Pycord-Development/pycord/pull/2386))
17+
- Fixed a deprecation warning from being displayed when running `python -m discord -v`
18+
by replacing the deprecated module.
19+
([#2392](https://github.com/Pycord-Development/pycord/pull/2392))
1720

1821
### Changed
1922

discord/__main__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@
2424
"""
2525

2626
import argparse
27+
import importlib.metadata
2728
import platform
2829
import sys
2930
from pathlib import Path
3031
from typing import Tuple
3132

3233
import aiohttp
33-
import pkg_resources
3434

3535
import discord
3636

@@ -47,9 +47,9 @@ def show_version() -> None:
4747
"- py-cord v{0.major}.{0.minor}.{0.micro}-{0.releaselevel}".format(version_info)
4848
)
4949
if version_info.releaselevel != "final":
50-
pkg = pkg_resources.get_distribution("py-cord")
51-
if pkg:
52-
entries.append(f" - py-cord pkg_resources: v{pkg.version}")
50+
version = importlib.metadata.version("py-cord")
51+
if version:
52+
entries.append(f" - py-cord importlib.metadata: v{version}")
5353

5454
entries.append(f"- aiohttp v{aiohttp.__version__}")
5555
uname = platform.uname()

0 commit comments

Comments
 (0)