Skip to content

Commit 5f53d4e

Browse files
sujen1412claudegrallewellyn
authored
Add comprehensive Sphinx-compatible documentation (#117)
* Add comprehensive Sphinx-compatible documentation - Add NumPy-style docstrings to all main modules: - maap.py: Core MAAP client class with all methods documented - Result.py: Result, Granule, and Collection classes - dps_job.py: DPSJob class for job management - Profile.py: User profile management - AWS.py: AWS credential management - Secrets.py: User secrets management - config_reader.py: Configuration management - Create Sphinx documentation structure: - docs/conf.py: Sphinx configuration with Napoleon for NumPy docstrings - docs/index.rst: Main documentation index - docs/api/*.rst: API reference pages for all modules - Update package __init__.py with module-level documentation Documentation follows NumPy docstring format compatible with Sphinx autodoc and napoleon extensions for API documentation generation. * Fix algorithm registration docs to use correct inputs structure Update registerAlgorithm and register_algorithm_from_yaml_file docstrings to use the correct 'inputs' structure with 'file', 'config', and 'positional' arrays instead of the deprecated 'algorithm_params' format. Addresses PR review comments from grallewellyn. * Add GitHub Actions workflow and convert docs to Markdown - Add .github/workflows/docs.yml for automated doc building and deployment to GitHub Pages - Convert all .rst documentation files to Markdown format - Add MyST parser to Sphinx configuration for Markdown support - Add docs/requirements.txt with sphinx, sphinx-rtd-theme, myst-parser - Add docs/Makefile for local doc builds Addresses PR feedback from wildintellect requesting GitHub Actions workflow and Markdown format instead of reStructuredText. * algorithm_params to inputs in last spot --------- Co-authored-by: Claude <[email protected]> Co-authored-by: grallewellyn <[email protected]>
1 parent a5df75b commit 5f53d4e

File tree

19 files changed

+3249
-120
lines changed

19 files changed

+3249
-120
lines changed

.github/workflows/docs.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Build Documentation
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
pages: write
13+
id-token: write
14+
15+
concurrency:
16+
group: "pages"
17+
cancel-in-progress: false
18+
19+
jobs:
20+
build:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Set up Python
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: '3.11'
29+
30+
- name: Install dependencies
31+
run: |
32+
python -m pip install --upgrade pip
33+
pip install -r docs/requirements.txt
34+
pip install -e .
35+
36+
- name: Build documentation
37+
run: |
38+
cd docs
39+
make html
40+
41+
- name: Upload artifact
42+
uses: actions/upload-pages-artifact@v3
43+
with:
44+
path: docs/_build/html
45+
46+
deploy:
47+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
48+
needs: build
49+
runs-on: ubuntu-latest
50+
environment:
51+
name: github-pages
52+
url: ${{ steps.deployment.outputs.page_url }}
53+
steps:
54+
- name: Deploy to GitHub Pages
55+
id: deployment
56+
uses: actions/deploy-pages@v4

docs/Makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Minimal makefile for Sphinx documentation
2+
3+
# You can set these variables from the command line.
4+
SPHINXOPTS ?=
5+
SPHINXBUILD ?= sphinx-build
6+
SOURCEDIR = .
7+
BUILDDIR = _build
8+
9+
# Put it first so that "make" without argument is like "make help".
10+
help:
11+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
12+
13+
.PHONY: help Makefile
14+
15+
# Catch-all target: route all unknown targets to Sphinx using the new
16+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
17+
%: Makefile
18+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/api/aws.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# AWS Credentials
2+
3+
```{eval-rst}
4+
.. automodule:: maap.AWS
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:
8+
9+
.. autoclass:: maap.AWS.AWS
10+
:members:
11+
:special-members: __init__
12+
```
13+
14+
## Example Usage
15+
16+
```python
17+
from maap.maap import MAAP
18+
19+
maap = MAAP()
20+
21+
# Get requester-pays credentials
22+
creds = maap.aws.requester_pays_credentials()
23+
print(f"Access Key: {creds['accessKeyId']}")
24+
25+
# Generate a signed URL
26+
signed = maap.aws.s3_signed_url('bucket', 'path/to/file.h5')
27+
print(f"Signed URL: {signed['url']}")
28+
29+
# Get Earthdata DAAC credentials
30+
daac_creds = maap.aws.earthdata_s3_credentials(
31+
'https://data.lpdaac.earthdatacloud.nasa.gov/s3credentials'
32+
)
33+
34+
# Get workspace bucket credentials
35+
workspace_creds = maap.aws.workspace_bucket_credentials()
36+
```

docs/api/config.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Configuration
2+
3+
```{eval-rst}
4+
.. automodule:: maap.config_reader
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:
8+
9+
.. autoclass:: maap.config_reader.MaapConfig
10+
:members:
11+
:special-members: __init__
12+
```
13+
14+
## Environment Variables
15+
16+
The following environment variables can be used to configure the MAAP client:
17+
18+
| Variable | Description |
19+
|----------|-------------|
20+
| `MAAP_API_HOST` | Override the default MAAP API hostname |
21+
| `MAAP_API_HOST_SCHEME` | URL scheme (http/https) for API connections |
22+
| `MAAP_CMR_PAGE_SIZE` | Number of results per page for CMR queries |
23+
| `MAAP_CMR_CONTENT_TYPE` | Content type for CMR requests |
24+
| `MAAP_PGT` | Proxy granting ticket for authentication |
25+
| `MAAP_AWS_ACCESS_KEY_ID` | AWS access key for S3 operations |
26+
| `MAAP_AWS_SECRET_ACCESS_KEY` | AWS secret key for S3 operations |
27+
| `MAAP_S3_USER_UPLOAD_BUCKET` | S3 bucket for user file uploads |
28+
| `MAAP_S3_USER_UPLOAD_DIR` | S3 directory for user file uploads |
29+
| `MAAP_MAPBOX_ACCESS_TOKEN` | Mapbox token for visualization |
30+
31+
## Example Usage
32+
33+
```python
34+
from maap.maap import MAAP
35+
36+
maap = MAAP()
37+
38+
# Access configuration
39+
print(f"API Root: {maap.config.maap_api_root}")
40+
print(f"Page Size: {maap.config.page_size}")
41+
print(f"Granule Search URL: {maap.config.search_granule_url}")
42+
```

docs/api/dps.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# DPS (Data Processing System)
2+
3+
The DPS module provides classes for submitting and managing processing jobs.
4+
5+
## DPSJob
6+
7+
```{eval-rst}
8+
.. automodule:: maap.dps.dps_job
9+
:members:
10+
:undoc-members:
11+
:show-inheritance:
12+
13+
.. autoclass:: maap.dps.dps_job.DPSJob
14+
:members:
15+
:special-members: __init__
16+
```
17+
18+
## DpsHelper
19+
20+
```{eval-rst}
21+
.. automodule:: maap.dps.DpsHelper
22+
:members:
23+
:undoc-members:
24+
:show-inheritance:
25+
```
26+
27+
## Example Usage
28+
29+
```python
30+
from maap.maap import MAAP
31+
32+
maap = MAAP()
33+
34+
# Submit a job
35+
job = maap.submitJob(
36+
identifier='my_analysis',
37+
algo_id='my_algorithm',
38+
version='main',
39+
queue='maap-dps-worker-8gb',
40+
input_file='s3://bucket/input.tif'
41+
)
42+
43+
# Check status
44+
print(f"Job ID: {job.id}")
45+
print(f"Status: {job.status}")
46+
47+
# Wait for completion
48+
job.wait_for_completion()
49+
50+
# Get results
51+
if job.status == 'Succeeded':
52+
print(f"Outputs: {job.outputs}")
53+
print(f"Duration: {job.job_duration_seconds}s")
54+
55+
# Cancel a job
56+
job.cancel_job()
57+
```

docs/api/maap.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# MAAP Client
2+
3+
```{eval-rst}
4+
.. automodule:: maap.maap
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:
8+
:special-members: __init__
9+
```
10+
11+
The {class}`~maap.maap.MAAP` class is the main entry point for all MAAP operations.
12+
13+
## Example Usage
14+
15+
```python
16+
from maap.maap import MAAP
17+
18+
# Initialize
19+
maap = MAAP()
20+
21+
# Search granules
22+
granules = maap.searchGranule(short_name='GEDI02_A', limit=10)
23+
24+
# Search collections
25+
collections = maap.searchCollection(provider='MAAP')
26+
27+
# Submit a job
28+
job = maap.submitJob(
29+
identifier='analysis',
30+
algo_id='my_algo',
31+
version='main',
32+
queue='maap-dps-worker-8gb'
33+
)
34+
```

docs/api/profile.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# User Profile
2+
3+
```{eval-rst}
4+
.. automodule:: maap.Profile
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:
8+
9+
.. autoclass:: maap.Profile.Profile
10+
:members:
11+
:special-members: __init__
12+
```
13+
14+
## Example Usage
15+
16+
```python
17+
from maap.maap import MAAP
18+
19+
maap = MAAP()
20+
21+
# Get user account information
22+
info = maap.profile.account_info()
23+
if info:
24+
print(f"User ID: {info['id']}")
25+
print(f"Username: {info['username']}")
26+
```

docs/api/result.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Result Classes
2+
3+
```{eval-rst}
4+
.. automodule:: maap.Result
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:
8+
```
9+
10+
The Result module provides classes for handling CMR search results.
11+
12+
## Classes
13+
14+
### Result
15+
16+
Base class for CMR results.
17+
18+
```{eval-rst}
19+
.. autoclass:: maap.Result.Result
20+
:members:
21+
:special-members: __init__
22+
```
23+
24+
### Granule
25+
26+
Represents a CMR granule (individual data file).
27+
28+
```{eval-rst}
29+
.. autoclass:: maap.Result.Granule
30+
:members:
31+
:special-members: __init__
32+
```
33+
34+
### Collection
35+
36+
Represents a CMR collection (dataset).
37+
38+
```{eval-rst}
39+
.. autoclass:: maap.Result.Collection
40+
:members:
41+
:special-members: __init__
42+
```
43+
44+
## Example Usage
45+
46+
```python
47+
from maap.maap import MAAP
48+
49+
maap = MAAP()
50+
51+
# Search granules
52+
granules = maap.searchGranule(short_name='GEDI02_A', limit=5)
53+
54+
for granule in granules:
55+
# Get URLs
56+
s3_url = granule.getS3Url()
57+
http_url = granule.getHttpUrl()
58+
59+
# Download
60+
local_path = granule.getData(destpath='/tmp')
61+
62+
# Get description
63+
print(granule.getDescription())
64+
```

docs/api/secrets.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# User Secrets
2+
3+
```{eval-rst}
4+
.. automodule:: maap.Secrets
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:
8+
9+
.. autoclass:: maap.Secrets.Secrets
10+
:members:
11+
:special-members: __init__
12+
```
13+
14+
## Example Usage
15+
16+
```python
17+
from maap.maap import MAAP
18+
19+
maap = MAAP()
20+
21+
# List all secrets
22+
secrets_list = maap.secrets.get_secrets()
23+
for secret in secrets_list:
24+
print(f"Secret: {secret['secret_name']}")
25+
26+
# Get a specific secret
27+
value = maap.secrets.get_secret('my_api_key')
28+
print(f"Value: {value}")
29+
30+
# Add a new secret
31+
maap.secrets.add_secret('my_new_key', 'my_secret_value')
32+
33+
# Delete a secret
34+
maap.secrets.delete_secret('my_old_key')
35+
```

0 commit comments

Comments
 (0)