From 06b874454e6ac7fc45d256f82af23bbdb86ea121 Mon Sep 17 00:00:00 2001 From: Tim Hatch Date: Wed, 1 Nov 2023 16:59:42 -0700 Subject: [PATCH] Remove references to LegacyVersion --- bumpreqs/core.py | 8 ++++---- bumpreqs/marker_extract.py | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/bumpreqs/core.py b/bumpreqs/core.py index 235df52..abd174e 100644 --- a/bumpreqs/core.py +++ b/bumpreqs/core.py @@ -1,12 +1,12 @@ import logging -from typing import List, Optional, Union +from typing import List, Optional import requests from packaging.requirements import Requirement from packaging.specifiers import SpecifierSet -from packaging.version import LegacyVersion, parse as parse_version, Version +from packaging.version import parse as parse_version, Version from .marker_extract import extract_python @@ -96,12 +96,12 @@ def fix(text: str, force: Optional[bool] = False) -> str: def _fetch_versions( project_name: str, only_for_python: Optional[VersionIntervals] = None, -) -> List[Union[LegacyVersion, Version]]: +) -> List[Version]: resp = requests.get(f"https://pypi.org/pypi/{project_name}/json") resp.raise_for_status() obj = resp.json() - versions: List[Union[LegacyVersion, Version]] = [] + versions: List[Version] = [] for k, v in obj["releases"].items(): # Skip older releases that have no archives if not v: diff --git a/bumpreqs/marker_extract.py b/bumpreqs/marker_extract.py index 7ca35ef..7b4248f 100644 --- a/bumpreqs/marker_extract.py +++ b/bumpreqs/marker_extract.py @@ -1,6 +1,7 @@ from typing import Any, Iterator, Optional, Tuple -from packaging.markers import Marker, Variable +from packaging._parser import Variable +from packaging.markers import Marker from .vrange import TooComplicated, VersionIntervals