From 92a479d689657ce5faecde2589f10b74fd218264 Mon Sep 17 00:00:00 2001 From: Jonathan Beezley Date: Thu, 8 Aug 2024 13:58:13 -0600 Subject: [PATCH] Rename package --- .../workflows/.!22811!python.yml | 0 README.md | 18 +++++++++--------- examples/advanced.py | 12 ++++++------ examples/simple.py | 6 +++--- {spire_csda/models => nasa_csda}/__init__.py | 0 {spire_csda => nasa_csda}/buffer.py | 0 {spire_csda => nasa_csda}/cli.py | 14 +++++++------- {spire_csda => nasa_csda}/client.py | 10 +++++----- {spire_csda => nasa_csda}/config.py | 0 {spire_csda => nasa_csda}/geometry.py | 0 nasa_csda/models/__init__.py | 0 .../models/bulk_download.py | 2 +- .../models/item_collection.py | 0 {spire_csda => nasa_csda}/models/link.py | 0 {spire_csda => nasa_csda}/models/search.py | 0 {spire_csda => nasa_csda}/streaming.py | 8 ++++---- {spire_csda => nasa_csda}/transport.py | 2 +- pyproject.toml | 4 ++-- tests/conftest.py | 8 ++++---- tests/test_buffer.py | 2 +- tests/test_client.py | 2 +- tests/test_stream.py | 4 ++-- 22 files changed, 46 insertions(+), 46 deletions(-) rename spire_csda/__init__.py => .github/workflows/.!22811!python.yml (100%) rename {spire_csda/models => nasa_csda}/__init__.py (100%) rename {spire_csda => nasa_csda}/buffer.py (100%) rename {spire_csda => nasa_csda}/cli.py (96%) rename {spire_csda => nasa_csda}/client.py (97%) rename {spire_csda => nasa_csda}/config.py (100%) rename {spire_csda => nasa_csda}/geometry.py (100%) create mode 100644 nasa_csda/models/__init__.py rename {spire_csda => nasa_csda}/models/bulk_download.py (79%) rename {spire_csda => nasa_csda}/models/item_collection.py (100%) rename {spire_csda => nasa_csda}/models/link.py (100%) rename {spire_csda => nasa_csda}/models/search.py (100%) rename {spire_csda => nasa_csda}/streaming.py (89%) rename {spire_csda => nasa_csda}/transport.py (96%) diff --git a/spire_csda/__init__.py b/.github/workflows/.!22811!python.yml similarity index 100% rename from spire_csda/__init__.py rename to .github/workflows/.!22811!python.yml diff --git a/README.md b/README.md index 59849bb..ee79471 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# spire-csda +# nasa-csda-cli This is a CLI and SDK for querying and downloading files from Spire's [CSDA catalog](https://nasa-csda.wx.spire.com/). @@ -6,7 +6,7 @@ This is a CLI and SDK for querying and downloading files from Spire's ## Install it from PyPI ```bash -pip install spire-csda +pip install nasa-csda ``` ## Using the CLI @@ -14,7 +14,7 @@ pip install spire-csda See the command's help dialog for detailed usage information for all commands. ```bash -spire-csda --help +nasa-csda-cli --help ``` All of the commands require login information (the same username and password @@ -34,7 +34,7 @@ the CLI to download all files matching the query created in the UI. To download all files using this configuration file, ```bash -spire-csda --username --password bulk-download download-config.json +nasa-csda-cli --username --password bulk-download download-config.json ``` ### Querying the catalog @@ -43,7 +43,7 @@ You can also construct queries to perform custom tasks using the `query` command. ```bash -spire-csda query --start-date 2020-01-01 --end-date 2020-01-02 \ +nasa-csda-cli query --start-date 2020-01-01 --end-date 2020-01-02 \ --products opnGns,atmPhs \ --min-latitude -50 --max-latitude 50 --min-longitude -50 --max-longitude 50 ``` @@ -56,7 +56,7 @@ download does. There are two additional modes of operation this command supports In `list` mode, a link to all files will be printed to STDOUT. ```bash -spire-csda query --start-date 2020-01-01 --end-date 2020-01-02 \ +nasa-csda-cli query --start-date 2020-01-01 --end-date 2020-01-02 \ --products opnGns,atmPhs \ --min-latitude -50 --max-latitude 50 --min-longitude -100 --max-longitude 100 \ --mode list --no-progress --limit 10 @@ -79,7 +79,7 @@ https://nasa-csda.wx.spire.com/download/spire/2020-01-01T23-51-32_FM104_G25_atmP In `raw` mode, the command will stream out GeoJSON objects conforming to the STAC spec. ```bash -spire-csda query --start-date 2020-01-01 --end-date 2020-01-02 \ +nasa-csda-cli query --start-date 2020-01-01 --end-date 2020-01-02 \ --products opnGns,atmPhs \ --min-latitude -50 --max-latitude 50 --min-longitude -100 --max-longitude 100 \ --mode raw --no-progress --limit 1 @@ -91,8 +91,8 @@ Advanced users can use the `token` command to generate authentication headers th downloading files using other tools. ```bash -TOKEN="$(spire-csda token)" -curl -O -L -H "Authentication: Bearer ${TOKEN}" https://nasa-csda.wx.spire.com/download/spire/2020-01-01T23-56-00_FM104_R15_atmPhs/spire_gnss-ro_L1B_atmPhs_v06.01_2020-01-01T23-56-00_FM104_R15.nc -o +TOKEN="$(nasa-csda-cli token)" +curl -O -L -H "Authentication: Bearer ${TOKEN}" https://nasa-csda.wx.spire.com/download/spire/2020-01-01T23-56-00_FM104_R15_atmPhs/spire_gnss-ro_L1B_atmPhs_v06.01_2020-01-01T23-56-00_FM104_R15.nc ``` ## Using the SDK diff --git a/examples/advanced.py b/examples/advanced.py index 71ec5ca..e3e6984 100644 --- a/examples/advanced.py +++ b/examples/advanced.py @@ -4,12 +4,12 @@ from aiostream import pipe, stream -from spire_csda.buffer import Buffer -from spire_csda.client import Client -from spire_csda.config import Settings -from spire_csda.models.item_collection import CSDAItemCollection -from spire_csda.models.search import CSDASearch -from spire_csda.streaming import download, extract_links, search +from nasa_csda.buffer import Buffer +from nasa_csda.client import Client +from nasa_csda.config import Settings +from nasa_csda.models.item_collection import CSDAItemCollection +from nasa_csda.models.search import CSDASearch +from nasa_csda.streaming import download, extract_links, search _max_buffer_size = 10 _max_concurrent_downloads = 4 diff --git a/examples/simple.py b/examples/simple.py index cc01795..2ca3c9f 100644 --- a/examples/simple.py +++ b/examples/simple.py @@ -2,9 +2,9 @@ from asyncio import run -from spire_csda.client import Client -from spire_csda.config import Settings -from spire_csda.models.search import CSDASearch +from nasa_csda.client import Client +from nasa_csda.config import Settings +from nasa_csda.models.search import CSDASearch async def download_first_file(query: CSDASearch): diff --git a/spire_csda/models/__init__.py b/nasa_csda/__init__.py similarity index 100% rename from spire_csda/models/__init__.py rename to nasa_csda/__init__.py diff --git a/spire_csda/buffer.py b/nasa_csda/buffer.py similarity index 100% rename from spire_csda/buffer.py rename to nasa_csda/buffer.py diff --git a/spire_csda/cli.py b/nasa_csda/cli.py similarity index 96% rename from spire_csda/cli.py rename to nasa_csda/cli.py index fb6920b..eb48149 100644 --- a/spire_csda/cli.py +++ b/nasa_csda/cli.py @@ -7,13 +7,13 @@ from tqdm.asyncio import tqdm from tqdm.contrib.logging import logging_redirect_tqdm -from spire_csda.buffer import Buffer -from spire_csda.client import Client -from spire_csda.config import Settings -from spire_csda.models.bulk_download import BulkDownload -from spire_csda.models.item_collection import CSDAItemCollection -from spire_csda.models.search import CSDASearch -from spire_csda.streaming import download, extract_links, search +from nasa_csda.buffer import Buffer +from nasa_csda.client import Client +from nasa_csda.config import Settings +from nasa_csda.models.bulk_download import BulkDownload +from nasa_csda.models.item_collection import CSDAItemCollection +from nasa_csda.models.search import CSDASearch +from nasa_csda.streaming import download, extract_links, search T = TypeVar("T") diff --git a/spire_csda/client.py b/nasa_csda/client.py similarity index 97% rename from spire_csda/client.py rename to nasa_csda/client.py index 7aba254..ebef493 100644 --- a/spire_csda/client.py +++ b/nasa_csda/client.py @@ -10,11 +10,11 @@ from httpx import AsyncClient, HTTPStatusError, Request from tqdm.asyncio import tqdm -from spire_csda.config import Settings -from spire_csda.models.link import DownloadLink -from spire_csda.models.item_collection import CSDAItemCollection -from spire_csda.models.search import CSDASearch -from spire_csda.transport import RetryableTransport +from nasa_csda.config import Settings +from nasa_csda.models.link import DownloadLink +from nasa_csda.models.item_collection import CSDAItemCollection +from nasa_csda.models.search import CSDASearch +from nasa_csda.transport import RetryableTransport logger = logging.getLogger(__name__) _session: ContextVar[AsyncClient] = ContextVar("session") diff --git a/spire_csda/config.py b/nasa_csda/config.py similarity index 100% rename from spire_csda/config.py rename to nasa_csda/config.py diff --git a/spire_csda/geometry.py b/nasa_csda/geometry.py similarity index 100% rename from spire_csda/geometry.py rename to nasa_csda/geometry.py diff --git a/nasa_csda/models/__init__.py b/nasa_csda/models/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/spire_csda/models/bulk_download.py b/nasa_csda/models/bulk_download.py similarity index 79% rename from spire_csda/models/bulk_download.py rename to nasa_csda/models/bulk_download.py index 726549f..09b2d4e 100644 --- a/spire_csda/models/bulk_download.py +++ b/nasa_csda/models/bulk_download.py @@ -1,6 +1,6 @@ from pydantic import BaseModel, ConfigDict, Field -from spire_csda.models.search import CSDASearch +from nasa_csda.models.search import CSDASearch class BulkDownload(BaseModel): diff --git a/spire_csda/models/item_collection.py b/nasa_csda/models/item_collection.py similarity index 100% rename from spire_csda/models/item_collection.py rename to nasa_csda/models/item_collection.py diff --git a/spire_csda/models/link.py b/nasa_csda/models/link.py similarity index 100% rename from spire_csda/models/link.py rename to nasa_csda/models/link.py diff --git a/spire_csda/models/search.py b/nasa_csda/models/search.py similarity index 100% rename from spire_csda/models/search.py rename to nasa_csda/models/search.py diff --git a/spire_csda/streaming.py b/nasa_csda/streaming.py similarity index 89% rename from spire_csda/streaming.py rename to nasa_csda/streaming.py index 808acc6..aa87cce 100644 --- a/spire_csda/streaming.py +++ b/nasa_csda/streaming.py @@ -4,10 +4,10 @@ from aiostream.core import pipable_operator, streamcontext from aiostream.stream import advanced -from spire_csda.client import Client -from spire_csda.models.link import DownloadLink -from spire_csda.models.item_collection import CSDAItemCollection -from spire_csda.models.search import CSDASearch +from nasa_csda.client import Client +from nasa_csda.models.link import DownloadLink +from nasa_csda.models.item_collection import CSDAItemCollection +from nasa_csda.models.search import CSDASearch logger = logging.getLogger(__name__) diff --git a/spire_csda/transport.py b/nasa_csda/transport.py similarity index 96% rename from spire_csda/transport.py rename to nasa_csda/transport.py index 64263af..cde36db 100644 --- a/spire_csda/transport.py +++ b/nasa_csda/transport.py @@ -3,7 +3,7 @@ from httpx import AsyncHTTPTransport, Request, Response from tenacity import AsyncRetrying, stop_after_attempt, wait_exponential_jitter -from spire_csda.config import Settings +from nasa_csda.config import Settings logger = logging.getLogger(__name__) diff --git a/pyproject.toml b/pyproject.toml index 45b79e0..db68e2a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [tool.poetry] -name = "spire-csda" +name = "nasa-csda" version = "0.1.0" description = "" authors = ["Your Name "] @@ -28,7 +28,7 @@ pydantic-settings = "^2.4.0" platformdirs = "^4.2.2" [tool.poetry.scripts] -spire-csda = "spire_csda.cli:cli" +nasa-csda-cli = "nasa_csda.cli:cli" [tool.poetry.group.dev.dependencies] black = "^24.4.2" diff --git a/tests/conftest.py b/tests/conftest.py index 7190713..1e24048 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -15,10 +15,10 @@ from stac_pydantic.api.search import FieldsExtension from stac_pydantic.api.item import Item -from spire_csda.client import Client -from spire_csda.config import Settings -from spire_csda.models.item_collection import CSDAItemCollection -from spire_csda.models.search import CSDASearch +from nasa_csda.client import Client +from nasa_csda.config import Settings +from nasa_csda.models.item_collection import CSDAItemCollection +from nasa_csda.models.search import CSDASearch T = TypeVar("T", bound=BaseModel) HERE = Path(__file__).parent diff --git a/tests/test_buffer.py b/tests/test_buffer.py index 3a7b08e..ded9d4f 100644 --- a/tests/test_buffer.py +++ b/tests/test_buffer.py @@ -3,7 +3,7 @@ from aiostream.pipe import take import pytest -from spire_csda.buffer import Buffer +from nasa_csda.buffer import Buffer async def test_buffer_end(): diff --git a/tests/test_client.py b/tests/test_client.py index 92b096a..1dac588 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -1,7 +1,7 @@ from pathlib import Path from tempfile import TemporaryDirectory -from spire_csda.client import Client +from nasa_csda.client import Client async def test_authenticate(httpx_csda, config): diff --git a/tests/test_stream.py b/tests/test_stream.py index 4693a73..76b8952 100644 --- a/tests/test_stream.py +++ b/tests/test_stream.py @@ -3,8 +3,8 @@ from aiostream.stream import iterate -from spire_csda.client import Client -from spire_csda.streaming import download, extract_links, search as search_ +from nasa_csda.client import Client +from nasa_csda.streaming import download, extract_links, search as search_ async def test_search(httpx_csda_client, config, search):