Skip to content

Commit 23d8559

Browse files
authored
Merge pull request #4280 from JuliaLang/backports-release-1.12
2 parents b5f9787 + b3375c5 commit 23d8559

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+877
-327
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Pkg v1.12 Release Notes
55
The functions `Pkg.status`, `Pkg.why`, `Pkg.instantiate`, `Pkg.precompile` (and their REPL variants) have been updated
66
to take a `workspace` option. Read more about this feature in the manual about the TOML-files.
77
- `status` now shows when different versions/sources of dependencies are loaded than that which is expected by the manifest ([#4109])
8+
- Enhanced fuzzy matching algorithm for package name suggestions.
89

910
Pkg v1.11 Release Notes
1011
=======================

docs/make.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ makedocs(
3535
"managing-packages.md",
3636
"environments.md",
3737
"creating-packages.md",
38+
"apps.md",
3839
"compatibility.md",
3940
"registries.md",
4041
"artifacts.md",

docs/src/api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [**12.** API Reference](@id API-Reference)
1+
# [**13.** API Reference](@id API-Reference)
22

33
This section describes the functional API for interacting with Pkg.jl.
44
It is recommended to use the functional API, rather than the Pkg REPL mode,

docs/src/apps.md

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [**?.** Apps](@id Apps)
1+
# [**6.** Apps](@id Apps)
22

33
!!! note
44
The app support in Pkg is currently considered experimental and some functionality and API may change.
@@ -7,17 +7,16 @@
77
- You need to manually make `~/.julia/bin` available on the PATH environment.
88
- The path to the julia executable used is the same as the one used to install the app. If this
99
julia installation gets removed, you might need to reinstall the app.
10-
- You can only have one app installed per package.
1110

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).
1312
This is in contrast to most Julia packages that are used as "libraries" and are loaded by other files or in the Julia REPL.
1413

1514
## Creating a Julia app
1615

1716
A Julia app is structured similar to a standard Julia library with the following additions:
1817

1918
- 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.
2120

2221
A very simple example of an app that prints the reversed input arguments would be:
2322

@@ -49,11 +48,53 @@ After installing this app one could run:
4948

5049
```
5150
$ reverse some input string
52-
emos tupni gnirts
51+
emos tupni gnirts
5352
```
5453

5554
directly in the terminal.
5655

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+
5798
## Installing Julia apps
5899

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).

docs/src/artifacts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [**8.** Artifacts](@id Artifacts)
1+
# [**9.** Artifacts](@id Artifacts)
22

33
`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.
44
These containers, (called "Artifacts") can be created locally, hosted anywhere, and automatically downloaded and unpacked upon installation of your Julia package.

docs/src/compatibility.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [**6.** Compatibility](@id Compatibility)
1+
# [**7.** Compatibility](@id Compatibility)
22

33
Compatibility refers to the ability to restrict the versions of the dependencies that your project is compatible with.
44
If the compatibility for a dependency is not given, the project is assumed to be compatible with all versions of that dependency.
@@ -164,7 +164,7 @@ PkgA = "0.2 - 0" # 0.2.0 - 0.*.* = [0.2.0, 1.0.0)
164164
```
165165

166166

167-
## Fixing conflicts
167+
## [Fixing conflicts](@id Fixing-conflicts)
168168

169169
Version conflicts were introduced previously with an [example](@ref conflicts)
170170
of a conflict arising in a package `D` used by two other packages, `B` and `C`.

docs/src/creating-packages.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
To generate the bare minimum files for a new package, use `pkg> generate`.
1212

1313
```julia-repl
14-
(@v1.8) pkg> generate HelloWorld
14+
(@v1.10) pkg> generate HelloWorld
1515
```
1616

1717
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
118118
package with the `export` keyword or marked as public with the `public` keyword. When you
119119
change the behavior of something that was previously public so that the new
120120
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](@ref Version-specifier-format).
122122
If you would like to include a symbol in your public API without exporting it into the
123123
global namespace of folks who call `using YourPackage`, you should mark that symbol as
124124
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
649649
* [`Preferences.jl`](https://github.com/JuliaPackaging/Preferences.jl) allows packages to read and write preferences to the top-level `Project.toml`.
650650
These preferences can be read at runtime or compile-time, to enable or disable different aspects of package behavior.
651651
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

docs/src/environments.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ It should be pointed out that when two projects use the same package at the same
1010
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:
1111

1212
```julia-repl
13-
(@v1.9) pkg> activate MyProject
13+
(@v1.10) pkg> activate MyProject
1414
Activating new environment at `~/MyProject/Project.toml`
1515
1616
(MyProject) pkg> st
@@ -28,7 +28,7 @@ false
2828
Installed Example ─ v0.5.3
2929
Updating `~/MyProject/Project.toml`
3030
[7876af07] + Example v0.5.3
31-
Updating `~~/MyProject/Manifest.toml`
31+
Updating `~/MyProject/Manifest.toml`
3232
[7876af07] + Example v0.5.3
3333
Precompiling environment...
3434
1 dependency successfully precompiled in 2 seconds
@@ -45,7 +45,7 @@ Example = "7876af07-990d-54b4-ab0e-23690620f79a"
4545
julia> print(read(joinpath("MyProject", "Manifest.toml"), String))
4646
# This file is machine-generated - editing it directly is not advised
4747
48-
julia_version = "1.9.4"
48+
julia_version = "1.10.0"
4949
manifest_format = "2.0"
5050
project_hash = "2ca1c6c58cb30e79e021fb54e5626c96d05d5fdc"
5151
@@ -66,7 +66,7 @@ shell> git clone https://github.com/JuliaLang/Example.jl.git
6666
Cloning into 'Example.jl'...
6767
...
6868
69-
(@v1.12) pkg> activate Example.jl
69+
(@v1.10) pkg> activate Example.jl
7070
Activating project at `~/Example.jl`
7171
7272
(Example) pkg> instantiate
@@ -82,7 +82,7 @@ If you only have a `Project.toml`, a `Manifest.toml` must be generated by "resol
8282

8383
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.
8484

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.
8686

8787
!!! note "Specifying project on startup"
8888
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
103103
between several incompatible packages.
104104

105105
```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
107107
Activating new environment at `/var/folders/34/km3mmt5930gc4pzq1d08jvjw0000gn/T/jl_a31egx/Project.toml`
108108
109109
(jl_a31egx) pkg> add Example
@@ -121,14 +121,14 @@ A "shared" environment is simply an environment that exists in `~/.julia/environ
121121
therefore a shared environment:
122122

123123
```julia-repl
124-
(@v1.9) pkg> st
124+
(@v1.10) pkg> st
125125
Status `~/.julia/environments/v1.9/Project.toml`
126126
```
127127

128128
Shared environments can be activated with the `--shared` flag to `activate`:
129129

130130
```julia-repl
131-
(@v1.9) pkg> activate --shared mysharedenv
131+
(@v1.10) pkg> activate --shared mysharedenv
132132
Activating project at `~/.julia/environments/mysharedenv`
133133
134134
(@mysharedenv) pkg>
@@ -151,7 +151,7 @@ or using Pkg's precompile option, which can precompile the entire environment, o
151151
which can be significantly faster than the code-load route above.
152152

153153
```julia-repl
154-
(@v1.9) pkg> precompile
154+
(@v1.10) pkg> precompile
155155
Precompiling environment...
156156
23 dependencies successfully precompiled in 36 seconds
157157
```
@@ -165,7 +165,7 @@ By default, any package that is added to a project or updated in a Pkg action wi
165165
with its dependencies.
166166

167167
```julia-repl
168-
(@v1.9) pkg> add Images
168+
(@v1.10) pkg> add Images
169169
Resolving package versions...
170170
Updating `~/.julia/environments/v1.9/Project.toml`
171171
[916415d5] + Images v0.25.2

docs/src/getting-started.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@ To get back to the Julia REPL, press `Ctrl+C` or backspace (when the REPL cursor
2222
Upon entering the Pkg REPL, you should see the following prompt:
2323

2424
```julia-repl
25-
(@v1.9) pkg>
25+
(@v1.10) pkg>
2626
```
2727

2828
To add a package, use `add`:
2929

3030
```julia-repl
31-
(@v1.9) pkg> add Example
31+
(@v1.10) pkg> add Example
3232
Resolving package versions...
3333
Installed Example ─ v0.5.3
34-
Updating `~/.julia/environments/v1.9/Project.toml`
34+
Updating `~/.julia/environments/v1.10/Project.toml`
3535
[7876af07] + Example v0.5.3
36-
Updating `~/.julia/environments/v1.9/Manifest.toml`
36+
Updating `~/.julia/environments/v1.10/Manifest.toml`
3737
[7876af07] + Example v0.5.3
3838
```
3939

@@ -49,14 +49,14 @@ julia> Example.hello("friend")
4949
We can also specify multiple packages at once to install:
5050

5151
```julia-repl
52-
(@v1.9) pkg> add JSON StaticArrays
52+
(@v1.10) pkg> add JSON StaticArrays
5353
```
5454

5555
The `status` command (or the shorter `st` command) can be used to see installed packages.
5656

5757
```julia-repl
58-
(@v1.9) pkg> st
59-
Status `~/.julia/environments/v1.6/Project.toml`
58+
(@v1.10) pkg> st
59+
Status `~/.julia/environments/v1.10/Project.toml`
6060
[7876af07] Example v0.5.3
6161
[682c06a0] JSON v0.21.3
6262
[90137ffa] StaticArrays v1.5.9
@@ -68,27 +68,27 @@ Status `~/.julia/environments/v1.6/Project.toml`
6868
To remove packages, use `rm` (or `remove`):
6969

7070
```julia-repl
71-
(@v1.9) pkg> rm JSON StaticArrays
71+
(@v1.10) pkg> rm JSON StaticArrays
7272
```
7373

7474
Use `up` (or `update`) to update the installed packages
7575

7676
```julia-repl
77-
(@v1.9) pkg> up
77+
(@v1.10) pkg> up
7878
```
7979

8080
If you have been following this guide it is likely that the packages installed are at the latest version
8181
so `up` will not do anything. Below we show the status output in the case where we deliberately have installed
8282
an old version of the Example package and then upgrade it:
8383

8484
```julia-repl
85-
(@v1.9) pkg> st
86-
Status `~/.julia/environments/v1.9/Project.toml`
85+
(@v1.10) pkg> st
86+
Status `~/.julia/environments/v1.10/Project.toml`
8787
⌃ [7876af07] Example v0.5.1
8888
Info Packages marked with ⌃ have new versions available and may be upgradable.
8989
90-
(@v1.9) pkg> up
91-
Updating `~/.julia/environments/v1.9/Project.toml`
90+
(@v1.10) pkg> up
91+
Updating `~/.julia/environments/v1.10/Project.toml`
9292
[7876af07] ↑ Example v0.5.1 ⇒ v0.5.3
9393
```
9494

@@ -110,7 +110,7 @@ Let's set up a new environment so we may experiment.
110110
To set the active environment, use `activate`:
111111

112112
```julia-repl
113-
(@v1.9) pkg> activate tutorial
113+
(@v1.10) pkg> activate tutorial
114114
[ Info: activating new environment at `~/tutorial/Project.toml`.
115115
```
116116

@@ -166,16 +166,16 @@ For more information about environments, see the [Working with Environments](@re
166166
If you are ever stuck, you can ask `Pkg` for help:
167167

168168
```julia-repl
169-
(@v1.9) pkg> ?
169+
(@v1.10) pkg> ?
170170
```
171171

172172
You should see a list of available commands along with short descriptions.
173173
You can ask for more detailed help by specifying a command:
174174

175175
```julia-repl
176-
(@v1.9) pkg> ?develop
176+
(@v1.10) pkg> ?develop
177177
```
178178

179179
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).

docs/src/glossary.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [**9.** Glossary](@id Glossary)
1+
# [**10.** Glossary](@id Glossary)
22

33
**Project:** a source tree with a standard layout, including a `src` directory
44
for the main body of Julia code, a `test` directory for testing the project,
@@ -46,7 +46,7 @@ since that could conflict with the configuration of the main application.
4646

4747
**Environment:** the combination of the top-level name map provided by a project
4848
file combined with the dependency graph and map from packages to their entry points
49-
provided by a manifest file. For more detail see the manual section on code loading.
49+
provided by a manifest file. For more detail see the [manual section on code loading](https://docs.julialang.org/en/v1/manual/code-loading/).
5050

5151
- **Explicit environment:** an environment in the form of an explicit project
5252
file and an optional corresponding manifest file together in a directory. If the

0 commit comments

Comments
 (0)