Skip to content

Commit

Permalink
Merge pull request #459 from DagsHub/chore/remove-cached-property
Browse files Browse the repository at this point in the history
Infra: drop Python 3.7 polyfills
  • Loading branch information
kbolashev authored Apr 7, 2024
2 parents bc63489 + a7535cb commit 4fa719b
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 43 deletions.
5 changes: 1 addition & 4 deletions dagshub/common/api/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@
from dagshub.common.util import multi_urljoin
from functools import partial

try:
from functools import cached_property
except ImportError:
from cached_property import cached_property
from functools import cached_property

from typing import Optional, Tuple, Any, List, Union

Expand Down
5 changes: 1 addition & 4 deletions dagshub/common/api/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
from pathlib import PurePosixPath
from typing import Optional, Dict, List

try:
from functools import cached_property
except ImportError:
from cached_property import cached_property
from functools import cached_property


@dataclass
Expand Down
5 changes: 1 addition & 4 deletions dagshub/common/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@

from dagshub.common import config

try:
from typing import Literal
except ImportError:
from typing_extensions import Literal
from typing import Literal

import re
import rich.progress
Expand Down
5 changes: 1 addition & 4 deletions dagshub/data_engine/client/data_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@
from dagshub.data_engine.model.errors import DataEngineGqlError
from dagshub.data_engine.model.query_result import QueryResult

try:
from functools import cached_property
except ImportError:
from cached_property import cached_property
from functools import cached_property

if TYPE_CHECKING:
from dagshub.data_engine.datasources import DatasourceState
Expand Down
5 changes: 1 addition & 4 deletions dagshub/data_engine/model/datasource_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
from dagshub.data_engine.model.errors import DatasourceAlreadyExistsError, DatasourceNotFoundError
from dagshub.common.util import multi_urljoin

try:
from functools import cached_property
except ImportError:
from cached_property import cached_property
from functools import cached_property

logger = logging.getLogger(__name__)

Expand Down
5 changes: 1 addition & 4 deletions dagshub/repo_bucket.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
try:
from typing import Literal
except ImportError:
from typing_extensions import Literal
from typing import Literal

from dagshub.common.api.repo import RepoAPI
from dagshub.auth import get_token
Expand Down
10 changes: 4 additions & 6 deletions dagshub/streaming/dataclasses.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
from dataclasses import dataclass
from pathlib import Path
from typing import Optional, TYPE_CHECKING

try:
from functools import cached_property
except ImportError:
from cached_property import cached_property
from functools import cached_property

if TYPE_CHECKING:
from dagshub.streaming import DagsHubFilesystem
Expand Down Expand Up @@ -39,7 +35,9 @@ def __post_init__(self):
for storage_schema in storage_schemas:
if str_path.startswith(f"{storage_schema}:/"):
str_path = str_path[len(storage_schema) + 2 :]
self.relative_path = Path(".dagshub/storage") / storage_schema / str_path
self.relative_path = (
Path(".dagshub/storage") / storage_schema / str_path
)
self.absolute_path = self.fs.project_root / self.relative_path

@cached_property
Expand Down
6 changes: 1 addition & 5 deletions dagshub/streaming/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import subprocess
import sys
from configparser import ConfigParser
from functools import wraps
from functools import wraps, cached_property
from multiprocessing import AuthenticationError
from os import PathLike
from pathlib import Path, PurePosixPath
Expand All @@ -31,10 +31,6 @@
if PRE_PYTHON3_11:
from pathlib import _NormalAccessor as _pathlib # noqa: E402

try:
from functools import cached_property
except ImportError:
from cached_property import cached_property

T = TypeVar("T")
logger = logging.getLogger(__name__)
Expand Down
8 changes: 0 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import sys
import setuptools
import os.path

Expand Down Expand Up @@ -50,13 +49,6 @@ def get_version(rel_path: str) -> str:
"fuse": ["fusepy>=3"],
}

# Polyfills for Python 3.7
if sys.version_info.major == 3 and sys.version_info.minor == 7:
install_requires += [
"cached-property==1.5.2",
"typing_extensions",
]

packages = setuptools.find_packages(exclude=["tests", "tests.*"])

setuptools.setup(
Expand Down

0 comments on commit 4fa719b

Please sign in to comment.