From 40476b1b4a38fd251614b695b1133805dbda2a83 Mon Sep 17 00:00:00 2001 From: Benjamin Himes Date: Thu, 10 Apr 2025 20:48:57 +0200 Subject: [PATCH 1/9] Remove requirements directory, change workflows to not use this. --- .circleci/config.yml | 26 +------------------------- .github/dependabot.yml | 2 +- pyproject.toml | 5 +++++ requirements/cli.txt | 1 - requirements/cubit.txt | 3 --- requirements/dev.txt | 19 ------------------- requirements/prod.txt | 26 -------------------------- requirements/torch.txt | 1 - 8 files changed, 7 insertions(+), 76 deletions(-) delete mode 100644 requirements/cli.txt delete mode 100644 requirements/cubit.txt delete mode 100644 requirements/dev.txt delete mode 100644 requirements/prod.txt delete mode 100644 requirements/torch.txt diff --git a/.circleci/config.yml b/.circleci/config.yml index fbe39a6645..c82193472c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -39,7 +39,7 @@ jobs: python -m venv .venv . .venv/bin/activate python -m pip install --upgrade uv - uv pip install ruff -c requirements/dev.txt + uv pip install ruff - save_cache: name: Save cached ruff venv @@ -87,12 +87,6 @@ jobs: steps: - checkout - - restore_cache: - name: Restore cached venv - keys: - - v2-pypi-py<< parameters.python-version >>-{{ checksum "requirements/prod.txt" }}+{{ checksum "requirements/dev.txt" }} - - v2-pypi-py<< parameters.python-version >> - - run: name: Update & Activate venv command: | @@ -101,12 +95,6 @@ jobs: python -m pip install --upgrade uv uv sync --all-extras --dev - - save_cache: - name: Save cached venv - paths: - - "venv/" - key: v2-pypi-py<< parameters.python-version >>-{{ checksum "requirements/prod.txt" }}+{{ checksum "requirements/dev.txt" }} - - run: name: Install Bittensor command: | @@ -178,12 +166,6 @@ jobs: steps: - checkout - - restore_cache: - name: Restore cached venv - keys: - - v2-pypi-py<< parameters.python-version >>-{{ checksum "requirements/prod.txt" }}+{{ checksum "requirements/dev.txt" }} - - v2-pypi-py<< parameters.python-version >> - - run: name: Update & Activate venv command: | @@ -193,12 +175,6 @@ jobs: uv sync --all-extras --dev uv pip install flake8 - - save_cache: - name: Save cached venv - paths: - - "env/" - key: v2-pypi-py<< parameters.python-version >>-{{ checksum "requirements/prod.txt" }}+{{ checksum "requirements/dev.txt" }} - - run: name: Install Bittensor command: | diff --git a/.github/dependabot.yml b/.github/dependabot.yml index adff4d0aab..190e4cd6c5 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -2,7 +2,7 @@ version: 2 updates: - package-ecosystem: "pip" directory: "" - file: "requirements/prod.txt" + file: "pyproject.toml" schedule: interval: "daily" open-pull-requests-limit: 0 # Only security updates will be opened as PRs diff --git a/pyproject.toml b/pyproject.toml index 2232e33960..19a5ffaa6e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -67,6 +67,11 @@ torch = [ cli = [ "bittensor-cli>=9.0.2" ] +cubit = [ + "torch>=1.13.1,<3.0", + "cubit @ git+https://github.com/opentensor/cubit.git@v1.1.2" +] + [project.urls] # more details can be found here diff --git a/requirements/cli.txt b/requirements/cli.txt deleted file mode 100644 index e395b2b9c1..0000000000 --- a/requirements/cli.txt +++ /dev/null @@ -1 +0,0 @@ -bittensor-cli>=9.0.2 \ No newline at end of file diff --git a/requirements/cubit.txt b/requirements/cubit.txt deleted file mode 100644 index 5af1316836..0000000000 --- a/requirements/cubit.txt +++ /dev/null @@ -1,3 +0,0 @@ -torch>=1.13.1 -cubit>=1.1.0 -cubit @ git+https://github.com/opentensor/cubit.git diff --git a/requirements/dev.txt b/requirements/dev.txt deleted file mode 100644 index 77e21b0eeb..0000000000 --- a/requirements/dev.txt +++ /dev/null @@ -1,19 +0,0 @@ -pytest==7.2.0 -pytest-asyncio==0.23.7 -pytest-mock==3.12.0 -pytest-split==0.8.0 -pytest-xdist==3.0.2 -pytest-rerunfailures==10.2 -coveralls==3.3.1 -pytest-cov==4.0.0 -ddt==1.6.0 -hypothesis==6.81.1 -flake8==7.0.0 -mypy==1.8.0 -types-retry==0.9.9.4 -freezegun==1.5.0 -httpx==0.27.0 -ruff==0.4.7 -aioresponses==0.7.6 -factory-boy==3.3.0 -types-requests \ No newline at end of file diff --git a/requirements/prod.txt b/requirements/prod.txt deleted file mode 100644 index 893d925ce9..0000000000 --- a/requirements/prod.txt +++ /dev/null @@ -1,26 +0,0 @@ -wheel -setuptools~=70.0.0 -aiohttp~=3.9 -asyncstdlib~=3.13.0 -colorama~=0.4.6 -fastapi~=0.110.1 -munch~=2.5.0 -numpy~=2.0.1 -msgpack-numpy-opentensor~=0.5.0 -nest_asyncio -netaddr -packaging -python-statemachine~=2.1 -pycryptodome>=3.18.0,<4.0.0 -pyyaml -retry -requests -rich -pydantic>=2.3, <3 -python-Levenshtein -scalecodec==1.2.11 -uvicorn -websockets>=14.1 -bittensor-commit-reveal>=0.3.1 -bittensor-wallet>=3.0.7 -async-substrate-interface>=1.0.4 diff --git a/requirements/torch.txt b/requirements/torch.txt deleted file mode 100644 index 1abaa00adc..0000000000 --- a/requirements/torch.txt +++ /dev/null @@ -1 +0,0 @@ -torch>=1.13.1,<2.6.0 From 74b5a1fce388f321c6503a8d80e11e01266e0888 Mon Sep 17 00:00:00 2001 From: Benjamin Himes Date: Thu, 10 Apr 2025 21:09:29 +0200 Subject: [PATCH 2/9] Update uv sync to not install cubit --- .github/workflows/e2e-subtensor-tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e-subtensor-tests.yaml b/.github/workflows/e2e-subtensor-tests.yaml index c74c5fadfe..26082029aa 100644 --- a/.github/workflows/e2e-subtensor-tests.yaml +++ b/.github/workflows/e2e-subtensor-tests.yaml @@ -89,7 +89,7 @@ jobs: uses: astral-sh/setup-uv@v4 - name: install dependencies - run: uv sync --all-extras --dev + run: uv sync --extra dev --extra torch --dev - name: Download Cached Docker Image uses: actions/download-artifact@v4 From 66e4f6a3c262025a54376f1df102ea4e8b6833f6 Mon Sep 17 00:00:00 2001 From: Benjamin Himes Date: Thu, 10 Apr 2025 21:36:08 +0200 Subject: [PATCH 3/9] Fix extras --- .circleci/config.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c82193472c..82ec57fedb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -93,13 +93,13 @@ jobs: python -m venv .venv . .venv/bin/activate python -m pip install --upgrade uv - uv sync --all-extras --dev + uv sync --extra dev --extra torch --dev - run: name: Install Bittensor command: | . .venv/bin/activate - uv sync --all-extras --dev + uv sync --extra dev --extra torch --dev - run: name: Instantiate Mock Wallet @@ -172,14 +172,14 @@ jobs: python -m venv .venv . .venv/bin/activate python -m pip install --upgrade uv - uv sync --all-extras --dev + uv sync --extra dev --extra torch --dev uv pip install flake8 - run: name: Install Bittensor command: | . .venv/bin/activate - uv sync --all-extras --dev + uv sync --extra dev --extra torch --dev - run: name: Lint with flake8 From 86be8ec42addf4d72526dd3f5e0cccc7a27c7637 Mon Sep 17 00:00:00 2001 From: Benjamin Himes Date: Thu, 10 Apr 2025 22:08:00 +0200 Subject: [PATCH 4/9] Limit extras --- .circleci/config.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 82ec57fedb..d35fe9cc65 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -93,13 +93,13 @@ jobs: python -m venv .venv . .venv/bin/activate python -m pip install --upgrade uv - uv sync --extra dev --extra torch --dev + uv sync --extra dev --dev - run: name: Install Bittensor command: | . .venv/bin/activate - uv sync --extra dev --extra torch --dev + uv sync --extra dev --dev - run: name: Instantiate Mock Wallet @@ -172,14 +172,14 @@ jobs: python -m venv .venv . .venv/bin/activate python -m pip install --upgrade uv - uv sync --extra dev --extra torch --dev + uv sync --extra dev --dev uv pip install flake8 - run: name: Install Bittensor command: | . .venv/bin/activate - uv sync --extra dev --extra torch --dev + uv sync --extra dev --dev - run: name: Lint with flake8 From 4c00111363eed612487507f5222ff4afa437e266 Mon Sep 17 00:00:00 2001 From: Benjamin Himes Date: Fri, 11 Apr 2025 11:03:30 +0200 Subject: [PATCH 5/9] Update requirements checking. --- .circleci/config.yml | 4 +- scripts/check_compatibility.sh | 76 --------------------------- scripts/check_requirements_changes.sh | 4 +- 3 files changed, 3 insertions(+), 81 deletions(-) delete mode 100755 scripts/check_compatibility.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index d35fe9cc65..a4c1114589 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -68,9 +68,7 @@ jobs: name: Install dependencies and Check compatibility command: | if [ "$REQUIREMENTS_CHANGED" == "true" ]; then - sudo apt-get update - sudo apt-get install -y jq curl - ./scripts/check_compatibility.sh << parameters.python_version >> + python -m pip install ".[dev,cli]" --dry-run --python-version --no-deps << parameters.python.version >> else echo "Skipping compatibility checks..." fi diff --git a/scripts/check_compatibility.sh b/scripts/check_compatibility.sh deleted file mode 100755 index b9c89c24dd..0000000000 --- a/scripts/check_compatibility.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash - -if [ -z "$1" ]; then - echo "Please provide a Python version as an argument." - exit 1 -fi - -python_version="$1" -all_passed=true - -GREEN='\033[0;32m' -YELLOW='\033[0;33m' -RED='\033[0;31m' -NC='\033[0m' # No Color - -check_compatibility() { - all_supported=0 - - while read -r requirement; do - # Skip lines starting with git+ - if [[ "$requirement" == git+* ]]; then - continue - fi - - package_name=$(echo "$requirement" | awk -F'[!=<>~]' '{print $1}' | awk -F'[' '{print $1}') # Strip off brackets - echo -n "Checking $package_name... " - - url="https://pypi.org/pypi/$package_name/json" - response=$(curl -s $url) - status_code=$(curl -s -o /dev/null -w "%{http_code}" $url) - - if [ "$status_code" != "200" ]; then - echo -e "${RED}Information not available for $package_name. Failure.${NC}" - all_supported=1 - continue - fi - - classifiers=$(echo "$response" | jq -r '.info.classifiers[]') - requires_python=$(echo "$response" | jq -r '.info.requires_python') - - base_version="Programming Language :: Python :: ${python_version%%.*}" - specific_version="Programming Language :: Python :: $python_version" - - if echo "$classifiers" | grep -q "$specific_version" || echo "$classifiers" | grep -q "$base_version"; then - echo -e "${GREEN}Supported${NC}" - elif [ "$requires_python" != "null" ]; then - if echo "$requires_python" | grep -Eq "==$python_version|>=$python_version|<=$python_version"; then - echo -e "${GREEN}Supported${NC}" - else - echo -e "${RED}Not compatible with Python $python_version due to constraint $requires_python.${NC}" - all_supported=1 - fi - else - echo -e "${YELLOW}Warning: Specific version not listed, assuming compatibility${NC}" - fi - done < requirements/prod.txt - - return $all_supported -} - -echo "Checking compatibility for Python $python_version..." -check_compatibility -if [ $? -eq 0 ]; then - echo -e "${GREEN}All requirements are compatible with Python $python_version.${NC}" -else - echo -e "${RED}All requirements are NOT compatible with Python $python_version.${NC}" - all_passed=false -fi - -echo "" -if $all_passed; then - echo -e "${GREEN}All tests passed.${NC}" -else - echo -e "${RED}All tests did not pass.${NC}" - exit 1 -fi diff --git a/scripts/check_requirements_changes.sh b/scripts/check_requirements_changes.sh index 5fcd27ea3f..5b41f463c1 100755 --- a/scripts/check_requirements_changes.sh +++ b/scripts/check_requirements_changes.sh @@ -1,8 +1,8 @@ #!/bin/bash # Check if requirements files have changed in the last commit -if git diff --name-only HEAD~1 | grep -E 'requirements/prod.txt|requirements/dev.txt'; then - echo "Requirements files have changed. Running compatibility checks..." +if git diff --name-only HEAD~1 | grep -E 'pyproject.toml'; then + echo "Requirements files may have changed. Running compatibility checks..." echo 'export REQUIREMENTS_CHANGED="true"' >> $BASH_ENV else echo "Requirements files have not changed. Skipping compatibility checks..." From 14936be941b970e63170538b54253b7f2972eeea Mon Sep 17 00:00:00 2001 From: Benjamin Himes Date: Fri, 11 Apr 2025 11:10:21 +0200 Subject: [PATCH 6/9] Typo --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a4c1114589..f19cd338b9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -68,7 +68,7 @@ jobs: name: Install dependencies and Check compatibility command: | if [ "$REQUIREMENTS_CHANGED" == "true" ]; then - python -m pip install ".[dev,cli]" --dry-run --python-version --no-deps << parameters.python.version >> + python -m pip install ".[dev,cli]" --dry-run --python-version --no-deps << parameters.python_version >> else echo "Skipping compatibility checks..." fi From e2d9a3e7af3b61c9b3e5de8f3a8d6a2380f78dbe Mon Sep 17 00:00:00 2001 From: Benjamin Himes Date: Fri, 11 Apr 2025 11:25:02 +0200 Subject: [PATCH 7/9] Test (will be reverted) --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 549dd9b0ab..a441de27ca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,6 +13,7 @@ authors = [ license = { file = "LICENSE" } requires-python = ">=3.9,<3.14" dependencies = [ + "bt-decode>=0.6.0", "wheel", "setuptools~=70.0.0", "aiohttp~=3.9", From d756fdb08f671e0773907d788af8872eb6271979 Mon Sep 17 00:00:00 2001 From: Benjamin Himes Date: Fri, 11 Apr 2025 11:26:59 +0200 Subject: [PATCH 8/9] Typo --- .circleci/config.yml | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f19cd338b9..5677de43b2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -68,7 +68,7 @@ jobs: name: Install dependencies and Check compatibility command: | if [ "$REQUIREMENTS_CHANGED" == "true" ]; then - python -m pip install ".[dev,cli]" --dry-run --python-version --no-deps << parameters.python_version >> + python -m pip install ".[dev,cli]" --dry-run --python-version << parameters.python_version >> --no-deps else echo "Skipping compatibility checks..." fi diff --git a/pyproject.toml b/pyproject.toml index a441de27ca..885b270e16 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,7 @@ authors = [ license = { file = "LICENSE" } requires-python = ">=3.9,<3.14" dependencies = [ - "bt-decode>=0.6.0", + "wheel", "setuptools~=70.0.0", "aiohttp~=3.9", From f63bb3ef134e9a8aea8538996191e7d6d9c8bf96 Mon Sep 17 00:00:00 2001 From: Benjamin Himes Date: Fri, 11 Apr 2025 15:50:44 +0200 Subject: [PATCH 9/9] Remove unused extra --- .github/workflows/e2e-subtensor-tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e-subtensor-tests.yaml b/.github/workflows/e2e-subtensor-tests.yaml index 0c749fabaf..0adcc5ffbd 100644 --- a/.github/workflows/e2e-subtensor-tests.yaml +++ b/.github/workflows/e2e-subtensor-tests.yaml @@ -91,7 +91,7 @@ jobs: uses: astral-sh/setup-uv@v4 - name: install dependencies - run: uv sync --extra dev --extra torch --dev + run: uv sync --extra dev --dev - name: Download Cached Docker Image uses: actions/download-artifact@v4