Skip to content

Commit a063e22

Browse files
test and lint
1 parent a49cb57 commit a063e22

25 files changed

Lines changed: 154 additions & 59 deletions

.github/workflows/ci.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
lint-and-test:
11+
name: Lint, type-check & test
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- uses: actions/setup-python@v5
18+
with:
19+
python-version: "3.11"
20+
21+
- name: Install dev dependencies
22+
run: pip install -e ".[dev]"
23+
24+
- name: ruff format (check)
25+
run: ruff format --check src/ tests/
26+
27+
- name: ruff lint
28+
run: ruff check src/ tests/
29+
30+
- name: mypy
31+
run: mypy src/phi/
32+
33+
- name: pytest
34+
run: pytest --tb=short

.pre-commit-config.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.8.6
4+
hooks:
5+
- id: ruff
6+
args: [--fix]
7+
types_or: [python, pyi]
8+
- id: ruff-format
9+
types_or: [python, pyi]
10+
11+
- repo: https://github.com/pre-commit/mirrors-mypy
12+
rev: v1.13.0
13+
hooks:
14+
- id: mypy
15+
args: [src/phi/]
16+
pass_filenames: false
17+
additional_dependencies: []
18+
stages: [pre-push]
19+
20+
- repo: local
21+
hooks:
22+
- id: pytest
23+
name: pytest
24+
entry: pytest --tb=short -q
25+
language: system
26+
pass_filenames: false
27+
stages: [pre-push]

biomodals/modal_af2rank.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ def print_score(k):
395395
timeout=int(TIMEOUT),
396396
secrets=[modal.Secret.from_name("cloudsql-credentials")],
397397
)
398-
def run_af2rank( # type: ignore[no-untyped-def]
398+
def run_af2rank(
399399
pdb_str: str,
400400
pdb_name: str | None = None,
401401
chains: str = "A",

biomodals/modal_alphafold.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ def main(
654654
fasta_str = open(input_fasta).read()
655655
models_int: list[int] = [int(m) for m in models.split(",")] if models else [1]
656656

657-
result = alphafold.remote( # type: ignore[call-arg]
657+
result = alphafold.remote(
658658
fasta_name=Path(input_fasta).name,
659659
fasta_str=fasta_str,
660660
models=models_int,

biomodals/modal_bindcraft.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
timeout=TIMEOUT * 60,
8484
secrets=[modal.Secret.from_name("cloudsql-credentials")],
8585
)
86-
def bindcraft( # type: ignore[no-untyped-def]
86+
def bindcraft(
8787
design_path,
8888
binder_name,
8989
pdb_str,

biomodals/modal_boltz.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
DEFAULT_PARAMS = "--use_msa_server --seed 42"
5656

5757

58-
def download_model():
58+
def download_model() -> None:
5959
"""Forces download of the Boltz-1 model by running it once.
6060
6161
Args:
@@ -303,7 +303,7 @@ def boltz(
303303
gcs_bucket=gcs_bucket,
304304
)
305305
return base.create_success_result(
306-
output_files=output_files, # type: ignore[arg-type]
306+
output_files=output_files,
307307
message=f"Boltz completed: {len(output_files)} files uploaded",
308308
stdout=result.stdout,
309309
num_output_files=len(output_files),
@@ -351,7 +351,7 @@ def boltz(
351351
"size_bytes": file_path.stat().st_size,
352352
"metadata": {},
353353
}
354-
output_files.append(file_dict) # type: ignore[arg-type]
354+
output_files.append(file_dict)
355355

356356
return {
357357
"exit_code": 0,
@@ -366,7 +366,7 @@ def boltz(
366366
# No GCS upload - return local files in dict format
367367
if use_base_class:
368368
return base.create_success_result(
369-
output_files=output_files_paths, # type: ignore[arg-type]
369+
output_files=output_files_paths,
370370
message=f"Boltz completed: {len(output_files_paths)} files generated",
371371
stdout=result.stdout,
372372
num_output_files=len(output_files_paths),
@@ -383,7 +383,7 @@ def boltz(
383383
"size_bytes": file_path.stat().st_size,
384384
"metadata": {},
385385
}
386-
output_files.append(file_info) # type: ignore[arg-type]
386+
output_files.append(file_info)
387387

388388
return {
389389
"exit_code": 0,

biomodals/modal_boltzgen.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
TIMEOUT = int(os.environ.get("TIMEOUT", 120))
4040

4141

42-
def download_boltzgen_models():
42+
def download_boltzgen_models() -> None:
4343
"""Download all boltzgen models during image build to avoid runtime timeouts."""
4444

4545
# Download all artifacts to default cache location (~/.cache)
@@ -746,7 +746,7 @@ def boltzgen_run(
746746

747747

748748
@app.local_entrypoint()
749-
def test_merge_only():
749+
def test_merge_only() -> None:
750750
"""Test merge step only using existing GCS data (for debugging).
751751
752752
IMPORTANT: Get the run_id from the output of test_boltzgen_parallel.py

biomodals/modal_chai1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
TIMEOUT = int(os.environ.get("TIMEOUT", 30))
3131

3232

33-
def download_models():
33+
def download_models() -> None:
3434
"""Downloads Chai-1 models by running a minimal inference.
3535
3636
Args:

biomodals/modal_esm2_predict_masked.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
TIMEOUT = int(os.environ.get("TIMEOUT", 15))
2424

2525

26-
def download_model():
26+
def download_model() -> None:
2727
import esm
2828

2929
_model, _alphabet = esm.pretrained.esm2_t33_650M_UR50D()

biomodals/modal_esmfold.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ def esmfold(
317317

318318
# Create a Python script that will run in the conda environment
319319
script_path = Path(tmpdir) / "run_esmfold.py"
320-
script_content = f'''
320+
script_content = f"""
321321
import json
322322
import os
323323
import sys
@@ -403,7 +403,7 @@ def esmfold(
403403
summary_path = output_dir / "results.json"
404404
summary_path.write_text(json.dumps(results, indent=2))
405405
print(f"Completed {{len(results)}} sequences")
406-
'''
406+
"""
407407

408408
script_path.write_text(script_content)
409409

0 commit comments

Comments
 (0)