-
Notifications
You must be signed in to change notification settings - Fork 54
Add grabbing mechanism #265
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
Conversation
|
It's working : # @Grab(group="org.springframework", module="spring-orm", version="3.2.5.RELEASE")
from org.springframework.jdbc.core import JdbcTemplate
print(JdbcTemplate) |
|
This is great! One thing I'd like to discuss, since you needed to implement this feature yourself anyway: can we enrich it to show better progress relating to what's happening? The Beaker-based Grape support would simply hang until all dependency resolution was complete. And if something went wrong, there was little/no indication of what. There is as particular problematic artifact in the ImageJ2 dependency hierarchy— |
|
I am reusing the The hard work is done by I first tried to fork the class and convert it to Java but there it too much Groovy-specific codes so I had to give up. I also add to extend the class because of a For now, I am using Now, I can definitely consider doing that in the future but for now, I'd like to let it like that in order to release a first version of the kernel as fast as possible. Unless you see another easier solution of course. |
|
Interesting; there is a
Might it be doable to monitor (poll) the |
|
I just did a quick test and an error if returned and displayed to the user if something went wrong (for example bad group or artifact id). |
|
What do you mean monitoring instance fields? I don' understand how to do that. |
|
Well, # @Grab(group="org.springframework", module="spring-orm", version="3.2.5.RELEASE")
from org.springframework.jdbc.core import JdbcTemplate |
|
(it's not real time but at least we have some feedback on what's happening) |
|
I think I am done here. You can review and/org merge when you want. |
|
(Also I just checked and the mechanism works well with the Fiji script editor) |
|
I'm trying to decide how best to introduce this feature. I do not want to add another dependency to SciJava Common, so we may need a new component. I'll consider more over the weekend. |
|
We could consider copy the required code from the Groovy repo but one of the class is coded in Groovy. |
|
I have some questions about this grabbing feature. It seems to me that a different syntax here would be superior to Groovy's So, with that in mind, why don't we instead support something like this: #!groovy
#@repository("https://maven.imagej.net/content/groups/public")
#@dependency("net.imagej:imagej:2.0.0-rc-60")
import net.imagej.ImageJ
ij = new ImageJ()
ij.log().info("Hello world")This syntax would then be independent of all languages, and simply be another "preprocessing" or preparation step prior to script execution. I can implement some kind of general purpose script preprocessor which handles these preprocessing directives, and then we can create a new component Does this sound like a sane plan? I do not feel strongly about the exact syntax; for example, if someone has a better suggestion than |
|
I am good with that. And re-using the shebang character |
|
Awesome. I will work on this. I can also finally add a |
|
Sounds great! #!groovy
#@dependency("org.codehaus.groovy:groovy")
// @LogService log
@Grab('commons-lang:commons-lang:2.4')
// ... do whatever with log and commons-langAlthough the Oh, and syntax highlighting is another issue ;-) |
|
@imagejan wrote:
That is why I like it: it is unlikely to collide with syntax from any of the script languages themselves. My plan is to replace all I will keep support for the old comment-based syntax, for backwards compatibility. But this new syntax will work throughout the script. There will be a "catch-all" preprocessor for Do you see any problems with this scheme?
We'll be permissive in what we accept—e.g., case will not matter—but the documentation will use small case by convention, I think. |
|
Good for me. |
This will be useful for implementing script processing directives in an extensible way. Here is one example, for dependency declaration: #@repository('https://maven.imagej.net/content/groups/public') #@dependency('net.imagej:imagej:2.0.0-rc-60') And here is another, for defining the intended script language: #!clojure We will also migrate the script parameter syntax to this scheme: #@input String name #@input int age #@output String greeting Or with the familiar sloppy shorthand: #@string name #@int age #@output String greeting See #265 See scijava/scijava-jupyter-kernel#51 (comment)
This will be useful for implementing script processing directives in an extensible way. Here is one example, for dependency declaration: #@repository('https://maven.imagej.net/content/groups/public') #@dependency('net.imagej:imagej:2.0.0-rc-60') And here is another, for defining the intended script language: #!clojure We will also migrate the script parameter syntax to this scheme: #@input String name #@input int age #@output String greeting Or with the familiar sloppy shorthand: #@string name #@int age #@output String greeting See #265 See scijava/scijava-jupyter-kernel#51 (comment)
See scijava/scijava-common#265. Signed-off-by: Curtis Rueden <ctrueden@wisc.edu>
This will be useful for implementing script processing directives in an extensible way. Here is one example, for dependency declaration: #@repository('https://maven.imagej.net/content/groups/public') #@dependency('net.imagej:imagej:2.0.0-rc-60') And here is another, for defining the intended script language: #!clojure We will also migrate the script parameter syntax to this scheme: #@input String name #@input int age #@output String greeting Or with the familiar sloppy shorthand: #@string name #@int age #@output String greeting See #265 See scijava/scijava-jupyter-kernel#51 (comment)
|
This PR has been used as the basis for a new repository scijava/scijava-grab. Closing this PR in favor of that repository. |
Uh oh!
There was an error while loading. Please reload this page.