diff --git a/.circleci/config.yml b/.circleci/config.yml index fbe39a6645..5677de43b2 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 @@ -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 << parameters.python_version >> --no-deps else echo "Skipping compatibility checks..." fi @@ -87,31 +85,19 @@ 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: | python -m venv .venv . .venv/bin/activate 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" }} + uv sync --extra dev --dev - run: name: Install Bittensor command: | . .venv/bin/activate - uv sync --all-extras --dev + uv sync --extra dev --dev - run: name: Instantiate Mock Wallet @@ -178,32 +164,20 @@ 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: | python -m venv .venv . .venv/bin/activate python -m pip install --upgrade uv - uv sync --all-extras --dev + uv sync --extra dev --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: | . .venv/bin/activate - uv sync --all-extras --dev + uv sync --extra dev --dev - run: name: Lint with flake8 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/.github/workflows/e2e-subtensor-tests.yaml b/.github/workflows/e2e-subtensor-tests.yaml index bf57be4684..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 --all-extras --dev + run: uv sync --extra dev --dev - name: Download Cached Docker Image uses: actions/download-artifact@v4 diff --git a/pyproject.toml b/pyproject.toml index 76cba69863..885b270e16 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,6 +13,7 @@ authors = [ license = { file = "LICENSE" } requires-python = ">=3.9,<3.14" dependencies = [ + "wheel", "setuptools~=70.0.0", "aiohttp~=3.9", @@ -67,6 +68,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 07a6bcf5aa..0000000000 --- a/requirements/torch.txt +++ /dev/null @@ -1 +0,0 @@ -torch>=1.13.1,<3.0 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..."