Skip to content

Commit 4e3e321

Browse files
committed
Implement Julia magic with juliacall instead of julia
Close #4
1 parent b913049 commit 4e3e321

File tree

3 files changed

+42
-11
lines changed

3 files changed

+42
-11
lines changed

README.md

+13-5
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,21 @@ Replace `USERNAME`, `REPO`, `BRANCH`, and `PATH_TO_NOTEBOOK.ipynb` with your spe
9797

9898
The extension includes pre-configured setup for:
9999

100-
- R (using rpy2)
101-
- Octave (using oct2py)
102-
- SQL (using jupysql with DuckDB)
103-
- SAS (requires licensed copy and a way to access it)
100+
- R (using [`{rpy2}`][rpy2magic])
101+
- Julia (using [`{juliacall}`][juliacallmagic])
102+
- Octave (using [`{oct2py}`][oct2pymagic])
103+
- SQL (using [`{jupysql}`][jupysqlmagic])
104+
- SAS (using [`{saspy}`][saspymagic] + licensed copy and a way to access it)
104105

105106
Additional languages are supported via magic commands without requiring specific setup cells.
106107

107108
## Acknowledgements
108109

109-
This extension is based on the [Using Google Colab with GitHub](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb#scrollTo=8QAWNjizy_3O) notebook.
110+
This extension is based on the [Using Google Colab with GitHub](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb#scrollTo=8QAWNjizy_3O) notebook.
111+
112+
113+
[rpy2magic]: https://rpy2.github.io/doc/v3.5.x/html/interactive.html#module-rpy2.ipython.rmagic
114+
[juliacallmagic]: https://juliapy.github.io/PythonCall.jl/stable/compat/#IPython
115+
[oct2pymagic]: https://nbviewer.org/github/blink1073/oct2py/blob/main/example/octavemagic_extension.ipynb?create=1
116+
[jupysqlmagic]: https://jupysql.ploomber.io/en/latest/api/magic-sql.html
117+
[saspymagic]: https://sassoftware.github.io/saspy/advanced-topics.html#jupyter-magics

_extensions/colab/language-magic.lua

+11-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,17 @@ local DEFAULT_SETUP_CELLS = {
5757
# Install and configure SAS integration
5858
!pip install saspy sas_kernel
5959
%load_ext sas_magic]]
60-
}
60+
},
61+
julia = {
62+
language = "python",
63+
code = [[
64+
# Install and configure Julia integration
65+
!pip install -qqq juliacall
66+
# Load Julia extension
67+
from juliacall import Main as jl
68+
# Load Julia magic
69+
%load_ext juliacall.ipython
70+
]]}
6171
}
6272

6373
-- Global variables to store configuration

docs/index.qmd

+18-5
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,26 @@ Replace `USERNAME`, `REPO`, `BRANCH`, and `PATH_TO_NOTEBOOK.ipynb` with your spe
104104

105105
The extension includes pre-configured setup for:
106106

107-
- R (using rpy2)
108-
- Octave (using oct2py)
109-
- SQL (using jupysql with DuckDB)
110-
- SAS (requires licensed copy and a way to access it)
107+
- R (using [`{rpy2}`][rpy2magic])
108+
- Julia (using [`{juliacall}`][juliacallmagic])
109+
- Octave (using [`{oct2py}`][oct2pymagic])
110+
- SQL (using [`{jupysql}`][jupysqlmagic])
111+
- SAS (using [`{saspy}`][saspymagic] + licensed copy and a way to access it)
111112

112113
Additional languages are supported via magic commands without requiring specific setup cells.
113114

115+
- Ruby
116+
- Perl
117+
- bash/sh
118+
119+
For additional languages, you can define custom magic commands and setup cells in the document's header.
120+
114121
## Acknowledgements
115122

116-
This extension is based on the [Using Google Colab with GitHub](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb#scrollTo=8QAWNjizy_3O) notebook.
123+
This extension is based on the [Using Google Colab with GitHub](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb#scrollTo=8QAWNjizy_3O) notebook.
124+
125+
[rpy2magic]: https://rpy2.github.io/doc/v3.5.x/html/interactive.html#module-rpy2.ipython.rmagic
126+
[juliacallmagic]: https://juliapy.github.io/PythonCall.jl/stable/compat/#IPython
127+
[oct2pymagic]: https://nbviewer.org/github/blink1073/oct2py/blob/main/example/octavemagic_extension.ipynb?create=1
128+
[jupysqlmagic]: https://jupysql.ploomber.io/en/latest/api/magic-sql.html
129+
[saspymagic]: https://sassoftware.github.io/saspy/advanced-topics.html#jupyter-magics

0 commit comments

Comments
 (0)