-
-
Notifications
You must be signed in to change notification settings - Fork 276
App support in Pkg #3772
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
App support in Pkg #3772
Changes from 16 commits
dfa357c
289ab99
7f50912
e6a0c8d
4783717
d3a583a
0f18e31
f97e59f
5eb96eb
ca4994f
3f78234
abdae83
949d4c0
2d6d142
4ff2dae
040bacb
f787f5b
547374b
bbf4616
830ecdc
f341c20
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,60 @@ | ||||||
# [**?.** Apps](@id Apps) | ||||||
|
||||||
!!! note | ||||||
The app support in Pkg is currently considered experimental and some functionality and API may change. | ||||||
|
||||||
Some inconveniences that can be encountered are: | ||||||
- You need to manually make `~/.julia/bin` available on the PATH environment. | ||||||
- The path to the julia executable used is the same as the one used to install the app. If this | ||||||
julia installation gets removed, you might need to reinstall the app. | ||||||
used by the app might not be found. | ||||||
- You can only have one app installed | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One per package? |
||||||
|
||||||
Apps are Julia packages that are intended to be run as a "standalone programs" (by e.g. typing the name of the app in the terminal possibly together with some arguments or flags/options). | ||||||
This is in contrast to most Julia packages that are used as "libraries" and are loaded by other files or in the Julia REPL. | ||||||
|
||||||
## Creating a Julia app | ||||||
|
||||||
A Julia app is structured similar to a standard Julia library with the following additions: | ||||||
|
||||||
- A `@main` entry point in the package module (see the Julia help on `@main` for details) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this be |
||||||
- An `[app]` section in the `Project.toml` file listing the executable names that the package provides. | ||||||
|
||||||
A very simple example of an app that prints the reversed input arguments would be: | ||||||
|
||||||
```julia | ||||||
# src/MyReverseApp.jl | ||||||
module MyReverseApp | ||||||
|
||||||
function (@main)(ARGS) | ||||||
for arg in ARGS | ||||||
print(stdout, reverse(arg), " ") | ||||||
end | ||||||
return | ||||||
end | ||||||
|
||||||
end # module | ||||||
``` | ||||||
|
||||||
```toml | ||||||
# Project.toml | ||||||
|
||||||
# standard fields here | ||||||
|
||||||
[apps] | ||||||
reverse = {} | ||||||
``` | ||||||
The empty table `{}` is to allow for giving metadata about the app but it is currently unused. | ||||||
|
||||||
After installing this app one could run: | ||||||
|
||||||
``` | ||||||
$ reverse some input string | ||||||
emos tupni gnirts | ||||||
``` | ||||||
|
||||||
directly in the terminal. | ||||||
|
||||||
## Installing Julia apps | ||||||
|
||||||
The installation of Julia apps are similar to installing julia libraries but instead of using e.g. `Pkg.add` or `pkg> add` one uses `Pkg.Apps.add` or `pkg> app add` (`develop` is also available). | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Or " |
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.