Skip to content

Commit e9bf8cd

Browse files
committed
refactor: logically rearanges section of fpm docs
Fixes #126
1 parent b40e1ea commit e9bf8cd

File tree

9 files changed

+98
-172
lines changed

9 files changed

+98
-172
lines changed

pages/how-to/index.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,3 @@
55
:::{note}
66
This section contains practical guides and recipes for solving specific problems with fpm.
77
:::
8-
9-
:::{toctree}
10-
installation
11-
:::

pages/index.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,15 @@ Browse references
119119

120120
## {fa}`cubes` Registry
121121

122-
There are already many packages available for use with fpm, providing an easily accessible and rich ecosystem of general purpose and high-performance code.
123-
For a full list of packages checkout the [fpm registry](registry/index).
124-
New packages can be submitted to the registry [here](https://github.com/fortran-lang/fpm-registry).
122+
<!-- TODO: add short description -->
125123

124+
Read about the [fpm registry](registry/index) and how to use it.
125+
126+
::::{note}
127+
The online registry as part of fpm
128+
is currently under active development and the online documentation might not be
129+
up-to-date.
130+
::::
126131

127132
## {fa}`newspaper` News
128133

pages/registry/index.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
(registry)=
2+
3+
# Registry
4+
5+
<!-- TODO: replace URL -->
6+
7+
Registries are an alternative way for fpm to search and fetch dependencies.
8+
The default registry is the [official registry](https://registry-frontend.vercel.app/).
9+
You can also set up your own registry or use a local registry.
10+
11+
The following sections describe how to configure fpm to search for packages in a registry
12+
13+
:::{toctree}
14+
settings
15+
publish
16+
naming
17+
:::

pages/registry/index.rst

Lines changed: 0 additions & 98 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.

pages/registry/settings.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
(registry-settings)=
2+
# Settings
3+
4+
The registry settings can be used to customize the registry for all projects. If no registry is specified, the packages will be fetched via HTTP from the [official registry](https://registry-frontend.vercel.app/). The registry settings are specified in the
5+
[global configuration file](#global-configuration-file).
6+
7+
## Global configuration file
8+
9+
The global configuration file can be used to set default options across all fpm projects on the system. It is, by default, located at `~/.local/share/fpm/config.toml` on Unix-like machines and `%APPDATA%\local\fpm\config.toml` on Windows and must be parsable to a TOML structure. It can be used to configure [registry settings](#settings).
10+
11+
## Registry cache
12+
13+
The registry cache contains the source code of previously downloaded packages. It will first be searched for existing packages that satify the requirements of the requesting project before the package is downloaded. The default cache location is `~/.local/share/fpm/dependencies` on Unix-like machines and `%APPDATA%\local\fpm\dependencies` on
14+
Windows. The location of the cache can be changed by setting the `cache_path` in the global config file:
15+
16+
```toml
17+
[registry]
18+
cache_path = "/path/to/cache"
19+
```
20+
21+
## Custom registry
22+
23+
If you want to use a custom registry, you can specify it in the global config file:
24+
25+
```toml
26+
[registry]
27+
url = "https://my-registry.com"
28+
```
29+
30+
Your registry must implement the same [API](https://registry-apis.vercel.app/apidocs/) as the official registry.
31+
32+
## Local registry
33+
34+
Use the following configuration if you want to set up a local registry:
35+
36+
```toml
37+
[registry]
38+
path = "/path/to/registry"
39+
```
40+
41+
fpm will search this directory for packages and will not download packages from the internet or fetch packages from the cache.
42+
43+
The directory must be structured the way fpm expects it to be. A package must be located in a directory named after the namespace name, followed by the name of the package and the package version. For example, the package `my-package` with version `0.1.0`, which is part of `my-namespace`, must be located in the directory `<path_to_local_registry>/my-namespace/my-package/0.1.0` on Unix-like systems. The package directory must contain an `fpm.toml` file that has the package metadata. The manifest must therefore be located at `<path_to_local_registry>/my-namespace/my-package/0.1.0/fpm.toml`.
44+
45+
If a specific version is requested, fpm will look for that version in the local registry. If you do not specify a version, fpm will look for the version with the highest precedence.
46+
47+
For instructions on how to set up **project dependencies** in `fpm.toml` when using a registry see

pages/spec/index.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ The generated API documentation of the fpm internals can be found [here](https:/
1212

1313
:::{toctree}
1414
manifest
15-
naming
1615
metapackages
17-
publish
1816
API documentation <https://fortran-lang.github.io/fpm>
1917
:::

pages/spec/manifest.md

Lines changed: 26 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -480,71 +480,6 @@ Dependencies can be declared in the *dependencies* table in the manifest root or
480480
When declared in the manifest root the dependencies are exported with the project.
481481

482482

483-
### Local dependencies
484-
485-
To declare local dependencies use the *path* entry.
486-
487-
```toml
488-
[dependencies]
489-
my-utils = { path = "utils" }
490-
```
491-
492-
The local dependency path is given relative to the ``fpm.toml`` it is written to, and uses ``/`` as the path separator on all platforms.
493-
494-
### Dependency-specific macro setting
495-
496-
As of ``fpm>=0.9.1``, an array of dependency-specific macros can be passed to a single dependency from the manifest, in the same fashion as in the manifest's [preprocessor configuration](#preprocessor-configuration) table. Its `preprocess` table needs to be entered as part of the dependency entry. fpm will not check if the passed macros collide with the dependencie's own manifest, so, it is the user's responsibility to ensure that no collisions or unexpected behavior occur.
497-
For example, one can control the `REAL` precision that one library is to be used with:
498-
499-
```toml
500-
[dependencies]
501-
fftpack = { git="https://github.com/fortran-lang/fftpack.git", preprocess.cpp.macros = ["REAL32"] }
502-
```
503-
504-
## Global config file
505-
506-
The global configuration file can be used to set default options across all fpm projects on the system. It is, by default, located at `~/.local/share/fpm/config.toml` on Unix-like machines and `%APPDATA%\local\fpm\config.toml` on Windows and must be parsable to a TOML structure. It can be used to configure [registry settings](#registry-settings).
507-
508-
## Registry settings
509-
510-
The registry settings can be used to customize the registry for all projects. If no registry is specified, the packages will be fetched via HTTP from the [official registry](https://registry-frontend.vercel.app/). The registry settings are specified in the [global config file](#global-config-file).
511-
512-
### Registry cache
513-
514-
The registry cache contains the source code of previously downloaded packages. It will first be searched for existing packages that satify the requirements of the requesting project before the package is downloaded. The default cache location is `~/.local/share/fpm/dependencies` on Unix-like machines and `%APPDATA%\local\fpm\dependencies` on
515-
Windows. The location of the cache can be changed by setting the `cache_path` in the global config file:
516-
517-
```toml
518-
[registry]
519-
cache_path = "/path/to/cache"
520-
```
521-
522-
### Custom registry
523-
524-
If you want to use a custom registry, you can specify it in the global config file:
525-
526-
```toml
527-
[registry]
528-
url = "https://my-registry.com"
529-
```
530-
531-
Your registry must implement the same [API](https://registry-apis.vercel.app/apidocs/) as the official registry.
532-
533-
### Local registry
534-
535-
Use the following configuration if you want to set up a local registry:
536-
537-
```toml
538-
[registry]
539-
path = "/path/to/registry"
540-
```
541-
542-
fpm will search this directory for packages and will not download packages from the internet or fetch packages from the cache.
543-
544-
The directory must be structured the way fpm expects it to be. A package must be located in a directory named after the namespace name, followed by the name of the package and the package version. For example, the package `my-package` with version `0.1.0`, which is part of `my-namespace`, must be located in the directory `<path_to_local_registry>/my-namespace/my-package/0.1.0` on Unix-like systems. The package directory must contain an `fpm.toml` file that has the package metadata. The manifest must therefore be located at `<path_to_local_registry>/my-namespace/my-package/0.1.0/fpm.toml`.
545-
546-
If a specific [version](#version) is requested, fpm will look for that version in the local registry. If you do not specify a version, fpm will look for the version with the highest precedence.
547-
548483
### Dependencies from version control systems
549484

550485
Dependencies can be specified by the projects git repository.
@@ -585,6 +520,11 @@ rev = "2f5eaba864ff630ba0c3791126a3f811b6e437f3"
585520
```
586521
### Dependencies from a registry
587522

523+
:::{note}
524+
To enable the usage of a registry in fpm make sure you read the instructions
525+
in the [registry section](../registry/index.md) first.
526+
:::
527+
588528
#### Namespace
589529

590530
Packages obtained from a registry (both remote and local) are required to specify a namespace, which provides a way to uniquely identify and differentiate packages with identical names. The namespace is declared in the manifest (`fpm.toml`).
@@ -606,6 +546,27 @@ example-package.namespace = "example-namespace"
606546
example-package.v = "1.0.0"
607547
```
608548

549+
### Local dependencies
550+
551+
To declare local dependencies use the *path* entry.
552+
553+
```toml
554+
[dependencies]
555+
my-utils = { path = "utils" }
556+
```
557+
558+
The local dependency path is given relative to the ``fpm.toml`` it is written to, and uses ``/`` as the path separator on all platforms.
559+
560+
### Dependency-specific macro setting
561+
562+
As of ``fpm>=0.9.1``, an array of dependency-specific macros can be passed to a single dependency from the manifest, in the same fashion as in the manifest's [preprocessor configuration](#preprocessor-configuration) table. Its `preprocess` table needs to be entered as part of the dependency entry. fpm will not check if the passed macros collide with the dependencie's own manifest, so, it is the user's responsibility to ensure that no collisions or unexpected behavior occur.
563+
For example, one can control the `REAL` precision that one library is to be used with:
564+
565+
```toml
566+
[dependencies]
567+
fftpack = { git="https://github.com/fortran-lang/fftpack.git", preprocess.cpp.macros = ["REAL32"] }
568+
```
569+
609570
### Development dependencies
610571

611572
Development dependencies allow to declare *dev-dependencies* in the manifest root, which are available to all tests but not exported with the project.

0 commit comments

Comments
 (0)