Skip to content

Restrict kernel push to python - #1232

Merged
rosbo merged 4 commits into
mainfrom
remove-r-kernel-language
Oct 22, 2026
Merged

rosbo merged 4 commits into
mainfrom
remove-r-kernel-language

Conversation

@rosbo

@rosbo rosbo commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Context

See b/576351177. We removed support for R: https://www.kaggle.com/discussions/product-announcements/751525

Summary

  • kernels push now only accepts python as the metadata language. r, rmarkdown and julia are rejected, and the kernels init template lists only python.
  • Push test fixtures now use the real python-only language list (they had added julia).
  • Removed the rmarkdown→r notebook conversion in kernels_push, since nothing can reach it anymore.
  • Removed mentions of r, rmarkdown and .Rmd as push options from docs/.

Not changed:

  • kernels list --language r / julia still work. R notebooks are read-only, but they can still be listed.
  • kernels pull still maps R and Julia kernels to their file extensions, so existing kernels can still be downloaded.

Test plan

  • pytest tests/unit: 1408 passed
  • Removed test_kernels_push_notebook_rmarkdown, which tested the removed conversion.

🤖 Generated with Claude Code

http://b/576351177

@google-cla

google-cla Bot commented Oct 22, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@rosbo rosbo changed the title Remove R as a kernel language option Remove R as a kernel language option for push Oct 22, 2026
@rosbo rosbo changed the title Remove R as a kernel language option for push Restrict kernel push to python Oct 22, 2026
Comment thread docs/kernels_metadata.md
* If you wish to rename your kernel, you may change the title within the metadata. However, you will need to update the `id` as well AFTER the rename is complete.
* `code_file`: The path to your kernel source code. Required. If not an absolute path, it should be relative to the location of `kernel-metadata.json`.
* `language`: The language your kernel is written in. Valid options are `python`, `r`, and `rmarkdown`. Required.
* `language`: The language your kernel is written in. Valid options are `python`. Required.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to keep the language field in case we add a new language in the future.

def setUp(self):
self.api = KaggleApi.__new__(KaggleApi)
self.api.config_values = {"username": "testuser"}
self.api.valid_push_language_types = ["python", "r", "julia", "rmarkdown"]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also removed "julia" which isn't supported anymore too.

@rosbo
rosbo requested a review from stevemessick October 22, 2026 21:58
rosbo added 3 commits October 22, 2026 22:31
Drop `r` and `rmarkdown` from the languages accepted by `kernels push`
and from the `kernels list --language` filter, along with the
rmarkdown->r notebook conversion and the docs/help text that listed
them. `kernels pull` still maps R kernels to file extensions so
existing R kernels can still be downloaded.
R notebooks are read-only but can still be listed.
The real valid_push_language_types is python-only; make the test
fixtures match.
@rosbo
rosbo force-pushed the remove-r-kernel-language branch from 1f03d7a to dbf3393 Compare October 22, 2026 22:31

@stevemessick stevemessick left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks clean and well-scoped—keeping r and julia in valid_list_languages and kernels_pull while restricting kernels_push to python makes sense.

A few small notes:

  1. cla/google check failure: The 3 commits include Co-Authored-By: Claude <noreply@anthropic.com>, which causes the Google CLA bot to fail on noreply@anthropic.com. Amending/squashing the commits without that trailer should turn the CLA check green.
  2. Test fixture shadowing & coverage (tests/unit/test_kernels_push*.py):
    • In TestKernelsPush.setUp, _PushTestCase.setUp, and TestKernelsPushRetiredAccelerator.setUp, setting self.api.valid_push_language_types = ["python"] on the instance shadows the class attribute KaggleApi.valid_push_language_types (which KaggleApi.__new__(KaggleApi) already inherits from the class). Dropping the instance override in setUp ensures the tests exercise the real KaggleApi.valid_push_language_types.
    • In test_kernels_push_invalid_language, also asserting that "r" and "rmarkdown" raise ValueError (alongside "invalid-lang") would directly cover the new restriction.
  3. Optional nit (kernels_initialize): With only one valid language, kaggle kernels init now outputs "language": "Pick one of: {python}" in kernel-metadata.json. Fine to keep as-is for consistency with kernel_type, or we could default it to "python" directly.

… python

- Drop the valid_push_language_types instance override in push test
  fixtures so they exercise the real class attribute.
- Assert r, rmarkdown and julia are rejected by kernels push.
- kernels init now writes "language": "python" instead of a
  single-option "Pick one of" placeholder.
@rosbo

rosbo commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

@stevemessick Good suggestion. Addressed. Thank you

@rosbo
rosbo merged commit 87ea99e into main Oct 22, 2026
15 checks passed
@rosbo
rosbo deleted the remove-r-kernel-language branch October 22, 2026 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants