Skip to content

Commit 953647b

Browse files
committed
Migrate to pyproject.toml
1 parent 621b18d commit 953647b

File tree

6 files changed

+3485
-240
lines changed

6 files changed

+3485
-240
lines changed

.github/workflows/build.yml

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ name: Build
33
on:
44
push:
55
branches:
6-
- 'master'
6+
- "master"
77
paths-ignore:
8-
- 'docs/**'
9-
- 'mkdocs.yml'
8+
- "docs/**"
9+
- "mkdocs.yml"
1010
pull_request:
1111
branches:
12-
- 'master'
12+
- "master"
1313
workflow_dispatch:
1414
inputs:
1515
intergation-tests:
@@ -56,20 +56,20 @@ jobs:
5656
path: frontend/build
5757

5858
python-test:
59-
needs: [ python-lint, frontend-build ]
59+
needs: [python-lint, frontend-build]
6060
runs-on: ${{ matrix.os }}
6161
strategy:
6262
matrix:
63-
os: [ macos-latest, ubuntu-latest, windows-latest ]
64-
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
63+
os: [macos-latest, ubuntu-latest, windows-latest]
64+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
6565
steps:
6666
- uses: actions/checkout@v4
6767
- name: Set up Python ${{ matrix.python-version }}
68-
uses: actions/setup-python@v5
68+
uses: astral-sh/setup-uv@v5
6969
with:
7070
python-version: ${{ matrix.python-version }}
7171
- name: Install dependencies
72-
run: pip install -U '.[all]' -r requirements_dev.txt
72+
run: uv sync --all-extras --frozen
7373
- name: Download frontend build
7474
uses: actions/download-artifact@v4
7575
with:
@@ -83,15 +83,15 @@ jobs:
8383
if [ "${{ matrix.os }}" != "macos-latest" ]; then
8484
RUNPOSTGRES="--runpostgres"
8585
fi
86-
pytest src/tests --runui $RUNPOSTGRES
86+
uv run pytest src/tests --runui $RUNPOSTGRES
8787
- name: Run pytest on Windows
8888
if: matrix.os == 'windows-latest'
8989
run: |
90-
pytest src/tests --runui --runpostgres
90+
uv run pytest src/tests --runui --runpostgres
9191
9292
update-get-dstack:
9393
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
94-
needs: [ python-test ]
94+
needs: [python-test]
9595
runs-on: ubuntu-latest
9696
env:
9797
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
@@ -201,24 +201,24 @@ jobs:
201201
202202
generate-json-schema:
203203
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
204-
needs: [ python-test ]
204+
needs: [python-test]
205205
env:
206206
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
207207
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
208208
runs-on: ubuntu-latest
209209
steps:
210210
- uses: actions/checkout@v4
211-
- uses: actions/setup-python@v5
211+
- uses: astral-sh/setup-uv@v5
212212
with:
213213
python-version: 3.11
214214
- name: Install AWS
215-
run: pip install awscli
215+
run: uv tool install awscli
216216
- name: Install dstack
217-
run: pip install .
217+
run: uv sync --frozen
218218
- name: Generate json schema
219219
run: |
220-
python -c "from dstack._internal.core.models.configurations import DstackConfiguration; print(DstackConfiguration.schema_json(indent=2))" > configuration.json
221-
python -c "from dstack._internal.core.models.profiles import ProfilesConfig; print(ProfilesConfig.schema_json(indent=2))" > profiles.json
220+
uv run python -c "from dstack._internal.core.models.configurations import DstackConfiguration; print(DstackConfiguration.schema_json(indent=2))" > configuration.json
221+
uv run python -c "from dstack._internal.core.models.profiles import ProfilesConfig; print(ProfilesConfig.schema_json(indent=2))" > profiles.json
222222
- name: Upload json schema to S3
223223
run: |
224224
VERSION=$((${{ github.run_number }} + ${{ env.BUILD_INCREMENT }}))
@@ -235,20 +235,18 @@ jobs:
235235
working-directory: gateway
236236
steps:
237237
- uses: actions/checkout@v4
238-
- name: Set up Python 3.11
239-
uses: actions/setup-python@v5
238+
- name: Set up uv
239+
uses: astral-sh/setup-uv@v5
240240
with:
241241
python-version: 3.11
242242
- name: Install AWS
243-
run: pip install awscli
244-
- name: Install dependencies
245-
run: pip install wheel build
243+
run: uv tool install awscli
246244
- name: Compute version
247245
run: echo VERSION=$((${{ github.run_number }} + ${{ env.BUILD_INCREMENT }})) > $GITHUB_ENV
248246
- name: Build package
249247
run: |
250248
echo "__version__ = \"${{ env.VERSION }}\"" > src/dstack/gateway/version.py
251-
python -m build .
249+
uv build
252250
- name: Upload to S3
253251
env:
254252
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
@@ -257,23 +255,24 @@ jobs:
257255
WHEEL=dstack_gateway-${{ env.VERSION }}-py3-none-any.whl
258256
aws s3 cp dist/$WHEEL "s3://dstack-gateway-downloads/stgn/$WHEEL"
259257
echo "${{ env.VERSION }}" | aws s3 cp - "s3://dstack-gateway-downloads/stgn/latest-version"
260-
258+
261259
docs-build:
262260
# Skip for PRs from forks since mkdocs-material-insiders is not available in forks
263261
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
264262
runs-on: ubuntu-latest
265263
steps:
266264
- uses: actions/checkout@v4
267-
- uses: actions/setup-python@v5
265+
- uses: astral-sh/setup-uv@v5
268266
with:
269267
python-version: 3.11
270268
- name: Install dstack
271269
run: |
272-
pip install -e .[server]
270+
uv sync --extra server --frozen
271+
# Move these deps into an extra and install that way
273272
- name: Build
274273
run: |
275-
pip install pillow cairosvg
274+
uv pip install pillow cairosvg
276275
sudo apt-get install -y libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev
277-
pip install mkdocs-material "mkdocs-material[imaging]" mkdocs-material-extensions mkdocs-redirects mkdocs-gen-files "mkdocstrings[python]" mkdocs-render-swagger-plugin --upgrade
278-
pip install git+https://${{ secrets.GH_TOKEN }}@github.com/squidfunk/mkdocs-material-insiders.git
279-
mkdocs build -s
276+
uv pip install mkdocs-material "mkdocs-material[imaging]" mkdocs-material-extensions mkdocs-redirects mkdocs-gen-files "mkdocstrings[python]" mkdocs-render-swagger-plugin --upgrade
277+
uv pip install git+https://${{ secrets.GH_TOKEN }}@github.com/squidfunk/mkdocs-material-insiders.git
278+
uv mkdocs build -s

.github/workflows/docker.yml

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ on:
3434

3535
env:
3636
PACKER_VERSION: "1.9.2"
37-
BUILD_PREFIX: ${{ inputs.staging && format('stgn-{0}-', github.run_number) || '' }} # staging ? prefix : ''
37+
BUILD_PREFIX: ${{ inputs.staging && format('stgn-{0}-', github.run_number) || '' }} # staging ? prefix : ''
3838

3939
jobs:
4040
build-docker:
@@ -45,23 +45,23 @@ jobs:
4545
runs-on: ubuntu-latest
4646
strategy:
4747
matrix:
48-
python: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
48+
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
4949
steps:
50-
- name: Checkout repository
51-
uses: actions/checkout@v4
52-
- name: Set up Docker Buildx
53-
uses: docker/setup-buildx-action@v3
54-
- name: Login to DockerHub
55-
uses: docker/login-action@v3
56-
with:
57-
username: ${{ secrets.DOCKERHUB_USERNAME }}
58-
password: ${{ secrets.DOCKERHUB_TOKEN }}
59-
- name: Set up QEMU
60-
uses: docker/setup-qemu-action@v3
61-
- name: Build and upload to DockerHub
62-
run: |
63-
docker buildx build --platform linux/amd64 --build-arg PYTHON=${{ matrix.python }} --push --provenance=false --tag dstackai/base:py${{ matrix.python }}-${{ inputs.image_version }}-cuda-12.1 -f base/Dockerfile .
64-
docker buildx build --platform linux/amd64 --build-arg PYTHON=${{ matrix.python }} --build-arg VERSION=${{ inputs.image_version }} --push --provenance=false --tag dstackai/base:py${{ matrix.python }}-${{ inputs.image_version }}-cuda-12.1-devel -f base/devel.Dockerfile .
50+
- name: Checkout repository
51+
uses: actions/checkout@v4
52+
- name: Set up Docker Buildx
53+
uses: docker/setup-buildx-action@v3
54+
- name: Login to DockerHub
55+
uses: docker/login-action@v3
56+
with:
57+
username: ${{ secrets.DOCKERHUB_USERNAME }}
58+
password: ${{ secrets.DOCKERHUB_TOKEN }}
59+
- name: Set up QEMU
60+
uses: docker/setup-qemu-action@v3
61+
- name: Build and upload to DockerHub
62+
run: |
63+
docker buildx build --platform linux/amd64 --build-arg PYTHON=${{ matrix.python }} --push --provenance=false --tag dstackai/base:py${{ matrix.python }}-${{ inputs.image_version }}-cuda-12.1 -f base/Dockerfile .
64+
docker buildx build --platform linux/amd64 --build-arg PYTHON=${{ matrix.python }} --build-arg VERSION=${{ inputs.image_version }} --push --provenance=false --tag dstackai/base:py${{ matrix.python }}-${{ inputs.image_version }}-cuda-12.1-devel -f base/devel.Dockerfile .
6565
6666
build-aws-images:
6767
needs: build-docker
@@ -75,7 +75,7 @@ jobs:
7575
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
7676
strategy:
7777
matrix:
78-
variant: [ "", "-cuda" ]
78+
variant: ["", "-cuda"]
7979
steps:
8080
- uses: actions/checkout@v4
8181
- name: Download packer
@@ -87,7 +87,7 @@ jobs:
8787
run: |
8888
./packer build -var-file=versions.json $PROD_VARS -var image_version=${{ inputs.image_version }} -var build_prefix=$BUILD_PREFIX aws-image${{ matrix.variant }}.json
8989
env:
90-
PROD_VARS: ${{ !inputs.staging && '-var-file=aws-vars-prod.json' || '' }} # production ? var-file : ''
90+
PROD_VARS: ${{ !inputs.staging && '-var-file=aws-vars-prod.json' || '' }} # production ? var-file : ''
9191

9292
build-azure-images:
9393
needs: build-docker
@@ -104,7 +104,7 @@ jobs:
104104
VERSION: ${{ github.run_number }}
105105
strategy:
106106
matrix:
107-
variant: [ "", "-cuda", "-grid" ]
107+
variant: ["", "-cuda", "-grid"]
108108
steps:
109109
- uses: actions/checkout@v4
110110
- uses: Azure/login@v2
@@ -135,17 +135,17 @@ jobs:
135135
runs-on: ubuntu-latest
136136
strategy:
137137
matrix:
138-
variant: [ "", "-cuda" ]
138+
variant: ["", "-cuda"]
139139
permissions:
140-
contents: 'read'
141-
id-token: 'write'
140+
contents: "read"
141+
id-token: "write"
142142
steps:
143143
- uses: actions/checkout@v4
144144
- name: Authenticate to Google Cloud
145145
uses: google-github-actions/auth@v2
146146
with:
147-
workload_identity_provider: 'projects/531508670106/locations/global/workloadIdentityPools/github-identity-pool/providers/github-id-provider'
148-
service_account: '[email protected]'
147+
workload_identity_provider: "projects/531508670106/locations/global/workloadIdentityPools/github-identity-pool/providers/github-id-provider"
148+
service_account: "[email protected]"
149149
create_credentials_file: true
150150
- name: Set up Cloud SDK
151151
uses: google-github-actions/setup-gcloud@v2
@@ -175,7 +175,7 @@ jobs:
175175
OCI_REGION: eu-frankfurt-1
176176
strategy:
177177
matrix:
178-
variant: [ "", "-cuda" ]
178+
variant: ["", "-cuda"]
179179
steps:
180180
- uses: actions/checkout@v4
181181
- name: Setup OCI config
@@ -211,23 +211,23 @@ jobs:
211211
-var oci_subnet_ocid=$OCI_SUBNET \
212212
-var oci_availability_domain=$OCI_AVAILABILITY_DOMAIN \
213213
oci-image${{ matrix.variant }}.json
214-
- uses: actions/setup-python@v5
214+
- uses: astral-sh/setup-uv@v5
215215
with:
216-
python-version: '3.12'
216+
python-version: "3.12"
217217
- name: Install dependencies for publishing
218218
run: |
219-
pip install .[oci]
219+
uv sync --extra oci --frozen
220220
- name: Copy image to target regions
221221
if: ${{ !inputs.staging }}
222222
run: |
223-
python scripts/oci_image_tools.py copy \
223+
uv run scripts/oci_image_tools.py copy \
224224
--image ${BUILD_PREFIX}dstack${{ matrix.variant }}-${{ inputs.image_version }} \
225225
--from $OCI_REGION \
226226
--compartment $OCI_COMPARTMENT
227227
- name: Publish image in OCI Marketplace
228228
if: ${{ !inputs.staging }}
229229
run: |
230-
python scripts/oci_image_tools.py publish \
230+
uv run scripts/oci_image_tools.py publish \
231231
--image ${BUILD_PREFIX}dstack${{ matrix.variant }}-${{ inputs.image_version }} \
232232
--compartment $OCI_COMPARTMENT \
233233
--version ${{ inputs.image_version }} \

0 commit comments

Comments
 (0)