Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CMR-related type hints #510

Merged
merged 12 commits into from
Apr 16, 2024
9 changes: 9 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ Finally, for _development dependencies only_, you must add an entry to
make format lint
```

We attempt to provide comprehensive type annotations within this repository. If
you do not provide fully annotated functions or methods, the `lint` command will
fail. Over time, we plan to increase type-checking strictness in order to
ensure more precise, beneficial type annotations.

We have included type stubs for the untyped `python-cmr` library, which we
intend to eventually upstream. Since `python-cmr` exposes the `cmr` package,
the stubs appear under `stubs/cmr`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯 to both new paragraphs, thanks!


### Requirements to merge code (Pull Request Process)

- you must include test coverage
Expand Down
1 change: 1 addition & 0 deletions ci/environment-mindeps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ dependencies:
- multimethod=1.8
- python-dateutil=2.8.2
- importlib-resources=6.3.2
- typing-extensions=4.10.0
# test dependencies
- responses
- pytest
Expand Down
2 changes: 1 addition & 1 deletion earthaccess/api.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import requests
import s3fs
from fsspec import AbstractFileSystem
from typing_extensions import Any, Dict, List, Optional, Union

import earthaccess

from .auth import Auth
from .results import DataCollection, DataGranule
from .search import CollectionQuery, DataCollections, DataGranules, GranuleQuery
from .store import Store
from .typing_ import Any, Dict, List, Optional, Union
from .utils import _validation as validate


Expand Down
14 changes: 7 additions & 7 deletions earthaccess/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@

import dateutil.parser as parser
import requests

from cmr import CollectionQuery, GranuleQuery

from .auth import Auth
from .daac import find_provider, find_provider_by_shortname
from .results import DataCollection, DataGranule
from .typing_ import (
from typing_extensions import (
Any,
List,
Optional,
Expand All @@ -22,6 +16,12 @@
override,
)

from cmr import CollectionQuery, GranuleQuery

from .auth import Auth
from .daac import find_provider, find_provider_by_shortname
from .results import DataCollection, DataGranule

FloatLike: TypeAlias = Union[str, SupportsFloat]
PointLike: TypeAlias = Tuple[FloatLike, FloatLike]

Expand Down
46 changes: 0 additions & 46 deletions earthaccess/typing_.py

This file was deleted.

2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ python-dateutil = ">=2.8.2"
kerchunk = { version = ">=0.1.2", optional = true }
dask = { version = ">=2022.1.0", optional = true }
importlib-resources = ">=6.3.2"
typing_extensions = ">=4.10.0"

[tool.poetry.extras]
kerchunk = ["kerchunk", "dask"]
Expand Down
Loading