-
Notifications
You must be signed in to change notification settings - Fork 8
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
move R code into hera
#130
Draft
romainfrancois
wants to merge
57
commits into
main
Choose a base branch
from
uncouple_hera
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 51 commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
e24ca01
ignore R project
romainfrancois 187dd8d
:baby: :package:
romainfrancois 176225b
packages imports
romainfrancois f94f5cb
move utils to hera
romainfrancois 22e9e1f
placeholder for when loading hera
romainfrancois b568c2e
interpreter::configure_impl() should just be loading the hera package…
romainfrancois e91284b
.xeus_call -> hera:::hera_call
romainfrancois f57ce32
ignore .Rhistory
romainfrancois 993ea51
+ hera_dot_call()
romainfrancois f2bd5db
move comm code to hera using hera_dot_call
romainfrancois e351248
move completion code to hera
romainfrancois d76fe9f
move inspect code to hera
romainfrancois 5737a26
init_options() happens as part of loading the package
romainfrancois 6251a80
njo longer need these
romainfrancois 4554ed4
move log code to hera
romainfrancois 911a001
no longer need to be here
romainfrancois fff3ae4
comment
romainfrancois e74ebc5
moving cell_options() to here
romainfrancois 4ed6e86
the$frame_cell_execute
romainfrancois 26b37bf
more moving things around
romainfrancois bd1c548
oopsy
romainfrancois 55b0507
pkg stuff
romainfrancois 08684ca
empty NAMESPACE for now
romainfrancois 7661b4b
move the before other files
romainfrancois 6abcb83
ignore
romainfrancois 12cf499
using roxygen
romainfrancois a2624fd
rename to avoid check errors
romainfrancois 081e9a1
import pdf and png
romainfrancois ecb8c9b
more hera_dot_call
romainfrancois e700738
passing check
romainfrancois 13dac5b
no configure in hera
romainfrancois 9ca0655
workaround for now
romainfrancois 9826c5f
correctly set R_INCLUDE_DIR to R_HOME/include
romainfrancois e91248f
ignore default paths
romainfrancois 52df11e
addding R package dependencies of hera
romainfrancois b41efe9
+ dependencies of hera
romainfrancois c3b8671
locally install R package hera
romainfrancois bcaca39
Merge branch 'main' into uncouple_hera
romainfrancois a5448f9
skip some tests for now
romainfrancois bdb41fb
🫣
romainfrancois efbcca7
adding some documentatio to complete()
romainfrancois e98be91
bring back completion tests
romainfrancois f7ea1ae
export and document clear_output()
romainfrancois 9500f75
Fix and export is_xeusr()
romainfrancois 9129136
Fix and test is_xeusr()
romainfrancois 26cf448
bring back code_clear_output test
romainfrancois 7c746f3
abort hera_dot_call() when !xeusr
romainfrancois 0f47dbc
bring back code_display_data
romainfrancois 378d54c
mkdir temp_r_lib
romainfrancois b273bdc
ignore tgz
romainfrancois 022c8c9
install hera
romainfrancois 1e42249
making temp_r_lib on actions
romainfrancois d9999a9
here too
romainfrancois 96188a8
trying a different way
romainfrancois fb715cd
not needed
romainfrancois f534fd9
improve msg
romainfrancois 1877bc1
rm resources mounting
romainfrancois File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,3 +50,8 @@ bld | |
Untitled*.ipynb | ||
*.log | ||
/*.ipynb | ||
.Rproj.user | ||
.Rhistory | ||
hera.Rcheck | ||
hera_*.tar.gz | ||
hera_*.tgz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
^LICENSE\.md$ | ||
^.*\.Rproj$ | ||
^\.Rproj\.user$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Package: hera | ||
Title: Companion to the 'xeus-r' 'Jupyter' kernel for R | ||
Version: 0.0.0.9000 | ||
Authors@R: c( | ||
person("Romain", "François", email = "[email protected]", role = c("aut", "cre")) | ||
) | ||
Description: Set of R functions to be coupled with the xeus-r jupyter kernel for R. | ||
License: MIT + file LICENSE | ||
Encoding: UTF-8 | ||
Roxygen: list(markdown = TRUE) | ||
RoxygenNote: 7.3.2 | ||
Imports: | ||
cli, | ||
evaluate, | ||
glue, | ||
IRdisplay, | ||
jsonlite, | ||
R6, | ||
repr, | ||
rlang, | ||
tools, | ||
utils |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
YEAR: 2025 | ||
COPYRIGHT HOLDER: Quantstack |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# MIT License | ||
|
||
Copyright (c) 2025 Quantstack | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
export(View) | ||
export(clear_output) | ||
export(complete) | ||
export(display_data) | ||
export(is_xeusr) | ||
importFrom(R6,R6Class) | ||
importFrom(grDevices,pdf) | ||
importFrom(grDevices,png) | ||
importFrom(jsonlite,fromJSON) | ||
importFrom(jsonlite,toJSON) | ||
importFrom(jsonlite,unbox) | ||
importFrom(rlang,caller_env) | ||
importFrom(utils,capture.output) | ||
importFrom(utils,head) | ||
importFrom(utils,tail) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
NAMESPACE <- environment() | ||
the <- NULL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
cell_options <- function(...) { | ||
rlang::local_options(..., .frame = the$frame_cell_execute) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
triple_colon <- function(pkg, fun) { | ||
eval(rlang::call2(":::", as.symbol(pkg), as.symbol(fun))) | ||
} | ||
|
||
utils___assignLineBuffer <- triple_colon("utils", ".assignLinebuffer") | ||
utils___assignEnd <- triple_colon("utils", ".assignEnd") | ||
utils___guessTokenFromLine <- triple_colon("utils", ".guessTokenFromLine") | ||
utils___completeToken <- triple_colon("utils", ".completeToken") | ||
utils___retrieveCompletions <- triple_colon("utils", ".retrieveCompletions") | ||
|
||
#' Code completion | ||
#' | ||
#' @param code R code to complete | ||
#' @param cursor_pos position of the cursor | ||
#' | ||
#' @return a list that contains potential completions as the first item | ||
#' | ||
#' @export | ||
complete <- function(code, cursor_pos = nchar(code)) { | ||
# Find which line we're on and position within that line | ||
lines <- strsplit(code, '\n', fixed = TRUE)[[1]] | ||
chars_before_line <- 0L | ||
for (line in lines) { | ||
new_cursor_pos <- cursor_pos - nchar(line) - 1L # -1 for the newline | ||
if (new_cursor_pos < 0L) { | ||
break | ||
} | ||
cursor_pos <- new_cursor_pos | ||
chars_before_line <- chars_before_line + nchar(line) + 1L | ||
} | ||
|
||
# guard from errors when completion is invoked in empty cells | ||
if (is.null(line)) { | ||
line <- '' | ||
} | ||
|
||
utils___assignLineBuffer(line) | ||
utils___assignEnd(cursor_pos) | ||
|
||
info <- utils___guessTokenFromLine(update = FALSE) | ||
utils___guessTokenFromLine() | ||
utils___completeToken() | ||
|
||
start_position <- chars_before_line + info$start | ||
comps <- utils___retrieveCompletions() | ||
|
||
list( | ||
comps, | ||
c(start_position, start_position + nchar(info$token)) | ||
) | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After these, we get 3 things:
${R_HOME}/library
temp_r_lib/hera
directory:--build
option, we get thehera_****.tgz
file as well, if that makes it easier for EMSCRIPTING it, whatever that means :pThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For EMSCRIPTING, having
hera
installed in${R_HOME}/library
should be enoughThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @IsabelParedes I'll simplify then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So now we have two things:
.tgz
but if we don't need it, we can remove the--build
option if it's not needed.{R_HOME}/library
, i.e.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a look at the failures in the
Build and Deploy
workflow, but I think I'm now stuck on how to move this forward. cc @SylvainCorlay @IsabelParedes happy to jump on a call.