Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use packaging instead of deprecated distutils Version classes #1735

Merged
merged 3 commits into from
Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
- Add `no_git=True` when creating a new pipeline and initialising a git repository is not needed in `nf-core lint` and `nf-core bump-version` ([#1709](https://github.com/nf-core/tools/pull/1709))
- Move `strip_ansi_code` function in lint to `utils.py`
- Simplify control flow and don't use equality comparison for `None` and booleans
- Replace use of the deprecated `distutils` Version object with that from `packaging` ([#1735](https://github.com/nf-core/tools/pull/1735))

### Modules

Expand Down
4 changes: 2 additions & 2 deletions nf_core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import subprocess
import sys
import time
from distutils.version import StrictVersion

import git
import prompt_toolkit
Expand All @@ -24,6 +23,7 @@
import requests_cache
import rich
import yaml
from packaging.version import Version
from rich.live import Live
from rich.spinner import Spinner

Expand Down Expand Up @@ -76,7 +76,7 @@ def check_if_outdated(current_version=None, remote_version=None, source_url="htt
response = requests.get(source_url, timeout=3)
remote_version = re.sub(r"[^0-9\.]", "", response.text)
# Check if we have an available update
is_outdated = StrictVersion(remote_version) > StrictVersion(current_version)
is_outdated = Version(remote_version) > Version(current_version)
return (is_outdated, current_version, remote_version)


Expand Down