Skip to content

Commit 0e61400

Browse files
authored
Merge pull request #23 from openlawlibrary/ndusan/fix-find-compatible-versions
fix: Release 0.8.1; find compatible versions fixes; remove pip vendored imports;
2 parents 50dde89 + 775337f commit 0e61400

File tree

8 files changed

+30
-10
lines changed

8 files changed

+30
-10
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
architecture: x64
2626
- name: Install dependencies
2727
run: |
28-
python -m pip install --upgrade pip
28+
python -m pip install --upgrade pip setuptools wheel
2929
pip install -e .[test]
3030
- name: Test with pytest
3131
run: |

CHANGELOG.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,22 @@ and this project adheres to a _modified_ form of _[Semantic Versioning][semver]_
1616

1717
### Removed
1818

19+
## [0.8.1]
20+
21+
### Added
22+
23+
### Changed
24+
25+
- Use regular imports for `packaging` and `requests` library instead of pip vendored imports ([#23])
26+
27+
### Fixed
28+
29+
- Fix `find_compatible_versions` sort to use semver sort ([#23])
30+
31+
[#23]: https://github.com/openlawlibrary/upgrade-python-package/pull/23
32+
33+
### Removed
34+
1935
## [0.8.0]
2036

2137
### Added
@@ -183,7 +199,8 @@ and this project adheres to a _modified_ form of _[Semantic Versioning][semver]_
183199
[#5]: https://github.com/openlawlibrary/upgrade-python-package/pull/5
184200
[#6]: https://github.com/openlawlibrary/upgrade-python-package/pull/6
185201

186-
[Unreleased]: https://github.com/openlawlibrary/upgrade-python-package/compare/0.8.0...HEAD
202+
[Unreleased]: https://github.com/openlawlibrary/upgrade-python-package/compare/0.8.1...HEAD
203+
[0.8.1]: https://github.com/openlawlibrary/upgrade-python-package/compare/0.8.0...0.8.1
187204
[0.8.0]: https://github.com/openlawlibrary/upgrade-python-package/compare/0.7.3...0.8.0
188205
[0.7.3]: https://github.com/openlawlibrary/upgrade-python-package/compare/0.7.2...0.7.3
189206
[0.7.2]: https://github.com/openlawlibrary/upgrade-python-package/compare/0.7.1...0.7.2

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ classifiers =
2626
install_requires =
2727
lxml >= 4.9
2828
requests == 2.*
29+
packaging >= 24.1
2930
packages = upgrade.scripts
3031
zip_safe = False
3132
include_package_data = True
@@ -41,6 +42,7 @@ test =
4142
flake8
4243
pytest
4344
mock
45+
setuptools
4446

4547

4648
[bdist_wheel]

upgrade/scripts/find_compatible_versions.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
from urllib.parse import urljoin
77

88
import lxml.etree as et
9-
import pip._vendor.requests as requests
10-
from pip._vendor.packaging.utils import parse_wheel_filename
11-
from pip._vendor.packaging.version import Version
9+
import requests as requests
10+
from packaging.utils import parse_wheel_filename
11+
from packaging.version import Version
1212

1313
from upgrade.scripts.requirements import (
1414
filter_versions,
@@ -55,7 +55,7 @@ def get_compatible_upgrade_versions(
5555
)
5656
logging.debug(f"Found compatible versions: {compatible_versions}")
5757

58-
return sorted(compatible_versions, reverse=True)
58+
return sorted(compatible_versions, reverse=True, key=Version)
5959

6060

6161
def get_installed_version(requirements_obj: Any, venv_executable: str) -> Optional[str]:

upgrade/scripts/requirements.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def to_requirements_obj(requirements: str) -> Any:
6767
we import the vendored version. This way we guarantee
6868
that the packaging APIs are matching pip's behavior exactly.
6969
"""
70-
from pip._vendor.packaging.requirements import Requirement
70+
from packaging.requirements import Requirement
7171

7272
return Requirement(requirements)
7373
except Exception as e:

upgrade/scripts/upgrade_python_package.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
from importlib import util
88
from pathlib import Path
99

10-
from pip._vendor.packaging.specifiers import SpecifierSet
11-
from pip._vendor.packaging.utils import parse_wheel_filename
10+
from packaging.specifiers import SpecifierSet
11+
from packaging.utils import parse_wheel_filename
1212

1313
from upgrade.scripts.exceptions import PipFormatDecodeFailed
1414
from upgrade.scripts.requirements import filter_versions

upgrade/tests/manage_venv/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def _create_venv(path, version, venv_name=None):
2828
venv_path = str(Path(path, venv_name))
2929
run(original_executable, "-m", "venv", venv_path)
3030
venv_executable = get_venv_executable(venv_path)
31+
run(venv_executable, "-m", "pip", "install", "--upgrade", "pip", "setuptools", "wheel")
3132
run(
3233
venv_executable,
3334
"-m",

upgrade/tests/upgrade_package/test_filter_versions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import pytest
2-
from pip._vendor.packaging.specifiers import SpecifierSet
2+
from packaging.specifiers import SpecifierSet
33

44
from upgrade.scripts.requirements import filter_versions
55

0 commit comments

Comments
 (0)