Skip to content

Commit

Permalink
fix: Replace deprecated pkg_resources with importlib.metadata to clea…
Browse files Browse the repository at this point in the history
…r DeprecationWarning (#2392)

Signed-off-by: Lala Sabathil <lala@pycord.dev>
Signed-off-by: Revnoplex <62947003+Revnoplex@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Lala Sabathil <lala@pycord.dev>
Co-authored-by: JustaSqu1d <89910983+JustaSqu1d@users.noreply.github.com>
  • Loading branch information
4 people committed Mar 17, 2024
1 parent 7c06892 commit 0c68e5f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -14,6 +14,9 @@ These changes are available on the `master` branch, but have not yet been releas

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

### Changed

Expand Down
8 changes: 4 additions & 4 deletions discord/__main__.py
Expand Up @@ -24,13 +24,13 @@
"""

import argparse
import importlib.metadata
import platform
import sys
from pathlib import Path
from typing import Tuple

import aiohttp
import pkg_resources

import discord

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

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

0 comments on commit 0c68e5f

Please sign in to comment.