Skip to content

Commit

Permalink
fix(sdk): speed up import time and fix pkg_resources DeprecationWar…
Browse files Browse the repository at this point in the history
…ning (wandb#5899)
  • Loading branch information
hauntsaninja authored Jul 25, 2023
1 parent 28ae89d commit eb65afc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions wandb/apis/public.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import json
import logging
import os
import platform
import shutil
import sys
import tempfile
Expand Down Expand Up @@ -231,7 +230,10 @@ def server_info(self):
return self._server_info

def version_supported(self, min_version):
from pkg_resources import parse_version
try:
from packaging.version import Version as parse_version # noqa: N813
except ImportError:
from pkg_resources import parse_version

return parse_version(min_version) <= parse_version(
self.server_info["cliVersionInfo"]["max_cli_version"]
Expand Down Expand Up @@ -3423,8 +3425,6 @@ def mongo_to_filter(self, filter):


class PythonMongoishQueryGenerator:
from pkg_resources import parse_version

SPACER = "----------"
DECIMAL_SPACER = ";;;"
FRONTEND_NAME_MAPPING = {
Expand Down Expand Up @@ -3464,7 +3464,7 @@ class PythonMongoishQueryGenerator:
ast.Not: "$not",
}

if parse_version(platform.python_version()) >= parse_version("3.8"):
if sys.version_info >= (3, 8):
AST_FIELDS = {
ast.Constant: "value",
ast.Name: "id",
Expand Down

0 comments on commit eb65afc

Please sign in to comment.