usdata 0.9.0__tar.gz → 0.11.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- usdata-0.11.0/PKG-INFO +93 -0
- usdata-0.11.0/README.md +64 -0
- {usdata-0.9.0 → usdata-0.11.0}/pyproject.toml +69 -3
- {usdata-0.9.0 → usdata-0.11.0}/pyproject.toml.orig +63 -3
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/cli/app.py +51 -4
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/data/nexrad_sites.csv +211 -211
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/data/registry.yaml +131 -19
- usdata-0.11.0/src/usdata/providers/noaa/coops.py +141 -0
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/providers/noaa/ghcnd.py +5 -1
- usdata-0.11.0/src/usdata/providers/noaa/gsoy.py +46 -0
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/providers/noaa/nexrad.py +2 -2
- usdata-0.11.0/src/usdata/providers/noaa/normals.py +128 -0
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/pull.py +111 -15
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/readers.py +3 -2
- usdata-0.9.0/PKG-INFO +0 -115
- usdata-0.9.0/README.md +0 -87
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/__init__.py +0 -0
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/_files.py +0 -0
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/_netcdf.py +0 -0
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/_progress.py +0 -0
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/_radar.py +0 -0
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/cache.py +0 -0
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/cli/__init__.py +0 -0
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/cli/progress.py +0 -0
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/data/places.csv +0 -0
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/data/places.sources.json +0 -0
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/fetch.py +0 -0
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/manifest.py +0 -0
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/models.py +0 -0
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/protocols/__init__.py +0 -0
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/protocols/erddap.py +0 -0
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/protocols/http.py +0 -0
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/protocols/s3.py +0 -0
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/provenance.py +0 -0
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/providers/__init__.py +0 -0
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/providers/_http.py +0 -0
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/providers/base.py +0 -0
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/providers/noaa/__init__.py +0 -0
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/providers/noaa/coastwatch.py +0 -0
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/providers/noaa/goes.py +0 -0
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/providers/noaa/gsom.py +0 -0
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/providers/noaa/sites.py +0 -0
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/providers/noaa/storm_events.py +0 -0
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/providers/usgs/__init__.py +0 -0
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/providers/usgs/daily.py +0 -0
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/py.typed +0 -0
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/query.py +0 -0
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/registry.py +0 -0
- {usdata-0.9.0 → usdata-0.11.0}/src/usdata/selection.py +0 -0
usdata-0.11.0/PKG-INFO
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: usdata
|
|
3
|
+
Version: 0.11.0
|
|
4
|
+
Summary: Unified Python SDK and CLI for discovering, fetching, and tracking provenance of U.S. public scientific data
|
|
5
|
+
Keywords: noaa,usgs,nasa,open-data,scientific-data,provenance
|
|
6
|
+
Author: Jake Van Slyke
|
|
7
|
+
Author-email: Jake Van Slyke <jakervanslyke@gmail.com>
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
10
|
+
Classifier: Intended Audience :: Science/Research
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Topic :: Scientific/Engineering
|
|
13
|
+
Requires-Dist: httpx>=0.28.1
|
|
14
|
+
Requires-Dist: pydantic>=2.7
|
|
15
|
+
Requires-Dist: pyyaml>=6.0
|
|
16
|
+
Requires-Dist: typer>=0.18
|
|
17
|
+
Requires-Dist: xarray>=2025.1 ; extra == 'netcdf'
|
|
18
|
+
Requires-Dist: h5netcdf[h5py]>=1.8.1 ; extra == 'netcdf'
|
|
19
|
+
Requires-Dist: pandas>=3.0 ; extra == 'pandas'
|
|
20
|
+
Requires-Dist: xradar>=0.12.0 ; extra == 'radar'
|
|
21
|
+
Requires-Python: >=3.11
|
|
22
|
+
Project-URL: Homepage, https://usdata.dev/
|
|
23
|
+
Project-URL: Documentation, https://docs.usdata.dev/
|
|
24
|
+
Project-URL: Repository, https://github.com/jakeryderv/usdata
|
|
25
|
+
Provides-Extra: netcdf
|
|
26
|
+
Provides-Extra: pandas
|
|
27
|
+
Provides-Extra: radar
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+
# usdata
|
|
31
|
+
|
|
32
|
+
Discover U.S. scientific datasets, fetch their files, and keep a reproducible
|
|
33
|
+
record of where every input came from. Use the same Python SDK or CLI across
|
|
34
|
+
supported NOAA and USGS datasets.
|
|
35
|
+
|
|
36
|
+
**Pre-alpha.** These docs describe the current source checkout. Features marked
|
|
37
|
+
**Unreleased** require a source installation; consult the
|
|
38
|
+
[changelog](CHANGELOG.md) for published versions. Other providers are planned.
|
|
39
|
+
|
|
40
|
+
Project home: [usdata.dev](https://usdata.dev/).
|
|
41
|
+
[Documentation and getting started](https://docs.usdata.dev/).
|
|
42
|
+
|
|
43
|
+
## Start here
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
pip install usdata
|
|
47
|
+
usdata search precipitation --location Oklahoma
|
|
48
|
+
usdata info noaa:ghcn-daily
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Search uses a curated registry. Fetching contacts the upstream service; readers
|
|
52
|
+
open the resulting local files. Provenance and manifests connect those steps.
|
|
53
|
+
|
|
54
|
+
- [Quick start and documentation](docs/index.md)
|
|
55
|
+
- [Fetch and analyze data](docs/guides/fetch-and-analyze.md)
|
|
56
|
+
- [Runnable examples with saved outputs](examples/README.md)
|
|
57
|
+
- [Readers](docs/reference/readers.md) and [reproducible manifests](docs/reference/manifests.md)
|
|
58
|
+
|
|
59
|
+
## Source installation
|
|
60
|
+
|
|
61
|
+
For features marked **Unreleased**, install this checkout with
|
|
62
|
+
[uv](https://docs.astral.sh/uv/):
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
git clone https://github.com/jakeryderv/usdata && cd usdata
|
|
66
|
+
uv sync --extra pandas
|
|
67
|
+
uv run usdata info noaa:coops-water-levels
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Run source examples from this checkout with `uv run usdata` (CLI) or
|
|
71
|
+
`uv run python` (Python). The pandas extra enables CSV reading; use `--extra radar`
|
|
72
|
+
or `--extra netcdf` for those formats. For contribution checks, continue with
|
|
73
|
+
[development setup](#development).
|
|
74
|
+
|
|
75
|
+
## Providers
|
|
76
|
+
|
|
77
|
+
Browse the [dataset catalog](docs/generated/catalog/index.md) for current support,
|
|
78
|
+
release availability, and dataset details. [Provider access notes](docs/providers/README.md)
|
|
79
|
+
explain agency-specific services; the [roadmap](docs/roadmap.md) describes priorities.
|
|
80
|
+
|
|
81
|
+
## Development
|
|
82
|
+
|
|
83
|
+
```sh
|
|
84
|
+
just setup
|
|
85
|
+
just check
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
See [development setup and commands](docs/project.md#development),
|
|
89
|
+
[contributing](CONTRIBUTING.md), and [architecture](docs/architecture.md).
|
|
90
|
+
|
|
91
|
+
## License
|
|
92
|
+
|
|
93
|
+
[Apache-2.0](LICENSE).
|
usdata-0.11.0/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# usdata
|
|
2
|
+
|
|
3
|
+
Discover U.S. scientific datasets, fetch their files, and keep a reproducible
|
|
4
|
+
record of where every input came from. Use the same Python SDK or CLI across
|
|
5
|
+
supported NOAA and USGS datasets.
|
|
6
|
+
|
|
7
|
+
**Pre-alpha.** These docs describe the current source checkout. Features marked
|
|
8
|
+
**Unreleased** require a source installation; consult the
|
|
9
|
+
[changelog](CHANGELOG.md) for published versions. Other providers are planned.
|
|
10
|
+
|
|
11
|
+
Project home: [usdata.dev](https://usdata.dev/).
|
|
12
|
+
[Documentation and getting started](https://docs.usdata.dev/).
|
|
13
|
+
|
|
14
|
+
## Start here
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
pip install usdata
|
|
18
|
+
usdata search precipitation --location Oklahoma
|
|
19
|
+
usdata info noaa:ghcn-daily
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Search uses a curated registry. Fetching contacts the upstream service; readers
|
|
23
|
+
open the resulting local files. Provenance and manifests connect those steps.
|
|
24
|
+
|
|
25
|
+
- [Quick start and documentation](docs/index.md)
|
|
26
|
+
- [Fetch and analyze data](docs/guides/fetch-and-analyze.md)
|
|
27
|
+
- [Runnable examples with saved outputs](examples/README.md)
|
|
28
|
+
- [Readers](docs/reference/readers.md) and [reproducible manifests](docs/reference/manifests.md)
|
|
29
|
+
|
|
30
|
+
## Source installation
|
|
31
|
+
|
|
32
|
+
For features marked **Unreleased**, install this checkout with
|
|
33
|
+
[uv](https://docs.astral.sh/uv/):
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
git clone https://github.com/jakeryderv/usdata && cd usdata
|
|
37
|
+
uv sync --extra pandas
|
|
38
|
+
uv run usdata info noaa:coops-water-levels
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Run source examples from this checkout with `uv run usdata` (CLI) or
|
|
42
|
+
`uv run python` (Python). The pandas extra enables CSV reading; use `--extra radar`
|
|
43
|
+
or `--extra netcdf` for those formats. For contribution checks, continue with
|
|
44
|
+
[development setup](#development).
|
|
45
|
+
|
|
46
|
+
## Providers
|
|
47
|
+
|
|
48
|
+
Browse the [dataset catalog](docs/generated/catalog/index.md) for current support,
|
|
49
|
+
release availability, and dataset details. [Provider access notes](docs/providers/README.md)
|
|
50
|
+
explain agency-specific services; the [roadmap](docs/roadmap.md) describes priorities.
|
|
51
|
+
|
|
52
|
+
## Development
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
just setup
|
|
56
|
+
just check
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
See [development setup and commands](docs/project.md#development),
|
|
60
|
+
[contributing](CONTRIBUTING.md), and [architecture](docs/architecture.md).
|
|
61
|
+
|
|
62
|
+
## License
|
|
63
|
+
|
|
64
|
+
[Apache-2.0](LICENSE).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "usdata"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.11.0"
|
|
4
4
|
description = "Unified Python SDK and CLI for discovering, fetching, and tracking provenance of U.S. public scientific data"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "Apache-2.0"
|
|
@@ -39,7 +39,8 @@ netcdf = [
|
|
|
39
39
|
]
|
|
40
40
|
|
|
41
41
|
[project.urls]
|
|
42
|
-
Homepage = "https://
|
|
42
|
+
Homepage = "https://usdata.dev/"
|
|
43
|
+
Documentation = "https://docs.usdata.dev/"
|
|
43
44
|
Repository = "https://github.com/jakeryderv/usdata"
|
|
44
45
|
|
|
45
46
|
[project.scripts]
|
|
@@ -47,16 +48,20 @@ usdata = "usdata.cli:app"
|
|
|
47
48
|
|
|
48
49
|
[dependency-groups]
|
|
49
50
|
dev = [
|
|
51
|
+
"pre-commit>=4.6.0",
|
|
50
52
|
"pyright>=1.1.380",
|
|
51
53
|
"pytest>=8.0",
|
|
52
54
|
"pytest-cov>=7.1.0",
|
|
53
55
|
"respx>=0.23.1",
|
|
54
56
|
"ruff>=0.6",
|
|
57
|
+
"towncrier>=26.9",
|
|
55
58
|
]
|
|
56
59
|
docs = [
|
|
57
60
|
"mkdocstrings-python>=2.0.8",
|
|
58
61
|
"nbconvert>=7.17.1",
|
|
59
|
-
"
|
|
62
|
+
"towncrier>=26.9",
|
|
63
|
+
"mkdocs>=1.6.1,<2",
|
|
64
|
+
"mkdocs-material>=9.7.7,<10",
|
|
60
65
|
]
|
|
61
66
|
examples = [
|
|
62
67
|
"ipykernel>=6.29",
|
|
@@ -126,3 +131,64 @@ markers = [
|
|
|
126
131
|
"netcdf: optional NetCDF reader coverage",
|
|
127
132
|
]
|
|
128
133
|
addopts = "-ra --strict-markers"
|
|
134
|
+
|
|
135
|
+
[tool.towncrier]
|
|
136
|
+
directory = "changes"
|
|
137
|
+
filename = "CHANGELOG.md"
|
|
138
|
+
start_string = """
|
|
139
|
+
<!-- towncrier release notes start -->
|
|
140
|
+
"""
|
|
141
|
+
underlines = [
|
|
142
|
+
"",
|
|
143
|
+
"",
|
|
144
|
+
"",
|
|
145
|
+
]
|
|
146
|
+
title_format = "## [{version}](https://github.com/jakeryderv/usdata/releases/tag/v{version}) - {project_date}"
|
|
147
|
+
issue_format = "[#{issue}](https://github.com/jakeryderv/usdata/issues/{issue})"
|
|
148
|
+
template = "scripts/templates/changelog.md.jinja"
|
|
149
|
+
wrap = false
|
|
150
|
+
|
|
151
|
+
[[tool.towncrier.type]]
|
|
152
|
+
directory = "breaking"
|
|
153
|
+
name = "Breaking"
|
|
154
|
+
showcontent = true
|
|
155
|
+
|
|
156
|
+
[[tool.towncrier.type]]
|
|
157
|
+
directory = "security"
|
|
158
|
+
name = "Security"
|
|
159
|
+
showcontent = true
|
|
160
|
+
|
|
161
|
+
[[tool.towncrier.type]]
|
|
162
|
+
directory = "removed"
|
|
163
|
+
name = "Removed"
|
|
164
|
+
showcontent = true
|
|
165
|
+
|
|
166
|
+
[[tool.towncrier.type]]
|
|
167
|
+
directory = "added"
|
|
168
|
+
name = "Added"
|
|
169
|
+
showcontent = true
|
|
170
|
+
|
|
171
|
+
[[tool.towncrier.type]]
|
|
172
|
+
directory = "changed"
|
|
173
|
+
name = "Changed"
|
|
174
|
+
showcontent = true
|
|
175
|
+
|
|
176
|
+
[[tool.towncrier.type]]
|
|
177
|
+
directory = "fixed"
|
|
178
|
+
name = "Fixed"
|
|
179
|
+
showcontent = true
|
|
180
|
+
|
|
181
|
+
[[tool.towncrier.type]]
|
|
182
|
+
directory = "documentation"
|
|
183
|
+
name = "Documentation"
|
|
184
|
+
showcontent = true
|
|
185
|
+
|
|
186
|
+
[[tool.towncrier.type]]
|
|
187
|
+
directory = "development"
|
|
188
|
+
name = "Development"
|
|
189
|
+
showcontent = true
|
|
190
|
+
|
|
191
|
+
[[tool.towncrier.type]]
|
|
192
|
+
directory = "internal"
|
|
193
|
+
name = "Internal"
|
|
194
|
+
showcontent = true
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "usdata"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.11.0"
|
|
4
4
|
description = "Unified Python SDK and CLI for discovering, fetching, and tracking provenance of U.S. public scientific data"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "Apache-2.0"
|
|
@@ -28,7 +28,8 @@ radar = ["xradar>=0.12.0"]
|
|
|
28
28
|
netcdf = ["xarray>=2025.1", "h5netcdf[h5py]>=1.8.1"]
|
|
29
29
|
|
|
30
30
|
[project.urls]
|
|
31
|
-
Homepage = "https://
|
|
31
|
+
Homepage = "https://usdata.dev/"
|
|
32
|
+
Documentation = "https://docs.usdata.dev/"
|
|
32
33
|
Repository = "https://github.com/jakeryderv/usdata"
|
|
33
34
|
|
|
34
35
|
[project.scripts]
|
|
@@ -36,16 +37,20 @@ usdata = "usdata.cli:app"
|
|
|
36
37
|
|
|
37
38
|
[dependency-groups]
|
|
38
39
|
dev = [
|
|
40
|
+
"pre-commit>=4.6.0",
|
|
39
41
|
"pyright>=1.1.380",
|
|
40
42
|
"pytest>=8.0",
|
|
41
43
|
"pytest-cov>=7.1.0",
|
|
42
44
|
"respx>=0.23.1",
|
|
43
45
|
"ruff>=0.6",
|
|
46
|
+
"towncrier>=26.9",
|
|
44
47
|
]
|
|
45
48
|
docs = [
|
|
46
49
|
"mkdocstrings-python>=2.0.8",
|
|
47
50
|
"nbconvert>=7.17.1",
|
|
48
|
-
"
|
|
51
|
+
"towncrier>=26.9",
|
|
52
|
+
"mkdocs>=1.6.1,<2",
|
|
53
|
+
"mkdocs-material>=9.7.7,<10",
|
|
49
54
|
]
|
|
50
55
|
examples = [
|
|
51
56
|
"ipykernel>=6.29",
|
|
@@ -98,3 +103,58 @@ markers = [
|
|
|
98
103
|
"netcdf: optional NetCDF reader coverage",
|
|
99
104
|
]
|
|
100
105
|
addopts = "-ra --strict-markers"
|
|
106
|
+
|
|
107
|
+
[tool.towncrier]
|
|
108
|
+
directory = "changes"
|
|
109
|
+
filename = "CHANGELOG.md"
|
|
110
|
+
start_string = "<!-- towncrier release notes start -->\n"
|
|
111
|
+
underlines = ["", "", ""]
|
|
112
|
+
title_format = "## [{version}](https://github.com/jakeryderv/usdata/releases/tag/v{version}) - {project_date}"
|
|
113
|
+
issue_format = "[#{issue}](https://github.com/jakeryderv/usdata/issues/{issue})"
|
|
114
|
+
template = "scripts/templates/changelog.md.jinja"
|
|
115
|
+
wrap = false
|
|
116
|
+
|
|
117
|
+
[[tool.towncrier.type]]
|
|
118
|
+
directory = "breaking"
|
|
119
|
+
name = "Breaking"
|
|
120
|
+
showcontent = true
|
|
121
|
+
|
|
122
|
+
[[tool.towncrier.type]]
|
|
123
|
+
directory = "security"
|
|
124
|
+
name = "Security"
|
|
125
|
+
showcontent = true
|
|
126
|
+
|
|
127
|
+
[[tool.towncrier.type]]
|
|
128
|
+
directory = "removed"
|
|
129
|
+
name = "Removed"
|
|
130
|
+
showcontent = true
|
|
131
|
+
|
|
132
|
+
[[tool.towncrier.type]]
|
|
133
|
+
directory = "added"
|
|
134
|
+
name = "Added"
|
|
135
|
+
showcontent = true
|
|
136
|
+
|
|
137
|
+
[[tool.towncrier.type]]
|
|
138
|
+
directory = "changed"
|
|
139
|
+
name = "Changed"
|
|
140
|
+
showcontent = true
|
|
141
|
+
|
|
142
|
+
[[tool.towncrier.type]]
|
|
143
|
+
directory = "fixed"
|
|
144
|
+
name = "Fixed"
|
|
145
|
+
showcontent = true
|
|
146
|
+
|
|
147
|
+
[[tool.towncrier.type]]
|
|
148
|
+
directory = "documentation"
|
|
149
|
+
name = "Documentation"
|
|
150
|
+
showcontent = true
|
|
151
|
+
|
|
152
|
+
[[tool.towncrier.type]]
|
|
153
|
+
directory = "development"
|
|
154
|
+
name = "Development"
|
|
155
|
+
showcontent = true
|
|
156
|
+
|
|
157
|
+
[[tool.towncrier.type]]
|
|
158
|
+
directory = "internal"
|
|
159
|
+
name = "Internal"
|
|
160
|
+
showcontent = true
|
|
@@ -16,7 +16,7 @@ from usdata.fetch import fetch as fetch_query
|
|
|
16
16
|
from usdata.manifest import lockfile_path
|
|
17
17
|
from usdata.providers import load_adapter
|
|
18
18
|
from usdata.providers.base import NotImplementedProvider
|
|
19
|
-
from usdata.pull import EmptySource, ManifestChanged, UnknownDatasets
|
|
19
|
+
from usdata.pull import EmptySource, ManifestChanged, UnknownDatasets, UpstreamChanged
|
|
20
20
|
from usdata.pull import pull as pull_manifest
|
|
21
21
|
from usdata.pull import verify as verify_manifest
|
|
22
22
|
from usdata.query import UnknownPlace
|
|
@@ -29,6 +29,20 @@ app = typer.Typer(
|
|
|
29
29
|
)
|
|
30
30
|
|
|
31
31
|
|
|
32
|
+
_QUERY_FLAGS = {
|
|
33
|
+
"location": "--location",
|
|
34
|
+
"bbox": "--bbox",
|
|
35
|
+
"lat": "--lat",
|
|
36
|
+
"lon": "--lon",
|
|
37
|
+
"radius_km": "--radius-km",
|
|
38
|
+
"start": "--start",
|
|
39
|
+
"end": "--end",
|
|
40
|
+
"variables": "--vars",
|
|
41
|
+
"text": None,
|
|
42
|
+
"provider": None,
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
32
46
|
def _version_callback(value: bool) -> None:
|
|
33
47
|
if value:
|
|
34
48
|
typer.echo(f"usdata {__version__}")
|
|
@@ -140,6 +154,19 @@ def fetch(
|
|
|
140
154
|
if not sep:
|
|
141
155
|
typer.secho(f"--param expects key=value, got {item!r}", err=True, fg="red")
|
|
142
156
|
raise typer.Exit(code=2)
|
|
157
|
+
if key in _QUERY_FLAGS:
|
|
158
|
+
flag = _QUERY_FLAGS[key]
|
|
159
|
+
hint = (
|
|
160
|
+
f"use {flag} instead of --param"
|
|
161
|
+
if flag is not None
|
|
162
|
+
else "fetch does not support this option"
|
|
163
|
+
)
|
|
164
|
+
typer.secho(
|
|
165
|
+
f"{key} is a reserved query option; {hint}",
|
|
166
|
+
err=True,
|
|
167
|
+
fg="red",
|
|
168
|
+
)
|
|
169
|
+
raise typer.Exit(code=2)
|
|
143
170
|
params[key] = value
|
|
144
171
|
box = None
|
|
145
172
|
if bbox:
|
|
@@ -198,12 +225,18 @@ def pull(
|
|
|
198
225
|
bool,
|
|
199
226
|
typer.Option(help="Ignore an existing lockfile: re-resolve every source and rewrite it."),
|
|
200
227
|
] = False,
|
|
228
|
+
update: Annotated[
|
|
229
|
+
list[str] | None,
|
|
230
|
+
typer.Option(
|
|
231
|
+
help="Asset or dataset id whose pin should follow current upstream bytes; repeatable."
|
|
232
|
+
),
|
|
233
|
+
] = None,
|
|
201
234
|
no_progress: Annotated[bool, typer.Option(help="Disable terminal progress.")] = False,
|
|
202
235
|
) -> None:
|
|
203
236
|
"""Fetch every source in a manifest and write (or restore from) its lockfile."""
|
|
204
237
|
try:
|
|
205
238
|
with progress(disabled=no_progress):
|
|
206
|
-
result = pull_manifest(manifest, root=cache_dir, force=force)
|
|
239
|
+
result = pull_manifest(manifest, root=cache_dir, force=force, update=update or [])
|
|
207
240
|
except EmptySource as e:
|
|
208
241
|
typer.secho(str(e), err=True, fg="yellow")
|
|
209
242
|
raise typer.Exit(code=1) from None
|
|
@@ -213,13 +246,27 @@ def pull(
|
|
|
213
246
|
except NotImplementedProvider as e:
|
|
214
247
|
typer.secho(str(e), err=True, fg="yellow")
|
|
215
248
|
raise typer.Exit(code=3) from None
|
|
249
|
+
except UpstreamChanged as e:
|
|
250
|
+
for d in e.drift:
|
|
251
|
+
typer.echo(f"{d.asset_id}\t{d.problem}\t{d.path}")
|
|
252
|
+
typer.secho(
|
|
253
|
+
f"{len(e.drift)} asset(s) changed upstream; lockfile unchanged. "
|
|
254
|
+
"Pass --update <asset or dataset id> to accept the new bytes.",
|
|
255
|
+
err=True,
|
|
256
|
+
fg="red",
|
|
257
|
+
)
|
|
258
|
+
raise typer.Exit(code=4) from None
|
|
216
259
|
except (httpx.HTTPError, ChecksumMismatch) as e:
|
|
217
260
|
typer.secho(f"fetch failed: {e}", err=True, fg="red")
|
|
218
261
|
raise typer.Exit(code=4) from None
|
|
262
|
+
updated = set(result.updated)
|
|
219
263
|
for f in result.fetched:
|
|
220
|
-
tag = "cached" if f.from_cache else "fetched"
|
|
264
|
+
tag = "updated" if f.asset.id in updated else "cached" if f.from_cache else "fetched"
|
|
221
265
|
typer.echo(f"{f.path}\t{tag}\t{f.provenance.size} bytes")
|
|
222
|
-
|
|
266
|
+
if result.updated:
|
|
267
|
+
mode = f"updated {len(result.updated)} pin(s) in"
|
|
268
|
+
else:
|
|
269
|
+
mode = "restored from" if result.from_lockfile else "wrote"
|
|
223
270
|
typer.echo(f"{len(result.fetched)} asset(s); {mode} {result.lockfile_path}", err=True)
|
|
224
271
|
|
|
225
272
|
|