Pkg resources deprecation (#3646)
* fix typo * migrate pkg_resources to importlib
This commit is contained in:
parent
3c0cb3fd6a
commit
86a2f923f6
@ -5,6 +5,7 @@ from __future__ import annotations
|
|||||||
import functools
|
import functools
|
||||||
import glob
|
import glob
|
||||||
import importlib
|
import importlib
|
||||||
|
import importlib.metadata
|
||||||
import inspect
|
import inspect
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
@ -23,7 +24,6 @@ from types import ModuleType
|
|||||||
from typing import Callable, List, Optional
|
from typing import Callable, List, Optional
|
||||||
|
|
||||||
import httpx
|
import httpx
|
||||||
import pkg_resources
|
|
||||||
import typer
|
import typer
|
||||||
from alembic.util.exc import CommandError
|
from alembic.util.exc import CommandError
|
||||||
from packaging import version
|
from packaging import version
|
||||||
@ -61,7 +61,7 @@ class CpuInfo(Base):
|
|||||||
def get_web_dir() -> Path:
|
def get_web_dir() -> Path:
|
||||||
"""Get the working directory for the next.js commands.
|
"""Get the working directory for the next.js commands.
|
||||||
|
|
||||||
Can be overriden with REFLEX_WEB_WORKDIR.
|
Can be overridden with REFLEX_WEB_WORKDIR.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
The working directory.
|
The working directory.
|
||||||
@ -78,7 +78,7 @@ def check_latest_package_version(package_name: str):
|
|||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
# Get the latest version from PyPI
|
# Get the latest version from PyPI
|
||||||
current_version = pkg_resources.get_distribution(package_name).version
|
current_version = importlib.metadata.version(package_name)
|
||||||
url = f"https://pypi.org/pypi/{package_name}/json"
|
url = f"https://pypi.org/pypi/{package_name}/json"
|
||||||
response = httpx.get(url)
|
response = httpx.get(url)
|
||||||
latest_version = response.json()["info"]["version"]
|
latest_version = response.json()["info"]["version"]
|
||||||
|
Loading…
Reference in New Issue
Block a user