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

Coconut equivalent of ipykernel install #765

Closed
rtbs-dev opened this issue Jul 5, 2023 · 4 comments
Closed

Coconut equivalent of ipykernel install #765

rtbs-dev opened this issue Jul 5, 2023 · 4 comments

Comments

@rtbs-dev
Copy link

rtbs-dev commented Jul 5, 2023

Hi there! I've moved away from nb_conda_kernels due to... so many conflicting dependencies and CI/CD nightmares. But the pip install coconut[kernel] technique still works great for this workflow, which makes use of pyenv/virtualenv. Jupyter/lab can find the kernel just fine, provided a small kernel.json config file. I figured out how to add it in a way that duplicates those workflows.

Proposal

Request: add a coconut kernel install [--name] [--user] cli command

functionality: creates a ~/.local/share/jupyter/kernels/{myenv}-coconut/kernel.json spec file, with the contents:

{
 "argv": [
  "${PYENV_ROOT}/versions/{myenv}/bin/python",
  "-m",
  "coconut.icoconut",
  "-f",
  "{connection_file}"
 ],
 "display_name": "{myenv}-coconut",
 "language": "coconut"
}

Where the {PYENV_ROOT} and {myenv} variables get replaced with the pyenv root dir and currently-activate environment name, respectively.

For now I just copy+edit that file around to new kernel folders every time I make one that uses Coconut, but that would be easier if there was a coconut equivalent to the python -m ipykernel install --user --name {myenv} command that I run for python kernels that makes the kernel.json automatically.

Assumptions: The user wants a coconut kernel to have the same name as the python environment it's originating from, but with an added -coconut in the name. Seemed good enough?

@evhub
Copy link
Owner

evhub commented Jul 5, 2023

Theoretically, coconut --jupyter should do approximately this. Let me know if that works for you or if you are still having any issues.

@evhub evhub added the question label Jul 5, 2023
@evhub
Copy link
Owner

evhub commented Jul 5, 2023

I guess the one thing coconut --jupyter doesn't support currently is --user installation. Perhaps coconut --jupyter --user or coconut --jupyter install --user should be supported for that.

evhub added a commit that referenced this issue Jul 6, 2023
@evhub evhub added the resolved label Jul 6, 2023
@evhub evhub added this to the v3.0.3 milestone Jul 6, 2023
@evhub
Copy link
Owner

evhub commented Jul 6, 2023

In addition to the already-supported coconut --jupyter command, coconut --jupyter install and coconut --jupyter install --user should now be supported on coconut-develop>=3.0.2-post_dev14 (pip uninstall coconut and pip install -U coconut-develop).

@evhub evhub closed this as completed Jul 6, 2023
@rtbs-dev
Copy link
Author

rtbs-dev commented Jul 7, 2023

Oh phenomenal! I didn't realize the coconut --jupyter command was available if only coconut[kernel] was installed, or that it would automatically recognize the correct pyenv. But imo I really like the coconut --jupyter install syntax! Thanks again!

@evhub evhub mentioned this issue Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants