Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fix CI setup #125

Merged
merged 25 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 26 additions & 10 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ jobs:

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-tinytex@v2

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.config.python }}
Expand All @@ -62,6 +60,11 @@ jobs:
echo "LDFLAGS=-L$OPENBLAS/lib" >> $GITHUB_ENV
echo "CPPFLAGS=-I$OPENBLAS/include" >> $GITHUB_ENV

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- name: Install {tiledbsoma}
if: runner.os == 'Linux'
run: |
Expand All @@ -71,7 +74,11 @@ jobs:

- name: Install lamindb
run: |
pip install 'lamindb[aws]>=0.77.2' huggingface_hub
pip install 'lamindb[aws]>=0.77.2'

# Make sure IPython is installed --
# Workaround for laminlabs/laminhub-public#29
pip install ipython

- name: Log in to Lamin
run: |
Expand All @@ -81,12 +88,21 @@ jobs:
run: |
lamin connect laminlabs/lamindata

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check
- name: Check whether we can import lamindb and connect to the default instance
run: |
reticulate::py_config()
reticulate::import("lamindb")
shell: Rscript {0}

- name: Check
env:
_R_CHECK_CRAN_INCOMING_REMOTE_: false
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
shell: Rscript {0}

- uses: r-lib/actions/check-r-package@v2
- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check
28 changes: 24 additions & 4 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ jobs:

- uses: r-lib/actions/setup-pandoc@v2

- uses: actions/setup-python@v5
with:
python-version: "3.x"

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
Expand All @@ -41,15 +45,24 @@ jobs:
needs: website
quarto-version: pre-release

- name: Install {tiledbsoma}
- name: Install {tiledbsoma} if not already installed
run: |
options(repos = c("https://chanzuckerberg.r-universe.dev", getOption("repos")))
install.packages("tiledbsoma")
if (!requireNamespace("tiledbsoma", quietly = TRUE)) {
options(repos = c("https://chanzuckerberg.r-universe.dev", getOption("repos")))
install.packages("tiledbsoma")
} else {
message("Package 'tiledbsoma' already installed")
}
shell: Rscript {0}

- name: Install lamindb
run: |
pip install 'lamindb[aws]>=0.77.2' huggingface_hub
# install bionty and wetlab to avoid warnings about missing dependencies
pip install 'lamindb[aws,bionty,wetlab]>=0.77.2'

# Make sure IPython is installed --
# Workaround for laminlabs/laminhub-public#29
pip install ipython

- name: Log in to Lamin
run: |
Expand All @@ -59,6 +72,13 @@ jobs:
run: |
lamin connect laminlabs/lamindata

- name: Check whether we can import lamindb and connect to the default instance
run: |
reticulate::py_config()
reticulate::import("lamindb")
laminr::connect()
shell: Rscript {0}

- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}
Expand Down
1 change: 0 additions & 1 deletion R/Artifact.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ ArtifactRecord <- R6::R6Class( # nolint object_name_linter
#'
#' @return The path to the cached artifact
cache = function() {

py_lamin <- private$.instance$get_py_lamin()
if (!is.null(py_lamin)) {
if (isTRUE(private$.instance$is_default)) {
Expand Down
19 changes: 8 additions & 11 deletions R/Instance.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,20 @@ create_instance <- function(instance_settings, is_default = FALSE) {
active = active
)

py_lamin <- NULL
check_requires("Connecting to Python", "reticulate", alert = "warning")
py_lamin <- tryCatch(
reticulate::import("lamindb"),
error = function(err) {
cli::cli_warn(c(
paste(
"Failed to connect to the Python {.pkg lamindb} package,",
"some functionality may be limited."
),
"i" = "Run {.run reticulate::py_config()} and {.run reticulate::py_last_error()} for details"
))
NULL
}
)
if (isTRUE(is_default) && is.null(py_lamin)) {
cli::cli_warn(c(
paste(
"Default instance failed to connect to the Python {.pkg lamindb} package,",
"you will not be able to create records"
),
"i" = "See {.run reticulate::py_config()} for more information"
))
}

# create the instance
RichInstance$new(
Expand Down Expand Up @@ -107,7 +104,7 @@ create_instance <- function(instance_settings, is_default = FALSE) {
#' db <- connect("laminlabs/cellxgene")
#'
#' # fetch an artifact
#' artifact <- db$Artifact$get("KBW89Mf7IGcekja2hADu")
#' artifact <- db$Artifact$get("MkRm3eUKPwfnAyZMWD9v")
#'
#' # describe the artifact
#' artifact$describe()
Expand Down
2 changes: 1 addition & 1 deletion man/Instance.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions vignettes/architecture.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ For example, to get an artifact with a specific ID using **only** base classes,
```r
db <- connect("laminlabs/cellxgene")

artifact <- db$get_module("core")$get_registry("artifact")$get("KBW89Mf7IGcekja2hADu")
artifact <- db$get_module("core")$get_registry("artifact")$get("MkRm3eUKPwfnAyZMWD9v")

artifact$get_value("id")
```
Expand All @@ -240,7 +240,7 @@ With the sugar syntax classes, you can achieve the same result more concisely:
```r
db <- connect("laminlabs/cellxgene")

artifact <- db$Artifact$get("KBW89Mf7IGcekja2hADu")
artifact <- db$Artifact$get("MkRm3eUKPwfnAyZMWD9v")

artifact$id
```
Expand Down
4 changes: 2 additions & 2 deletions vignettes/concepts_features.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ db$Artifact$df(limit = 5)

## Working with records

You can fetch a specific record from a registry using its ID or UID. For instance, to get the artifact with UID [KBW89Mf7IGcekja2hADu](https://lamin.ai/laminlabs/cellxgene/artifact/KBW89Mf7IGcekja2hADu):
You can fetch a specific record from a registry using its ID or UID. For instance, to get the artifact with UID [MkRm3eUKPwfnAyZMWD9v](https://lamin.ai/laminlabs/cellxgene/artifact/MkRm3eUKPwfnAyZMWD9v):

```{r get_artifact}
artifact <- db$Artifact$get("KBW89Mf7IGcekja2hADu")
artifact <- db$Artifact$get("MkRm3eUKPwfnAyZMWD9v")
```

This artifact contains an `AnnData` object with myeloid cell data. You can view its metadata:
Expand Down
Loading