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

Pkg3: running a package #20

Open
mauro3 opened this issue Dec 7, 2016 · 5 comments
Open

Pkg3: running a package #20

mauro3 opened this issue Dec 7, 2016 · 5 comments
Labels

Comments

@mauro3
Copy link

mauro3 commented Dec 7, 2016

Over in discourse it was discussed to distinguish between "runnable packages" (called projects in that thread) and "library packages" (called packages). The suggestion which gathered the most likes was not to distinguish between projects and packages, but instead to "standardize where to put runnable scripts into packages as we know them now. Say a folder run/ or scripts/ and the main program would be run/main.jl. Pure "Projects" would have an empty src/ folder and full run/ folder and vice versa (most would have a bit of both). Similar to Pkg.test("SomePkg") we could have a Pkg.run("SomePkg") to run run/main.jl." Also a command-line option could be good, say julia --run SomePkg.

(I haven't followed this Julep too closely, please close this issue if this is in it already. Or let me know if this should be posted over in Julia itself.)

@Tetralux
Copy link

Tetralux commented Dec 9, 2016

I'll note that Rust does this by having a src/bin folder under which every file is a runnable artifact which can be run with cargo run --bin <name-of-file-without-ext>.
Not sure what you'd do with runnables that consist of multiple files though.

@tkelman tkelman added the Pkg3 label Dec 12, 2016
@andyferris
Copy link
Member

andyferris commented Dec 21, 2016

I like the idea of having a /src directory with shared code and a /run directory with code used at runtime (to run a script, launch an app, or whatever).

However I think we need to allow multiple entry points in the run directory, so Pkg.run("SomePkg") doesn't seem quite correct.

Also, if I could register with the package manager certain files in the /run directory, say /run/tool.jl, then it could create a shell script or shortcut in ~/bin or somewhere so that at the command line I can just type tool args... to launch my awesome Julia command line tool, that would be awesome!

(even the package manager could have some command line tools, like julia-pkg similar to pip, so that non-programmers could install julia, type julia-pkg add SomeAwesomeProgram and be able to use said program immediately from the command line).

EDIT: I just realized that Pkg.build() could do the step of installation. Perhaps there could also be a Pkg.install() command which runs an installation script (perhaps even performing Pkg.add() and Pkg.build() if necessary).

@ChrisRackauckas
Copy link
Member

However I think we need to allow multiple entry points in the run directory, so Pkg.run("SomePkg") doesn't seem quite correct.

What about a way to set keyword args? Pkg.run("SomePkg",save_plots=false)? Then command line:

julia-pkg run SomePkg save_plots=false save_jld=true

@andyferris
Copy link
Member

I was thinking Pkg.run("SomePkg", "Tool1", args...) and Pkg.run("SomePkg", "Tool2", args..) since there might be multiple, disjoint "programs" per package.

A package might want to specify a default "program" - I'm not sure.

@Tetralux
Copy link

@andyferris The way Rust handles that is when there is only one executable artefact, you need not specify the name of an artefact.

So, for a run folder that only contained some_program.jl, then Pkg.run("SomePkg" [, ...]) would do the same thing as Pkg.run("SomePkg", "some_program" [, ...]).

Plus, the name of the artefact can be more descriptive than simply main, or whatever.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants