Skip to content

Commit

Permalink
✨ Add install_lamindb to install lamindb from github (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
Koncopd authored Jul 26, 2024
1 parent db1c914 commit 59b4244
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ repos:
language_version: python3
args:
- --max-line-length=88
- --ignore=E203,W503,BLK100
- --ignore=E203,W503,BLK100,TYP001
exclude: |
(?x)(
__init__.py
Expand Down
2 changes: 2 additions & 0 deletions laminci/__main__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import argparse
import importlib
import json
Expand Down
2 changes: 2 additions & 0 deletions laminci/_doc_changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
# SOFTWARE.


from __future__ import annotations

import logging
import re
import subprocess
Expand Down
54 changes: 53 additions & 1 deletion laminci/nox.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
import shlex
from pathlib import Path
from typing import Dict, Optional
from typing import Dict, Iterable, Literal, Optional, Union

import nox
from nox import Session
Expand Down Expand Up @@ -86,3 +86,55 @@ def build_docs(session: Session, strict: bool = False, strip_prefix: bool = Fals
if strip_prefix:
args.append("--strip-prefix")
session.run(*args)


def install_lamindb(
session: Session,
branch: Literal["release", "main"],
extras: Optional[Union[Iterable[str], str]] = None,
):
assert branch in {"release", "main"}

if extras is None:
extras_str = ""
elif isinstance(extras, str):
if extras == "":
extras_str = ""
else:
assert "[" not in extras and "]" not in extras
extras_str = f"[{extras}]"
else:
extras_str = f"[{','.join(extras)}]"

session.run(
"git",
"clone",
"-b",
branch,
"--depth",
"1",
"--recursive",
"--shallow-submodules",
"https://github.com/laminlabs/lamindb",
)
if branch == "main":
session.run(
"uv",
"pip",
"install",
"--system",
"--no-deps",
"./lamindb/sub/lamindb-setup",
"./lamindb/sub/lnschema-core",
"./lamindb/sub/lamin-cli",
"./lamindb/sub/lnschema-bionty",
"./lamindb/sub/bionty",
"./lamindb/sub/wetlab",
)
session.run(
"uv",
"pip",
"install",
"--system",
f"./lamindb{extras_str}",
)

0 comments on commit 59b4244

Please sign in to comment.