Skip to content

Commit 91404bd

Browse files
authored
docs(programs): update programs api dev docs (#280)
and programs bootstrap file
1 parent 75c6909 commit 91404bd

2 files changed

Lines changed: 103 additions & 68 deletions

File tree

docs/md/dev/programs.md

Lines changed: 80 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -530,34 +530,86 @@ installed = list_installed()
530530
531531
### Source program integration
532532
533-
For program repositories to integrate:
534-
535-
1. **Generate registry metadata**:
536-
```bash
537-
# In program repository
538-
python -m modflow_devtools.make_program_registry \
539-
--version 6.6.3 \
540-
--platforms linux mac win64 \
541-
--output .registry/registry.toml
542-
```
543-
544-
2. **Publish registry**: Attach `registry.toml` as a release asset
545-
546-
3. **Example CI integration** (GitHub Actions):
547-
```yaml
548-
- name: Generate program registry
549-
run: |
550-
python -m modflow_devtools.make_program_registry \
551-
--version ${{ github.ref_name }} \
552-
--platforms linux mac win64 \
553-
--output registry.toml
554-
555-
- name: Upload registry to release
556-
uses: actions/upload-release-asset@v1
557-
with:
558-
asset_path: registry.toml
559-
asset_name: registry.toml
560-
```
533+
For program repositories to integrate, they can generate registry files in two ways:
534+
535+
#### Mode 1: Local Assets (CI/Build Pipeline)
536+
537+
Use this mode when you have local distribution files during CI builds:
538+
539+
```bash
540+
# Generate registry from local distribution files
541+
python -m modflow_devtools.programs.make_registry \
542+
--dists *.zip \
543+
--programs mf6 zbud6 libmf6 mf5to6 \
544+
--version 6.6.3 \
545+
--repo MODFLOW-ORG/modflow6 \
546+
--compute-hashes \
547+
--output programs.toml
548+
```
549+
550+
**How it works:**
551+
- Uses `--dists` to specify a glob pattern for local distribution files (e.g., `*.zip`)
552+
- Scans the local filesystem for matching files
553+
- Requires `--version` and `--repo` arguments
554+
- Optionally computes SHA256 hashes from local files with `--compute-hashes`
555+
- Creates asset entries from local file names
556+
- Auto-detects platform from file names (linux, mac, win64, etc.)
557+
558+
**Example CI integration** (GitHub Actions):
559+
```yaml
560+
- name: Generate program registry
561+
run: |
562+
python -m modflow_devtools.programs.make_registry \
563+
--dists *.zip \
564+
--programs mf6 zbud6 libmf6 mf5to6 \
565+
--version ${{ github.ref_name }} \
566+
--repo ${{ github.repository }} \
567+
--compute-hashes \
568+
--output programs.toml
569+
570+
- name: Upload registry to release
571+
uses: softprops/action-gh-release@v1
572+
with:
573+
files: programs.toml
574+
```
575+
576+
#### Mode 2: GitHub Release (Testing/Regeneration)
577+
578+
Use this mode to generate a registry from an existing GitHub release:
579+
580+
```bash
581+
# Generate registry from existing GitHub release
582+
python -m modflow_devtools.programs.make_registry \
583+
--repo MODFLOW-ORG/modflow6 \
584+
--version 6.6.3 \
585+
--programs mf6 zbud6 libmf6 mf5to6 \
586+
--output programs.toml
587+
```
588+
589+
**How it works:**
590+
- Fetches release assets from GitHub API using repo and version (tag)
591+
- Downloads assets if `--compute-hashes` is specified
592+
- Useful for testing or regenerating a registry for an existing release
593+
- No `--dists` argument needed - pulls from GitHub directly
594+
595+
**Additional options:**
596+
```bash
597+
# With custom executable paths (if not bin/{program})
598+
python -m modflow_devtools.programs.make_registry \
599+
--dists *.zip \
600+
--programs mf6:bin/mf6 zbud6:bin/zbud6 custom:path/to/exe \
601+
--version 6.6.3 \
602+
--repo MODFLOW-ORG/modflow6
603+
604+
# With description and license metadata
605+
python -m modflow_devtools.programs.make_registry \
606+
--dists *.zip \
607+
--programs mf6 \
608+
--version 6.6.3 \
609+
--repo MODFLOW-ORG/modflow6 \
610+
--description "MODFLOW 6 groundwater flow model" \
611+
--license "CC0-1.0"
612+
```
561613
562614
### Program addressing
563615
Lines changed: 23 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,46 @@
1-
# Programs API Bootstrap Configuration
2-
#
31
# This file tells modflow-devtools where to find program registries.
4-
# Programs are discovered from GitHub release assets.
2+
# Programs are discovered from GitHub release assets (programs.toml)
3+
# published alongside platform-specific distributions.
54
#
6-
# Each source provides one or more programs (e.g., modflow6 provides mf6, zbud6, libmf6).
7-
# Program names are globally unique across all sources.
5+
# Each source provides one or more programs (e.g., modflow6 provides
6+
# mf6, zbud6, libmf6) as specified in the source's registry file.
87

98
[sources.modflow6]
109
repo = "MODFLOW-USGS/modflow6"
1110
refs = ["6.7.0", "6.6.3"]
12-
# Provides: mf6, zbud6, mf5to6, libmf6
1311

1412
[sources.gridgen]
1513
repo = "MODFLOW-ORG/gridgen"
1614
refs = ["v1.0.02"]
17-
# Provides: gridgen
1815

1916
[sources.triangle]
2017
repo = "MODFLOW-ORG/triangle"
2118
refs = ["v1.6"]
22-
# Provides: triangle
23-
24-
[sources.mfusg]
25-
repo = "MODFLOW-ORG/mfusg"
26-
refs = ["v1.5.00"]
27-
# Provides: mfusg
28-
29-
[sources.mfusgt]
30-
repo = "MODFLOW-ORG/mfusgt"
31-
refs = ["v2.6.0"]
32-
# Provides: mfusg_gsi
33-
34-
[sources.modpath-v7]
35-
repo = "MODFLOW-ORG/modpath-v7"
36-
refs = ["7.2.001"]
37-
# Provides: mp7
38-
39-
[sources.mt3d-usgs]
40-
repo = "MODFLOW-ORG/mt3d-usgs"
41-
refs = ["v1.0.0"]
42-
# Provides: mt3dusgs
43-
44-
[sources.mt3dms]
45-
repo = "MODFLOW-ORG/mt3dms"
46-
refs = ["2.0"]
47-
# Provides: mt3dms
4819

4920
[sources.zonbud]
5021
repo = "MODFLOW-ORG/zonbud"
5122
refs = ["v3.01"]
52-
# Provides: zonbud
5323

5424
[sources.zonbudusg]
5525
repo = "MODFLOW-ORG/zonbudusg"
5626
refs = ["v1.01"]
57-
# Provides: zonbudusg
5827

59-
[sources.executables]
60-
repo = "MODFLOW-ORG/executables"
61-
refs = ["latest"]
62-
# Consolidated repo for legacy programs
63-
# Provides: mf2005, mf2000, mfnwt, etc.
28+
[sources.vs2dt]
29+
repo = "MODFLOW-ORG/vs2dt"
30+
refs = ["v3.3"]
31+
32+
[sources.mfnwt]
33+
repo = "MODFLOW-ORG/mfnwt"
34+
refs = ["v1.3.0"]
35+
36+
[sources.mflgr]
37+
repo = "MODFLOW-ORG/mflgr"
38+
refs = ["v2.0.0"]
39+
40+
[sources.mf2000]
41+
repo = "MODFLOW-ORG/mf2000"
42+
refs = ["v1.19.01"]
43+
44+
[sources.swtv4]
45+
repo = "MODFLOW-ORG/swtv4"
46+
refs = ["v4.00.05"]

0 commit comments

Comments
 (0)