Skip to content

Commit 2b1f787

Browse files
authored
Switch to pyproject.toml (#146)
1 parent f905a16 commit 2b1f787

17 files changed

Lines changed: 198 additions & 203 deletions

File tree

.github/workflows/ci-cloud.yml

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,7 @@ defaults:
1212
shell: bash
1313

1414
jobs:
15-
access-secrets:
16-
# try to access secrets to ensure they are available
17-
# if not set job output to be false
18-
runs-on: ubuntu-latest
19-
outputs:
20-
secrets_available: ${{ steps.check_secrets.outputs.secrets_available }}
21-
steps:
22-
- name: Check secrets
23-
id: check_secrets
24-
run: |
25-
if [[ -z "${{ secrets.LIGHTNING_USER_ID }}" || -z "${{ secrets.LIGHTNING_API_KEY }}" ]]; then
26-
echo "Secrets are not set. Exiting..."
27-
echo "secrets_available=false" >> $GITHUB_OUTPUT
28-
else
29-
echo "Secrets are available."
30-
echo "secrets_available=true" >> $GITHUB_OUTPUT
31-
fi
32-
3315
integration:
34-
needs: access-secrets
35-
if: needs.access-secrets.outputs.secrets_available == 'true'
3616
runs-on: ${{ matrix.os }}
3717
strategy:
3818
fail-fast: false
@@ -49,6 +29,7 @@ jobs:
4929
TORCH_URL: "https://download.pytorch.org/whl/cpu/torch_stable.html"
5030
DISABLE_MPS: ${{ matrix.os == 'macOS-14' && '1' || '0' }}
5131
UV_TORCH_BACKEND: "cpu"
32+
LIGHTNING_CLOUD_URL: https://staging.gridai.dev
5233

5334
steps:
5435
- uses: actions/checkout@v5
@@ -64,7 +45,7 @@ jobs:
6445
if: matrix.requires == 'oldest'
6546
run: |
6647
uv pip install 'lightning-utilities[cli]'
67-
python -m lightning_utilities.cli requirements set-oldest --req_files='["requirements.txt"]'
48+
python -m lightning_utilities.cli requirements set-oldest --req_files='["requirements.txt", "pyproject.toml"]'
6849
6950
- name: Install package & dependencies
7051
run: |

.github/workflows/ci-testing.yml

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,36 @@ jobs:
2626
python-version: ["3.10", "3.12"]
2727
requires: ["latest"]
2828
dependency: ["lightning"]
29+
dependency_package: ["lightning"]
2930
include:
30-
- { os: "ubuntu-22.04", python-version: "3.10", requires: "oldest", dependency: "lightning" }
31-
- { os: "ubuntu-24.04", python-version: "3.12", requires: "latest", dependency: "pytorch_lightning" }
32-
- { os: "windows-2022", python-version: "3.12", requires: "latest", dependency: "pytorch_lightning" }
33-
- { os: "macOS-14", python-version: "3.12", requires: "latest", dependency: "pytorch_lightning" }
31+
- {
32+
os: "ubuntu-22.04",
33+
python-version: "3.10",
34+
requires: "oldest",
35+
dependency: "lightning",
36+
dependency_package: "lightning",
37+
}
38+
- {
39+
os: "ubuntu-24.04",
40+
python-version: "3.12",
41+
requires: "latest",
42+
dependency: "pytorch_lightning",
43+
dependency_package: "pytorch-lightning",
44+
}
45+
- {
46+
os: "windows-2022",
47+
python-version: "3.12",
48+
requires: "latest",
49+
dependency: "pytorch_lightning",
50+
dependency_package: "pytorch-lightning",
51+
}
52+
- {
53+
os: "macOS-14",
54+
python-version: "3.12",
55+
requires: "latest",
56+
dependency: "pytorch_lightning",
57+
dependency_package: "pytorch-lightning",
58+
}
3459

3560
# Timeout: https://stackoverflow.com/a/59076067/4521646
3661
timeout-minutes: 35
@@ -53,16 +78,15 @@ jobs:
5378
if: matrix.requires == 'oldest'
5479
run: |
5580
uv pip install 'lightning-utilities[cli]'
56-
python -m lightning_utilities.cli requirements set-oldest --req_files='["requirements.txt"]'
81+
python -m lightning_utilities.cli requirements set-oldest --req_files='["requirements.txt", "pyproject.toml"]'
5782
5883
- name: Adjust requirements
5984
run: |
6085
uv pip install 'lightning-utilities[cli]' -q
6186
python -m lightning_utilities.cli requirements replace-pkg \
6287
--old_package="lightning" \
63-
--new_package="${{matrix.dependency}}" \
64-
--req_files='["_requirements/extra.txt"]'
65-
cat _requirements/extra.txt
88+
--new_package="${{ matrix.dependency_package }}" \
89+
--req_files='["pyproject.toml"]'
6690
6791
- name: Install package & dependencies
6892
run: |

.github/workflows/docs-build.yml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,30 @@ on:
66

77
jobs:
88
build-docs:
9-
uses: Lightning-AI/utilities/.github/workflows/check-docs.yml@main
10-
with:
11-
requirements-file: "_requirements/_docs.txt"
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v5
12+
13+
- name: Install uv and set Python 3.10
14+
uses: astral-sh/setup-uv@v7
15+
with:
16+
python-version: "3.10"
17+
activate-environment: true
18+
enable-cache: true
19+
20+
- name: Install package & docs dependencies
21+
run: uv pip install -e '.[docs]'
22+
23+
- name: Build docs
24+
env:
25+
SPHINX_MOCK_REQUIREMENTS: "0"
26+
run: python -m sphinx -b html -W --keep-going docs/source docs/build/html
27+
28+
- name: Upload prepared docs
29+
uses: actions/upload-artifact@v4
30+
with:
31+
name: docs-html-${{ github.sha }}
32+
path: docs/build/html
1233

1334
# https://github.com/marketplace/actions/deploy-to-github-pages
1435
docs-deploy:

.github/workflows/release-pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929

3030
- name: Install dependencies
3131
run: |
32-
uv pip install -U -r _requirements/_ci.txt
32+
uv pip install -U '.[build]'
3333
uv pip list
3434
3535
- name: Build package

MANIFEST.in

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ recursive-exclude __pycache__ *.py[cod] *.orig
55

66
# Include the README and CHANGELOG
77
include *.md
8+
include pyproject.toml
89
recursive-include src *.md
910

1011
# Include the license file
1112
include LICENSE
1213

1314
# Exclude build configs
1415
exclude *.sh
15-
exclude *.toml
1616
exclude *.svg
1717
exclude *.yml
1818
exclude *.yaml
@@ -28,7 +28,6 @@ exclude docs
2828

2929
# Include the Requirements
3030
include requirements.txt
31-
recursive-include _requirements *.tx;t
3231

3332
# Exclude Makefile
3433
exclude Makefile

Makefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,15 @@ export SLURM_LOCALID=0
66
export SPHINX_MOCK_REQUIREMENTS=0
77

88
test: clean
9-
pip install -q -r requirements.txt
10-
pip install -q -r _requirements/test.txt
9+
pip install -q -e '.[test,extra]'
1110

1211
# use this to run tests
1312
python -m coverage run --source litmodels -m pytest src tests -v --flake8
1413
python -m coverage report
1514

1615
docs: clean
17-
pip install . --quiet -r _requirements/docs.txt
18-
python -m sphinx -b html -W --keep-going docs/source docs/build
16+
pip install --quiet -e '.[docs]'
17+
python -m sphinx -b html -W --keep-going docs/source docs/build/html
1918

2019
clean:
2120
# clean all temp runs

_requirements/_ci.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

_requirements/_docs.txt

Lines changed: 0 additions & 15 deletions
This file was deleted.

_requirements/extra.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

_requirements/test.txt

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)