Skip to content

Commit 0d82302

Browse files
authored
Detect dstack version from file instead of git (#2524)
1 parent f1fbec8 commit 0d82302

File tree

6 files changed

+12
-8
lines changed

6 files changed

+12
-8
lines changed

docker/server/stgn/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ ENV PATH="/root/.local/bin/:$PATH"
2222

2323
COPY pyproject.toml uv.lock README.md ./
2424
COPY src src
25-
RUN SETUPTOOLS_SCM_PRETEND_VERSION=0.0.0 uv sync --extra all
25+
RUN uv sync --extra all
2626

2727
COPY docker/server/entrypoint.sh entrypoint.sh
2828
RUN chmod 777 entrypoint.sh

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ Changelog = "https://github.com/dstackai/dstack/releases"
4545
Discord = "https://discord.gg/u8SmfwPpMd"
4646

4747
[build-system]
48-
requires = ["hatchling", "hatch-vcs", "hatch-fancy-pypi-readme"]
48+
requires = ["hatchling", "hatch-fancy-pypi-readme"]
4949
build-backend = "hatchling.build"
5050

5151
[project.scripts]
5252
dstack = "dstack._internal.cli.main:main"
5353

5454
[tool.hatch.version]
55-
source = "vcs"
55+
path = "src/dstack/version.py"
5656

5757
[tool.hatch.version.raw-options]
5858
version_scheme = "no-guess-dev"

src/dstack/_internal/cli/commands/server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
from argparse import Namespace
33

4-
from dstack import version
4+
from dstack._internal import settings
55
from dstack._internal.cli.commands import BaseCommand
66
from dstack._internal.core.errors import CLIError
77

@@ -78,7 +78,7 @@ def _command(self, args: Namespace):
7878
"dstack._internal.server.main:app",
7979
host=args.host,
8080
port=args.port,
81-
reload=version.__version__ is None and not reload_disabled,
81+
reload=settings.DSTACK_VERSION is None and not reload_disabled,
8282
log_level=uvicorn_log_level,
8383
workers=1,
8484
)

src/dstack/_internal/cli/utils/updates.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,7 @@ def _get_last_check_path() -> Path:
7979

8080

8181
def check_for_updates():
82-
current_version = version.__version__
83-
if current_version:
82+
if version.__is_release__:
8483
if _is_last_check_time_outdated():
8584
logger.debug("Checking for updates...")
8685
_check_version()

src/dstack/_internal/settings.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
from dstack import version
44

55
DSTACK_VERSION = os.getenv("DSTACK_VERSION", version.__version__)
6+
if DSTACK_VERSION == "0.0.0":
7+
# The build backend (hatching) requires not None for versions,
8+
# but the code currently treats None as dev version.
9+
# TODO: update the code to treat 0.0.0 as dev version.
10+
DSTACK_VERSION = None
611
DSTACK_RELEASE = os.getenv("DSTACK_RELEASE") is not None or version.__is_release__
712
DSTACK_USE_LATEST_FROM_BRANCH = os.getenv("DSTACK_USE_LATEST_FROM_BRANCH") is not None
813

src/dstack/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
__version__ = None
1+
__version__ = "0.0.0"
22
__is_release__ = False
33
base_image = "0.7"

0 commit comments

Comments
 (0)