diff --git a/.actions/assistant.py b/.actions/assistant.py index c67c9ba78b..85a1b5879e 100644 --- a/.actions/assistant.py +++ b/.actions/assistant.py @@ -1,6 +1,7 @@ import datetime import glob import json +import logging import os import re import shutil @@ -16,6 +17,7 @@ from urllib.request import Request, urlopen import fire import pkg_resources +from packaging.version import parse as version_parse REQUIREMENT_FILES = { "pytorch": ( @@ -123,7 +125,9 @@ class AssistantCLI: data = json.load(urlopen(Request(url))) if not version: versions = list(data["releases"].keys()) - version = sorted(versions, key=LooseVersion)[-1] + versions = sorted(versions, key=lambda x: version_parse(x)) + logging.debug(f"Available versions: {versions}") + version = versions[-1] releases = list(filter(lambda r: r["packagetype"] == "sdist", data["releases"][version])) assert releases, f"Missing 'sdist' for this package/version aka {package}/{version}" release = releases[0] @@ -131,6 +135,7 @@ class AssistantCLI: pkg_file = os.path.basename(pkg_url) pkg_path = os.path.join(folder, pkg_file) os.makedirs(folder, exist_ok=True) + print(f"downloading: {pkg_url}") request.urlretrieve(pkg_url, pkg_path) @staticmethod diff --git a/.actions/requirements.txt b/.actions/requirements.txt new file mode 100644 index 0000000000..3b41e6584e --- /dev/null +++ b/.actions/requirements.txt @@ -0,0 +1,3 @@ +fire +packaging +requests diff --git a/.azure/hpu-tests.yml b/.azure/hpu-tests.yml index 33206ef5c3..c445cc92df 100644 --- a/.azure/hpu-tests.yml +++ b/.azure/hpu-tests.yml @@ -60,7 +60,7 @@ jobs: set -e pip --version sudo pip uninstall -y lightning pytorch-lightning - pip install fire + pip install -q -r .actions/requirements.txt python .actions/assistant.py requirements-prune-pkgs torch,torchvision pip install ".[extra,test]" pip list diff --git a/.github/workflows/ci-lite-test-full.yml b/.github/workflows/ci-lite-test-full.yml index 4449fca313..e8091eb76d 100644 --- a/.github/workflows/ci-lite-test-full.yml +++ b/.github/workflows/ci-lite-test-full.yml @@ -51,7 +51,7 @@ jobs: - name: basic setup run: | pip --version - pip install -q fire + pip install -q -r .actions/requirements.txt - name: Setup Windows if: runner.os == 'windows' diff --git a/.github/workflows/ci-pkg-install.yml b/.github/workflows/ci-pkg-install.yml index 7993dd04d5..69c602d2e2 100644 --- a/.github/workflows/ci-pkg-install.yml +++ b/.github/workflows/ci-pkg-install.yml @@ -114,7 +114,7 @@ jobs: - name: Dowload package # todo: download also lite after it is fist published run: | - pip install -q fire requests + pip install -q -r .actions/requirements.txt for pkg in 'app' 'pytorch' ; do python .actions/assistant.py download-package "$pkg" --folder pypi done @@ -131,7 +131,7 @@ jobs: - name: Miror source run: | - pip install -q fire requests + pip install -q -r .actions/requirements.txt python .actions/assistant.py mirror-pkg2source pypi src ls -R src/ diff --git a/.github/workflows/ci-pytorch-test-full.yml b/.github/workflows/ci-pytorch-test-full.yml index 18a1a6c088..e4c5ecd9cc 100644 --- a/.github/workflows/ci-pytorch-test-full.yml +++ b/.github/workflows/ci-pytorch-test-full.yml @@ -71,7 +71,7 @@ jobs: if: ${{ (steps.skip.outputs.continue == '1') }} run: | pip --version - pip install -q fire + pip install -q -r .actions/requirements.txt # Github Actions: Run step on specific OS: https://stackoverflow.com/a/57948488/4521646 - name: Setup macOS diff --git a/.github/workflows/events-nightly.yml b/.github/workflows/events-nightly.yml index 2576b05e33..18b6b6fdbf 100644 --- a/.github/workflows/events-nightly.yml +++ b/.github/workflows/events-nightly.yml @@ -26,7 +26,7 @@ jobs: - name: Build packages run: | - pip install -q fire + pip install -q -r .actions/requirements.txt python .actions/assistant.py prepare-nightly-version python setup.py sdist bdist_wheel ls -lh dist/ diff --git a/.github/workflows/release-pypi.yml b/.github/workflows/release-pypi.yml index 763665f142..88b95e5b26 100644 --- a/.github/workflows/release-pypi.yml +++ b/.github/workflows/release-pypi.yml @@ -26,7 +26,7 @@ jobs: with: python-version: 3.9 - run: | - pip install -q fire requests + pip install -q -r .actions/requirements.txt mkdir dist && touch dist/.placeholder mkdir pypi && touch pypi/.placeholder - uses: actions/upload-artifact@v3 @@ -105,7 +105,7 @@ jobs: - name: Dowload package run: | - pip install -q fire requests + pip install -q -r .actions/requirements.txt python .actions/assistant.py download-package ${{ matrix.pkg }} --folder pypi - uses: actions/upload-artifact@v3 @@ -147,7 +147,7 @@ jobs: - name: Miror source run: | - pip install -q fire requests + pip install -q -r .actions/requirements.txt python .actions/assistant.py mirror-pkg2source pypi src ls -R src/