You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/apps.md
+47-6Lines changed: 47 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# [**?.** Apps](@id Apps)
1
+
# [**6.** Apps](@id Apps)
2
2
3
3
!!! note
4
4
The app support in Pkg is currently considered experimental and some functionality and API may change.
@@ -7,17 +7,16 @@
7
7
- You need to manually make `~/.julia/bin` available on the PATH environment.
8
8
- The path to the julia executable used is the same as the one used to install the app. If this
9
9
julia installation gets removed, you might need to reinstall the app.
10
-
- You can only have one app installed per package.
11
10
12
-
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).
11
+
Apps are Julia packages that are intended to be run as "standalone programs" (by e.g. typing the name of the app in the terminal possibly together with some arguments or flags/options).
13
12
This is in contrast to most Julia packages that are used as "libraries" and are loaded by other files or in the Julia REPL.
14
13
15
14
## Creating a Julia app
16
15
17
16
A Julia app is structured similar to a standard Julia library with the following additions:
18
17
19
18
- A `@main` entry point in the package module (see the [Julia help on `@main`](https://docs.julialang.org/en/v1/manual/command-line-interface/#The-Main.main-entry-point) for details)
20
-
- An `[app]` section in the `Project.toml` file listing the executable names that the package provides.
19
+
- An `[apps]` section in the `Project.toml` file listing the executable names that the package provides.
21
20
22
21
A very simple example of an app that prints the reversed input arguments would be:
23
22
@@ -49,11 +48,53 @@ After installing this app one could run:
49
48
50
49
```
51
50
$ reverse some input string
52
-
emos tupni gnirts
51
+
emos tupni gnirts
53
52
```
54
53
55
54
directly in the terminal.
56
55
56
+
## Multiple Apps per Package
57
+
58
+
A single package can define multiple apps by using submodules. Each app can have its own entry point in a different submodule of the package.
59
+
60
+
```julia
61
+
# src/MyMultiApp.jl
62
+
module MyMultiApp
63
+
64
+
function (@main)(ARGS)
65
+
println("Main app: ", join(ARGS, ""))
66
+
end
67
+
68
+
include("CLI.jl")
69
+
70
+
end# module
71
+
```
72
+
73
+
```julia
74
+
# src/CLI.jl
75
+
module CLI
76
+
77
+
function (@main)(ARGS)
78
+
println("CLI submodule: ", join(ARGS, ""))
79
+
end
80
+
81
+
end# module CLI
82
+
```
83
+
84
+
```toml
85
+
# Project.toml
86
+
87
+
# standard fields here
88
+
89
+
[apps]
90
+
main-app = {}
91
+
cli-app = { submodule = "CLI" }
92
+
```
93
+
94
+
This will create two executables:
95
+
-`main-app` that runs `julia -m MyMultiApp`
96
+
-`cli-app` that runs `julia -m MyMultiApp.CLI`
97
+
57
98
## Installing Julia apps
58
99
59
-
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).
100
+
The installation of Julia apps is similar to [installing Julia libraries](@ref Managing-Packages) but instead of using e.g. `Pkg.add` or `pkg> add` one uses `Pkg.Apps.add` or `pkg> app add` (`develop` is also available).
Copy file name to clipboardExpand all lines: docs/src/artifacts.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# [**8.** Artifacts](@id Artifacts)
1
+
# [**9.** Artifacts](@id Artifacts)
2
2
3
3
`Pkg` can install and manage containers of data that are not Julia packages. These containers can contain platform-specific binaries, datasets, text, or any other kind of data that would be convenient to place within an immutable, life-cycled datastore.
4
4
These containers, (called "Artifacts") can be created locally, hosted anywhere, and automatically downloaded and unpacked upon installation of your Julia package.
Copy file name to clipboardExpand all lines: docs/src/creating-packages.md
+9-2Lines changed: 9 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@
11
11
To generate the bare minimum files for a new package, use `pkg> generate`.
12
12
13
13
```julia-repl
14
-
(@v1.8) pkg> generate HelloWorld
14
+
(@v1.10) pkg> generate HelloWorld
15
15
```
16
16
17
17
This creates a new project `HelloWorld` in a subdirectory by the same name, with the following files (visualized with the external [`tree` command](https://linux.die.net/man/1/tree)):
@@ -118,7 +118,7 @@ describe about public symbols. A public symbol is a symbol that is exported from
118
118
package with the `export` keyword or marked as public with the `public` keyword. When you
119
119
change the behavior of something that was previously public so that the new
120
120
version no longer conforms to the specifications provided in the old version, you should
121
-
adjust your package version number according to [Julia's variant on SemVer](#Version-specifier-format).
121
+
adjust your package version number according to [Julia's variant on SemVer](@refVersion-specifier-format).
122
122
If you would like to include a symbol in your public API without exporting it into the
123
123
global namespace of folks who call `using YourPackage`, you should mark that symbol as
124
124
public with `public that_symbol`. Symbols marked as public with the `public` keyword are
@@ -649,3 +649,10 @@ To support the various use cases in the Julia package ecosystem, the Pkg develop
649
649
*[`Preferences.jl`](https://github.com/JuliaPackaging/Preferences.jl) allows packages to read and write preferences to the top-level `Project.toml`.
650
650
These preferences can be read at runtime or compile-time, to enable or disable different aspects of package behavior.
651
651
Packages previously would write out files to their own package directories to record options set by the user or environment, but this is highly discouraged now that `Preferences` is available.
652
+
653
+
## See Also
654
+
655
+
-[Managing Packages](@ref Managing-Packages) - Learn how to add, update, and manage package dependencies
656
+
-[Working with Environments](@ref Working-with-Environments) - Understand environments and reproducible development
657
+
-[Compatibility](@ref Compatibility) - Specify version constraints for dependencies
658
+
-[API Reference](@ref) - Functional API for non-interactive package management
Copy file name to clipboardExpand all lines: docs/src/environments.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ It should be pointed out that when two projects use the same package at the same
10
10
In order to create a new project, create a directory for it and then activate that directory to make it the "active project", which package operations manipulate:
11
11
12
12
```julia-repl
13
-
(@v1.9) pkg> activate MyProject
13
+
(@v1.10) pkg> activate MyProject
14
14
Activating new environment at `~/MyProject/Project.toml`
15
15
16
16
(MyProject) pkg> st
@@ -28,7 +28,7 @@ false
28
28
Installed Example ─ v0.5.3
29
29
Updating `~/MyProject/Project.toml`
30
30
[7876af07] + Example v0.5.3
31
-
Updating `~~/MyProject/Manifest.toml`
31
+
Updating `~/MyProject/Manifest.toml`
32
32
[7876af07] + Example v0.5.3
33
33
Precompiling environment...
34
34
1 dependency successfully precompiled in 2 seconds
@@ -45,7 +45,7 @@ Example = "7876af07-990d-54b4-ab0e-23690620f79a"
@@ -82,7 +82,7 @@ If you only have a `Project.toml`, a `Manifest.toml` must be generated by "resol
82
82
83
83
If you already have a resolved `Manifest.toml`, then you will still need to ensure that the packages are installed and with the correct versions. Again `instantiate` does this for you.
84
84
85
-
In short, `instantiate` is your friend to make sure an environment is ready to use. If there's nothing to do, `instantiate` does nothing.
85
+
In short, [`instantiate`](@ref Pkg.instantiate) is your friend to make sure an environment is ready to use. If there's nothing to do, `instantiate` does nothing.
86
86
87
87
!!! note "Specifying project on startup"
88
88
Instead of using `activate` from within Julia, you can specify the project on startup using
@@ -103,7 +103,7 @@ also want a scratch space to try out a new package, or a sandbox to resolve vers
103
103
between several incompatible packages.
104
104
105
105
```julia-repl
106
-
(@v1.9) pkg> activate --temp # requires Julia 1.5 or later
106
+
(@v1.10) pkg> activate --temp # requires Julia 1.5 or later
107
107
Activating new environment at `/var/folders/34/km3mmt5930gc4pzq1d08jvjw0000gn/T/jl_a31egx/Project.toml`
108
108
109
109
(jl_a31egx) pkg> add Example
@@ -121,14 +121,14 @@ A "shared" environment is simply an environment that exists in `~/.julia/environ
121
121
therefore a shared environment:
122
122
123
123
```julia-repl
124
-
(@v1.9) pkg> st
124
+
(@v1.10) pkg> st
125
125
Status `~/.julia/environments/v1.9/Project.toml`
126
126
```
127
127
128
128
Shared environments can be activated with the `--shared` flag to `activate`:
129
129
130
130
```julia-repl
131
-
(@v1.9) pkg> activate --shared mysharedenv
131
+
(@v1.10) pkg> activate --shared mysharedenv
132
132
Activating project at `~/.julia/environments/mysharedenv`
133
133
134
134
(@mysharedenv) pkg>
@@ -151,7 +151,7 @@ or using Pkg's precompile option, which can precompile the entire environment, o
151
151
which can be significantly faster than the code-load route above.
152
152
153
153
```julia-repl
154
-
(@v1.9) pkg> precompile
154
+
(@v1.10) pkg> precompile
155
155
Precompiling environment...
156
156
23 dependencies successfully precompiled in 36 seconds
157
157
```
@@ -165,7 +165,7 @@ By default, any package that is added to a project or updated in a Pkg action wi
@@ -110,7 +110,7 @@ Let's set up a new environment so we may experiment.
110
110
To set the active environment, use `activate`:
111
111
112
112
```julia-repl
113
-
(@v1.9) pkg> activate tutorial
113
+
(@v1.10) pkg> activate tutorial
114
114
[ Info: activating new environment at `~/tutorial/Project.toml`.
115
115
```
116
116
@@ -166,16 +166,16 @@ For more information about environments, see the [Working with Environments](@re
166
166
If you are ever stuck, you can ask `Pkg` for help:
167
167
168
168
```julia-repl
169
-
(@v1.9) pkg> ?
169
+
(@v1.10) pkg> ?
170
170
```
171
171
172
172
You should see a list of available commands along with short descriptions.
173
173
You can ask for more detailed help by specifying a command:
174
174
175
175
```julia-repl
176
-
(@v1.9) pkg> ?develop
176
+
(@v1.10) pkg> ?develop
177
177
```
178
178
179
179
This guide should help you get started with `Pkg`.
180
-
`Pkg` has much more to offer in terms of powerful package management,
181
-
read the full manual to learn more!
180
+
`Pkg` has much more to offer in terms of powerful package management.
181
+
For more advanced topics, see [Managing Packages](@ref Managing-Packages), [Working with Environments](@ref Working-with-Environments), and [Creating Packages](@ref creating-packages-tutorial).
0 commit comments