feat: Replace deprecated dependency
All checks were successful
Docker CI/CD / Docker Build and Push to Docker Hub (push) Successful in 8m56s

Transitioned from the deprecated `pkg_resources` to `importlib.metadata` for package version retrieval, improving performance and future compatibility.
This commit is contained in:
Kumi 2024-04-23 17:30:21 +02:00
parent 7745593b91
commit 5a9332d635
Signed by: kumi
GPG key ID: ECBCC9082395383F
2 changed files with 6 additions and 2 deletions

View file

@ -2,6 +2,10 @@
### 0.3.9 (unreleased)
* Add Docker support for running the bot in a container
* Add TrackingMore dependency to pyproject.toml
* Replace deprecated `pkg_resources` with `importlib.metadata`
### 0.3.7 / 0.3.8 (2024-04-15)
* Changes to URLs in pyproject.toml

View file

@ -5,14 +5,14 @@ from configparser import ConfigParser
import signal
import asyncio
import pkg_resources
import importlib.metadata
def sigterm_handler(_signo, _stack_frame):
exit()
def get_version():
try:
package_version = pkg_resources.get_distribution("matrix_gptbot").version
package_version = importlib.metadata.version("matrix_gptbot")
except pkg_resources.DistributionNotFound:
return None
return package_version