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.10", "3.11", "3.12", "3.13", "3.14", "3.15"]
python-version: ["3.11", "3.12", "3.13", "3.14", "3.15"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion .tox.justfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Keep in sync with pyproject.toml and .github/workflows/build-artifacts.yml
supported_python_versions := '3.10,3.11,3.12,3.13,3.14,3.15'
supported_python_versions := '3.11,3.12,3.13,3.14,3.15'

install_tox_msg := '''
tox is not installed; to install it using uv:
Expand Down
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Before touching a subsystem, read the relevant notes in `contributing/`: `ARCHIT
- 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.10+ with 4-space indentation and max line length of 99 (see `pyproject.toml`; `E501` is ignored but keep lines readable).
- Python targets 3.11+ 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
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.10"
requires-python = ">=3.11"
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.10"
requires-python = ">=3.11"
dependencies = [
"fastapi",
"uvicorn",
Expand Down
7 changes: 2 additions & 5 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.10"
requires-python = ">=3.11"
classifiers = [
"Development Status :: 4 - Beta",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
Expand All @@ -15,7 +15,6 @@ dependencies = [
"requests",
"requests-unixsocket>=0.4.1",
"typing-extensions>=4.0.0",
"tomli>=2.0; python_version < '3.11'",
"cryptography",
"packaging",
"python-dateutil",
Expand Down Expand Up @@ -90,7 +89,7 @@ ignore-case = true
dstack-plugin-server = { path = "examples/plugins/example_plugin_server", editable = true }

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

[tool.ruff.lint]
Expand Down Expand Up @@ -149,8 +148,6 @@ filterwarnings = [
# Fail on any use of a pydantic v1 shim (`.dict()`, `parse_obj_as`, class-based `Config`, ...)
# so they cannot creep back after the v2 migration.
"error::pydantic.PydanticDeprecatedSince20",
# Remove or change to 3.11 once support for Python 3.10 is dropped.
"ignore:You are using a Python version \\(3.10:FutureWarning:^google\\.",
]

[tool.tox]
Expand Down
3 changes: 1 addition & 2 deletions scripts/docs/gen_schema_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@
import re
from enum import Enum
from fnmatch import fnmatch
from typing import Optional
from typing import Annotated, Any, Dict, Literal, Optional, Type, Union, get_args, get_origin

import mkdocs_gen_files
import yaml
from pydantic import BaseModel, RootModel
from pydantic_core import PydanticUndefined
from typing_extensions import Annotated, Any, Dict, Literal, Type, Union, get_args, get_origin

from dstack._internal.core.models.resources import Range
from mkdocs.structure.files import File
Expand Down
2 changes: 1 addition & 1 deletion scripts/setup_kubernetes.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# /// script
# requires-python = ">=3.10"
# requires-python = ">=3.11"
# dependencies = []
# ///
"""
Expand Down
3 changes: 1 addition & 2 deletions src/dstack/_internal/cli/models/presets.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from datetime import datetime
from typing import List, Literal, Optional, Union
from typing import Annotated, List, Literal, Optional, Union

from pydantic import Field, PositiveInt
from typing_extensions import Annotated

from dstack._internal.core.models.common import CoreModel
from dstack._internal.core.models.configurations import PresetConfiguration
Expand Down
6 changes: 1 addition & 5 deletions src/dstack/_internal/cli/services/presets/agents/codex.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,12 @@
import json
import os
import re
import tomllib
from pathlib import Path
from typing import Literal, Optional, get_args

from pydantic import ValidationError

try:
import tomllib
except ModuleNotFoundError: # Python 3.10
import tomli as tomllib # type: ignore[import-not-found, no-redef]

from dstack._internal.cli.models.preset_agent import CodexStreamEvent, PresetAgentInfo
from dstack._internal.cli.services.presets.agents.base import (
PresetAgentSpec,
Expand Down
2 changes: 1 addition & 1 deletion src/dstack/_internal/cli/services/presets/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def _extract_archive(blob: bytes, target: Path) -> None:
try:
archive.extractall(target.parent, members=members, filter="data")
except TypeError:
# Python < 3.10.12 / < 3.11.4 has no extraction filter; the member
# Python < 3.11.4 has no extraction filter; the member
# checks above are what make this safe.
archive.extractall(target.parent, members=members) # nosec B202

Expand Down
3 changes: 1 addition & 2 deletions src/dstack/_internal/core/backends/azure/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from typing import Annotated, Dict, List, Literal, Optional, Union
from typing import Annotated, Dict, List, Literal, Optional, Self, Union

from pydantic import Field, RootModel, model_validator
from typing_extensions import Self

from dstack._internal.core.models.common import CoreModel
from dstack._internal.utils.common import get_or_error
Expand Down
3 changes: 1 addition & 2 deletions src/dstack/_internal/core/backends/gcp/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from typing import Annotated, Dict, List, Literal, Optional, Union
from typing import Annotated, Dict, List, Literal, Optional, Self, Union

from pydantic import Field, RootModel, model_validator
from typing_extensions import Self

from dstack._internal.core.backends.base.models import fill_data
from dstack._internal.core.models.common import CoreModel
Expand Down
4 changes: 2 additions & 2 deletions src/dstack/_internal/core/backends/jarvislabs/compute.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import shlex
import subprocess
import tempfile
from typing import Callable, List, Optional, cast
from typing import Callable, List, NotRequired, Optional, cast

import gpuhunt
from gpuhunt.providers.jarvislabs import JarvisLabsProvider
from typing_extensions import NotRequired, TypedDict
from typing_extensions import TypedDict

from dstack._internal.core.backends.base.backend import Compute
from dstack._internal.core.backends.base.compute import (
Expand Down
3 changes: 1 addition & 2 deletions src/dstack/_internal/core/backends/kubernetes/compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@
from decimal import Decimal
from enum import Enum
from functools import partial
from typing import List, Optional
from typing import List, Optional, Self

from gpuhunt import AcceleratorVendor
from kubernetes import client
from typing_extensions import Self

from dstack._internal.core.backends.base.authorized_keys import (
build_authorized_keys,
Expand Down
3 changes: 1 addition & 2 deletions src/dstack/_internal/core/backends/kubernetes/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from typing import Annotated, Literal, Optional, Union
from typing import Annotated, Literal, Optional, Self, Union

from pydantic import Field, model_validator
from typing_extensions import Self

from dstack._internal.core.backends.base.models import fill_data
from dstack._internal.core.models.common import CoreModel
Expand Down
3 changes: 1 addition & 2 deletions src/dstack/_internal/core/backends/kubernetes/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from collections.abc import Mapping
from decimal import Decimal
from enum import Enum
from typing import Callable, Literal, Optional, Protocol, Union, cast, get_args
from typing import Callable, Literal, Optional, Protocol, Self, Union, cast, get_args

import gpuhunt
from gpuhunt import KNOWN_AMD_GPUS, KNOWN_NVIDIA_GPUS, AcceleratorVendor
Expand All @@ -18,7 +18,6 @@
V1Toleration,
)
from kubernetes.utils.quantity import parse_quantity as _parse_quantity
from typing_extensions import Self

from dstack._internal.core.backends.base.compute import normalize_arch
from dstack._internal.core.backends.kubernetes.utils import try_delete_object_if_exists
Expand Down
3 changes: 2 additions & 1 deletion src/dstack/_internal/core/backends/kubernetes/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
Generic,
Literal,
Optional,
ParamSpec,
Protocol,
TypeVar,
Union,
Expand All @@ -19,7 +20,7 @@
from kubernetes.client.exceptions import ApiException
from kubernetes.watch import Watch
from pydantic import Field
from typing_extensions import ParamSpec, TypedDict
from typing_extensions import TypedDict

from dstack._internal.core.backends.kubernetes.api_client import (
API_CLIENT_EXCEPTIONS,
Expand Down
3 changes: 1 addition & 2 deletions src/dstack/_internal/core/backends/nebius/models.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import json
from pathlib import Path
from typing import Annotated, Dict, Literal, Optional, Union
from typing import Annotated, Dict, Literal, Optional, Self, Union

from pydantic import Field, field_serializer, model_validator
from typing_extensions import Self

from dstack._internal.core.backends.base.models import fill_data
from dstack._internal.core.models.common import CoreModel
Expand Down
3 changes: 2 additions & 1 deletion src/dstack/_internal/core/backends/oci/auth.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from typing import Any, Mapping

import oci
from typing_extensions import Any, Mapping

from dstack._internal.core.backends.oci.exceptions import any_oci_exception
from dstack._internal.core.backends.oci.models import AnyOCICreds, OCIDefaultCreds
Expand Down
3 changes: 1 addition & 2 deletions src/dstack/_internal/core/backends/oci/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from typing import Annotated, Dict, List, Literal, Optional, Union
from typing import Annotated, Dict, List, Literal, Optional, Self, Union

from pydantic import Field, RootModel, model_validator
from typing_extensions import Self

from dstack._internal.core.models.common import CoreModel

Expand Down
3 changes: 1 addition & 2 deletions src/dstack/_internal/core/backends/runpod/api_client.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from collections.abc import Mapping
from http import HTTPStatus
from typing import Any, Dict, List, Literal, Optional, TypedDict, cast
from typing import Any, Dict, List, Literal, NotRequired, Optional, TypedDict, cast

import requests
from gpuhunt.providers.runpod import RunpodProvider
from typing_extensions import NotRequired

from dstack._internal.core.errors import BackendError, BackendInvalidCredentialsError
from dstack._internal.utils.logging import get_logger
Expand Down
3 changes: 1 addition & 2 deletions src/dstack/_internal/core/backends/slurm/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
import shlex
import uuid
from types import TracebackType
from typing import Optional
from typing import Optional, Self

import paramiko
from typing_extensions import Self

from dstack._internal.core.backends.slurm.resources import Node, ResolvedNode
from dstack._internal.core.errors import ComputeError
Expand Down
3 changes: 1 addition & 2 deletions src/dstack/_internal/core/backends/slurm/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from typing import Annotated, Literal, Optional, Union
from typing import Annotated, Literal, Optional, Self, Union

from pydantic import Field, model_validator
from typing_extensions import Self

from dstack._internal.core.backends.base.models import fill_data
from dstack._internal.core.models.common import CoreModel
Expand Down
3 changes: 1 addition & 2 deletions src/dstack/_internal/core/backends/slurm/resources.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import dataclasses
from typing import Optional
from typing import Optional, Self

import gpuhunt
from typing_extensions import Self

from dstack._internal.core.models.instances import Gpu
from dstack._internal.core.models.resources import (
Expand Down
3 changes: 1 addition & 2 deletions src/dstack/_internal/core/backends/vastai/compute.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import time
from typing import List, Optional
from typing import List, Optional, assert_never

import gpuhunt
from gpuhunt.providers.vastai import VastAIProvider
from typing_extensions import assert_never

from dstack._internal.core.backends.base.authorized_keys import build_authorized_keys
from dstack._internal.core.backends.base.backend import Compute
Expand Down
3 changes: 1 addition & 2 deletions src/dstack/_internal/core/models/common.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
from enum import Enum
from typing import Any, Optional, TypeVar, Union, overload
from typing import Annotated, Any, Optional, TypeVar, Union, overload

from pydantic import (
BaseModel,
ConfigDict,
Field,
TypeAdapter,
)
from typing_extensions import Annotated

# pydantic v2 generates draft 2020-12. The published `configuration.json` / `profiles.json`
# advertise the dialect they were generated for, so this has to move with pydantic.
Expand Down
3 changes: 2 additions & 1 deletion src/dstack/_internal/core/models/config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from typing import Annotated, List, Optional

from pydantic.fields import Field
from typing_extensions import Annotated, List, Optional

from dstack._internal.core.models.common import CoreModel
from dstack._internal.core.models.repos.base import RepoType
Expand Down
3 changes: 1 addition & 2 deletions src/dstack/_internal/core/models/configurations.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from collections import Counter
from enum import Enum
from pathlib import PurePosixPath
from typing import Annotated, Any, Dict, List, Literal, Optional, Union
from typing import Annotated, Any, Dict, List, Literal, Optional, Self, Union

from pydantic import (
BeforeValidator,
Expand All @@ -20,7 +20,6 @@
model_validator,
)
from pydantic_core import CoreSchema, core_schema
from typing_extensions import Self

from dstack._internal.core.errors import ConfigurationError
from dstack._internal.core.models.common import (
Expand Down
3 changes: 1 addition & 2 deletions src/dstack/_internal/core/models/duration.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import re
from typing import Any, Optional, Union
from typing import Annotated, Any, Literal, Optional, Union, overload

from pydantic import BeforeValidator, GetCoreSchemaHandler, GetJsonSchemaHandler
from pydantic.json_schema import JsonSchemaValue
from pydantic_core import CoreSchema, core_schema
from typing_extensions import Annotated, Literal, overload


class Duration(int):
Expand Down
15 changes: 13 additions & 2 deletions src/dstack/_internal/core/models/envs.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
import re
from typing import Dict, Iterable, Iterator, List, Mapping, NamedTuple, Tuple, Union, cast
from typing import (
Annotated,
Dict,
Iterable,
Iterator,
List,
Mapping,
NamedTuple,
Self,
Tuple,
Union,
cast,
)

from pydantic import ConfigDict, Field, RootModel, field_validator
from typing_extensions import Annotated, Self

from dstack._internal.core.models.common import CoreModel

Expand Down
3 changes: 1 addition & 2 deletions src/dstack/_internal/core/models/files.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import pathlib
import string
from typing import Any
from typing import Annotated, Any, Self
from uuid import UUID

from pydantic import Field, GetCoreSchemaHandler, field_validator
from pydantic_core import CoreSchema, core_schema
from typing_extensions import Annotated, Self

from dstack._internal.core.models.common import CoreModel

Expand Down
Loading
Loading