Kaggle / Kaggle/kaggle-cli

R notebook push fails - script is treated as python.

Open
#283 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
7.5k
Forks
1.4k
Avg merge
3d 15h
Merged PRs (30d)
11

Description

I'm using the cli tool to push an r notebook to my kaggle account. The initial push fails with this error:

> 'File "", line 17
> , 'bib.refs_id' = "BIBREF0"
> ^
> SyntaxError: keyword can't be an expression'
>

The relevant source block is:
`
##A small but growing library of utilities for tidying the metadata, parallel processing
##to grow a citation table, summary of STM model build times & sizes, etc
source(
'/kaggle/usr/lib/cord_19_challenge_cord_19_utils/cord_19_challenge_cord_19_utils.R')

tibble(
cord_uid = "000ajevz"
,source = "Late‐onset Pneumocystis jirovecii pneumonia post–fludarabine, cyclophosphamide and rituximab: implications for prophylaxis"
, ref_id = "b0"
, title = "Toxicity of fludarabine and cyclophosphamide with or without rituximab as initial therapy for patients with previously untreated mantle cell lymphoma: results of a randomised phase II study"
, year = "2009"
, venue = "Leuk Lymphoma"
, volume = "50"
, issn = NA_character_
, pages = "211--216"
, other_ids = NA_character_
, 'bib.refs_id' = "BIBREF0"
, authors = "H E Eve;D Linch;W Qian;M Ross;J F Seymour;P Smith;L Stevens;Saj Rule"
)
`

The Language setting shows as R, if I manually set it to R the script then runs fine. It looks as though the notebook is assumed to be python on the initial push.

The process I've followed is:

1. Convert the .Rmd file to .ipynb using:
`jupytext cord-19-tidy-citations-1-20k-uids.Rmd --to notebook`
2. Convert the .ipynb file to .irnb format by concatenating the individual source blocks for each cell. The file is then identical to the .irnb obtained by 'pull'-ing the kernel.
3. Write the kernel-metadata.json as follows:
`{
"id": "thatsplumb/cord-19-tidy-citations-1-20k-uids",
"title": "CORD-19 Tidy Citations 1-20k-uids",
"code_file": "cord-19-tidy-citations-1-20k-uids.irnb",
"language": "r",
"kernel_type": "notebook",
"is_private": true,
"enable_gpu": false,
"enable_internet": true,
"keywords": [],
"dataset_sources": [],
"kernel_sources": [
"thatsplumb/cord-19-build-citations-table-1-10000",
"thatsplumb/cord-19-build-citations-table-10001-20000",
"thatsplumb/cord-19-challenge-cord-19-utils"
],
"competition_sources": []
}
`
4. Push the kernel.

I like the cli tool a lot, it would be great if I didn't have to reset the language to get the script to run after the push. I'm using multiple kernels to generate an aggregated citations table from the 70k + docs in the cord-19 dataset and ideally I'd like to set things up so I can re-build the table simply via a push over the cli tool.

Any idea what I'm doing wrong?

Thanks!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.