Skip to content

Commit c3b59be

Browse files
Add docs for the global config file, registry, manifest changes and publish (#102)
* Add docs for the global config file, registry and manifest changes * Add docs for fpm publish * Add to toctree * Add warning * Update pages/spec/publish.md Co-authored-by: Brad Richardson <[email protected]> --------- Co-authored-by: minhqdao <[email protected]> Co-authored-by: Brad Richardson <[email protected]>
1 parent a7d6046 commit c3b59be

File tree

3 files changed

+105
-0
lines changed

3 files changed

+105
-0
lines changed

pages/spec/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ The generated API documentation of the fpm internals can be found [here](https:/
1313
:::{toctree}
1414
manifest
1515
naming
16+
publish
1617
API documentation <https://fortran-lang.github.io/fpm>
1718
:::

pages/spec/manifest.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,49 @@ my-utils = { path = "utils" }
491491

492492
The local dependency path is given relative to the ``fpm.toml`` it is written to, and uses ``/`` as the path separator on all platforms.
493493

494+
## Global config file
495+
496+
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).
497+
498+
## Registry settings
499+
500+
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).
501+
502+
### Registry cache
503+
504+
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
505+
Windows. The location of the cache can be changed by setting the `cache_path` in the global config file:
506+
507+
```toml
508+
[registry]
509+
cache_path = "/path/to/cache"
510+
```
511+
512+
### Custom registry
513+
514+
If you want to use a custom registry, you can specify it in the global config file:
515+
516+
```toml
517+
[registry]
518+
url = "https://my-registry.com"
519+
```
520+
521+
Your registry must implement the same [API](https://registry-apis.vercel.app/apidocs/) as the official registry.
522+
523+
### Local registry
524+
525+
Use the following configuration if you want to set up a local registry:
526+
527+
```toml
528+
[registry]
529+
path = "/path/to/registry"
530+
```
531+
532+
fpm will search this directory for packages and will not download packages from the internet or fetch packages from the cache.
533+
534+
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`.
535+
536+
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.
494537

495538
### Dependencies from version control systems
496539

@@ -530,6 +573,28 @@ For more verbose layout use normal tables rather than inline tables to specify d
530573
git = "https://github.com/toml-f/toml-f"
531574
rev = "2f5eaba864ff630ba0c3791126a3f811b6e437f3"
532575
```
576+
### Dependencies from a registry
577+
578+
#### Namespace
579+
580+
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`).
581+
582+
```toml
583+
[dependencies]
584+
my-package.namespace = "my-namespace"
585+
```
586+
587+
This will prompt fpm to download the newest version of "my-package", which belongs to "my-namespace", from the registry.
588+
589+
#### Version
590+
591+
If you want to download a specific version of a package instead of the newest one available, you can specify the version (`v`) in the manifest.
592+
593+
```toml
594+
[dependencies]
595+
example-package.namespace = "example-namespace"
596+
example-package.v = "1.0.0"
597+
```
533598

534599
### Development dependencies
535600

pages/spec/publish.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Package upload
2+
3+
Packages can be uploaded to the [official registry](https://registry-frontend.vercel.app) using the `fpm publish` command. After a successful upload, users can search for the package and use it in their projects. But be aware that the upload is permanent. Once a package is uploaded, it cannot be deleted. If you want to make changes to a package, you will have to create a new version of the package and upload that.
4+
5+
**!!! Testing period – We are currently building and testing the registry. All uploaded packages will be deleted after the testing period (in June 2023) !!!**
6+
7+
## Prerequisites
8+
9+
### Register
10+
11+
Before you can upload a package, you need to have an account on the official registry. You can create an account by visiting the [registry website](https://registry-frontend.vercel.app).
12+
13+
### Namespace
14+
15+
A package must be uploaded to a given namespace. If you don't have a namespace yet, you need to create one on the website first.
16+
17+
### Token
18+
19+
You need to generate a token for the namespace. You can do this on the website as well. The token is used to authenticate the upload. Do not share the token with anyone else. The token also expires after a certain amount of time. If you need to upload a package again, you will need to generate a new token.
20+
21+
### Version
22+
23+
A package must specify a valid [semver](https://semver.org/) version in its manifest.
24+
25+
You can check the version of the package by running `fpm publish --show-package-version` before publishing.
26+
27+
### License
28+
29+
A package must specify a valid [SPDX](https://spdx.org/licenses/) license in its manifest.
30+
31+
### Upload rights
32+
33+
A package can only be uploaded by package admins and maintainers. Package admins can grant admin and maintainer rights to other users.
34+
35+
## Uploading
36+
37+
fpm will create a tarball and upload the package to the registry when all the requirements are met. You can see all the data being sent to the registry without uploading by running `fpm publish --show-form-data`.
38+
39+
To publish a package, run `fpm publish --token <token>` using the token you generated on the website.

0 commit comments

Comments
 (0)