Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Replace deprecated pkg_resources with importlib.metadata to clear DeprecationWarning #2392

Merged
merged 6 commits into from Mar 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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