Skip to content

Commit bf847ed

Browse files
authored
add CI job for local installations (#124)
1 parent 61e2000 commit bf847ed

File tree

4 files changed

+59
-1
lines changed

4 files changed

+59
-1
lines changed

.github/workflows/install.yml

+38
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,41 @@ jobs:
128128
actual = CPUBackend()
129129
130130
sys.exit(actual != expected)
131+
132+
local:
133+
strategy:
134+
matrix:
135+
local-project-stub:
136+
- pep517-setuptools
137+
fail-fast: false
138+
139+
runs-on: ubuntu-latest
140+
141+
steps:
142+
- name: Checkout repository
143+
uses: actions/checkout@v3
144+
with:
145+
fetch-depth: 0
146+
147+
- name: Setup development environment
148+
uses: ./.github/actions/setup-dev-env
149+
150+
- name: Collect environment information
151+
run: python scripts/collect_env.py
152+
153+
- name: Install local project with PyTorch dependency
154+
run: ltt install --editable local-project-stubs/${{ matrix.local-project-stub }}
155+
156+
- name: Check if CPU only
157+
shell: python
158+
run: |
159+
import sys
160+
import torch
161+
162+
cuda = torch.version.cuda
163+
print(f"cuda = {cuda}")
164+
165+
hip = torch.version.hip
166+
print(f"hip = {hip}")
167+
168+
sys.exit(cuda or hip)

light_the_torch/_patch.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,12 @@ def get_extra_index_urls(computation_backends, channel):
252252
def patch_link_collection_with_supply_chain_attack_mitigation(
253253
computations_backends, channel
254254
):
255+
def is_pinned(requirement):
256+
if requirement.req is None:
257+
return False
258+
259+
return requirement.is_pinned
260+
255261
@contextlib.contextmanager
256262
def context(input):
257263
with patch_link_collection(
@@ -261,7 +267,7 @@ def context(input):
261267
requirement.name
262268
for requirement in input.root_reqs
263269
if requirement.user_supplied
264-
and not requirement.is_pinned
270+
and not is_pinned(requirement)
265271
and requirement.name in THIRD_PARTY_PACKAGES
266272
},
267273
):
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[build-system]
2+
requires = [
3+
"setuptools>=42",
4+
"setuptools_scm[toml]>=3.4",
5+
"wheel",
6+
]
7+
build-backend = "setuptools.build_meta"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[metadata]
2+
name = light-the-torch-test-package
3+
version = 1.2.3
4+
5+
[options]
6+
install_requires =
7+
torch

0 commit comments

Comments
 (0)