Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/build-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
- Frontend: from `frontend/` run `npm install`, `npm run build`, then copy `frontend/build` into `src/dstack/_internal/server/statics/`; for dev, `npm run start` with API on port 8000.

## Coding Style & Naming Conventions
- Python targets 3.9+ with 4-space indentation and max line length of 99 (see `ruff.toml`; `E501` is ignored but keep lines readable).
- Python targets 3.10+ with 4-space indentation and max line length of 99 (see `pyproject.toml`; `E501` is ignored but keep lines readable).
- Imports are sorted via Ruff’s isort settings (`dstack` treated as first-party).
- Keep primary/public functions before local helper functions in a module section.
- Roughly keep function definitions in the order they are referenced within a file so call flow stays easy to follow.
Expand Down
3 changes: 0 additions & 3 deletions docs/docs/concepts/backends.md
Original file line number Diff line number Diff line change
Expand Up @@ -741,9 +741,6 @@ projects:

</div>

!!! info "Python version"
Nebius is only supported if `dstack server` is running on Python 3.10 or higher.


### Crusoe

Expand Down
2 changes: 1 addition & 1 deletion examples/plugins/example_plugin/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ readme = "README.md"
authors = [
{ name = "Victor Skvortsov", email = "victor@dstack.ai" }
]
requires-python = ">=3.9"
requires-python = ">=3.10"
dependencies = []

[build-system]
Expand Down
2 changes: 1 addition & 1 deletion examples/plugins/example_plugin_server/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "dstack-plugin-server"
version = "0.1.0"
description = "Example plugin server"
readme = "README.md"
requires-python = ">=3.9"
requires-python = ">=3.10"
dependencies = [
"fastapi",
"uvicorn",
Expand Down
11 changes: 5 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "dstack"
dynamic = ["version", "readme"]
authors = [{ name = "Andrey Cheptsov", email = "andrey@dstack.ai" }]
description = "dstack is an open-source orchestration engine for running AI workloads on any cloud or on-premises."
requires-python = ">=3.9"
requires-python = ">=3.10"
classifiers = [
"Development Status :: 4 - Beta",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
Expand Down Expand Up @@ -82,7 +82,7 @@ ignore-case = true
dstack-plugin-server = { path = "examples/plugins/example_plugin_server", editable = true }

[tool.ruff]
target-version = "py39"
target-version = "py310"
line-length = 99

[tool.ruff.lint]
Expand Down Expand Up @@ -198,7 +198,6 @@ server = [
"python-json-logger>=3.1.0",
"prometheus-client",
"grpcio>=1.50",
"backports.entry-points-selectable",
]
aws = [
"boto3>=1.38.13",
Expand Down Expand Up @@ -226,11 +225,11 @@ gcp = [
"dstack[server]",
]
datacrunch = [
"verda>=1.23.0; python_version >= '3.10'",
"verda>=1.23.0",
"dstack[server]",
]
verda = [
"verda>=1.23.0; python_version >= '3.10'",
"verda>=1.23.0",
"dstack[server]",
]
kubernetes = [
Expand All @@ -251,7 +250,7 @@ oci = [
"dstack[server]",
]
nebius = [
"nebius>=0.3.4,<0.4; python_version >= '3.10'",
"nebius>=0.3.4,<0.4",
"dstack[server]",
]
fluentbit = [
Expand Down
5 changes: 2 additions & 3 deletions src/dstack/_internal/server/services/plugins.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import itertools
from importlib import import_module
from importlib.metadata import entry_points
from typing import Dict

from backports.entry_points_selectable import entry_points # backport for Python 3.9

from dstack._internal.core.errors import ServerClientError
from dstack._internal.utils.common import run_async
from dstack._internal.utils.logging import get_logger
Expand Down Expand Up @@ -60,7 +59,7 @@ def load_plugins(enabled_plugins: list[str]):
_PLUGINS.clear()
entrypoints: dict[str, PluginEntrypoint] = {}
plugins_to_load = enabled_plugins.copy()
for entrypoint in entry_points(group="dstack.plugins"): # type: ignore[call-arg]
for entrypoint in entry_points(group="dstack.plugins"):
if entrypoint.name not in enabled_plugins:
logger.info(
("Found not enabled plugin %s. Plugin will not be loaded."),
Expand Down
27 changes: 11 additions & 16 deletions src/tests/_internal/cli/utils/test_offer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import asyncio
import pytest

from dstack._internal.cli.utils.common import console
from dstack._internal.cli.utils.run import print_run_plan
Expand Down Expand Up @@ -34,18 +34,11 @@ def _get_offer(index: int) -> InstanceOfferWithAvailability:
)


def _get_run_plan(*, offers: list[InstanceOfferWithAvailability], total_offers: int) -> RunPlan:
async def _get_run_plan(
*, offers: list[InstanceOfferWithAvailability], total_offers: int
) -> RunPlan:
run_spec = get_run_spec(repo_id="test-repo")
# Keep this helper's asyncio state isolated. `asyncio.run()` clears the current event loop,
# which breaks later Python 3.9 tests that still construct asyncio primitives via
# `get_event_loop()` on the main thread.
loop = asyncio.new_event_loop()
try:
job = loop.run_until_complete(
get_jobs_from_run_spec(run_spec=run_spec, secrets={}, replica_num=0)
)[0]
finally:
loop.close()
job = (await get_jobs_from_run_spec(run_spec=run_spec, secrets={}, replica_num=0))[0]
return RunPlan(
project_name="test-project",
user="test-user",
Expand All @@ -64,8 +57,9 @@ def _get_run_plan(*, offers: list[InstanceOfferWithAvailability], total_offers:


class TestPrintRunPlanOfferHint:
def test_prints_hint_before_short_offer_table(self):
run_plan = _get_run_plan(offers=[_get_offer(1), _get_offer(2)], total_offers=2)
@pytest.mark.asyncio
async def test_prints_hint_before_short_offer_table(self):
run_plan = await _get_run_plan(offers=[_get_offer(1), _get_offer(2)], total_offers=2)

with console.capture() as capture:
print_run_plan(
Expand All @@ -78,9 +72,10 @@ def test_prints_hint_before_short_offer_table(self):
assert " ".join(_OFFER_FLEET_HINT.split()) in " ".join(output.split())
assert output.index(_OFFER_FLEET_HINT_START) < output.index("1 aws (us-east-1)")

def test_prints_hint_after_truncated_offer_table(self):
@pytest.mark.asyncio
async def test_prints_hint_after_truncated_offer_table(self):
offers = [_get_offer(index) for index in range(1, 4)]
run_plan = _get_run_plan(offers=offers, total_offers=10)
run_plan = await _get_run_plan(offers=offers, total_offers=10)

with console.capture() as capture:
print_run_plan(
Expand Down
5 changes: 0 additions & 5 deletions src/tests/_internal/core/backends/verda/test_compute.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import sys
from types import SimpleNamespace
from unittest.mock import MagicMock, patch

import pytest

if sys.version_info < (3, 10):
pytest.skip("Verda requires Python 3.10", allow_module_level=True)

from verda.exceptions import APIException

from dstack._internal.core.backends.verda.compute import (
Expand Down
6 changes: 0 additions & 6 deletions src/tests/_internal/core/backends/verda/test_configurator.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import sys
from unittest.mock import patch

import pytest

if sys.version_info < (3, 10):
pytest.skip("Verda requires Python 3.10", allow_module_level=True)

from dstack._internal.core.backends.verda.configurator import (
VerdaConfigurator,
)
Expand Down
8 changes: 3 additions & 5 deletions src/tests/_internal/server/routers/test_backends.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import json
import sys
from collections.abc import Sequence
from datetime import datetime, timezone
from typing import Any, Optional
Expand Down Expand Up @@ -89,17 +88,17 @@ async def test_returns_backend_types(self, client: AsyncClient):
"cloudrift",
"crusoe",
"cudo",
*(["datacrunch"] if sys.version_info >= (3, 10) else []),
"datacrunch",
"digitalocean",
"gcp",
"hotaisle",
"kubernetes",
"lambda",
*(["nebius"] if sys.version_info >= (3, 10) else []),
"nebius",
"oci",
"runpod",
"vastai",
*(["verda"] if sys.version_info >= (3, 10) else []),
"verda",
"vultr",
]

Expand Down Expand Up @@ -221,7 +220,6 @@ async def test_creates_lambda_backend(
assert len(res.scalars().all()) == 1

@pytest.mark.asyncio
@pytest.mark.skipif(sys.version_info < (3, 10), reason="Nebius requires Python 3.10")
@pytest.mark.parametrize("test_db", ["sqlite", "postgres"], indirect=True)
class TestNebius:
@pytest.fixture(autouse=True)
Expand Down
3 changes: 0 additions & 3 deletions src/tests/_internal/server/services/test_backend_configs.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import json
import sys
from pathlib import Path
from textwrap import dedent
from unittest.mock import patch

import pytest
import yaml

from dstack._internal.core.backends.kubernetes.backend import KubernetesBackend
Expand Down Expand Up @@ -57,7 +55,6 @@ def test_config_parsing(self, tmp_path: Path):
assert backend_cfg.creds.secret_key == "test-secret-key"


@pytest.mark.skipif(sys.version_info < (3, 10), reason="Nebius requires Python 3.10")
class TestNebiusBackendConfig:
def test_with_filename(self, tmp_path: Path):
creds_json = {
Expand Down
Loading