Repository navigation
Restrict kernel push to python - #1232
Conversation
|
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. |
| * 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. |
There was a problem hiding this comment.
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"] |
There was a problem hiding this comment.
I also removed "julia" which isn't supported anymore too.
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.
1f03d7a to
dbf3393
Compare
stevemessick
left a comment
There was a problem hiding this comment.
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:
cla/googlecheck failure: The 3 commits includeCo-Authored-By: Claude <noreply@anthropic.com>, which causes the Google CLA bot to fail onnoreply@anthropic.com. Amending/squashing the commits without that trailer should turn the CLA check green.- Test fixture shadowing & coverage (
tests/unit/test_kernels_push*.py):- In
TestKernelsPush.setUp,_PushTestCase.setUp, andTestKernelsPushRetiredAccelerator.setUp, settingself.api.valid_push_language_types = ["python"]on the instance shadows the class attributeKaggleApi.valid_push_language_types(whichKaggleApi.__new__(KaggleApi)already inherits from the class). Dropping the instance override insetUpensures the tests exercise the realKaggleApi.valid_push_language_types. - In
test_kernels_push_invalid_language, also asserting that"r"and"rmarkdown"raiseValueError(alongside"invalid-lang") would directly cover the new restriction.
- In
- Optional nit (
kernels_initialize): With only one valid language,kaggle kernels initnow outputs"language": "Pick one of: {python}"inkernel-metadata.json. Fine to keep as-is for consistency withkernel_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.
|
@stevemessick Good suggestion. Addressed. Thank you |
Context
See b/576351177. We removed support for R: https://www.kaggle.com/discussions/product-announcements/751525
Summary
kernels pushnow only acceptspythonas the metadatalanguage.r,rmarkdownandjuliaare rejected, and thekernels inittemplate lists onlypython.julia).kernels_push, since nothing can reach it anymore.r,rmarkdownand.Rmdas push options fromdocs/.Not changed:
kernels list --language r/juliastill work. R notebooks are read-only, but they can still be listed.kernels pullstill maps R and Julia kernels to their file extensions, so existing kernels can still be downloaded.Test plan
pytest tests/unit: 1408 passedtest_kernels_push_notebook_rmarkdown, which tested the removed conversion.🤖 Generated with Claude Code
http://b/576351177