Skip to content

Commit 8be271e

Browse files
authored
Fully type library and advertise it (#21)
This PR finishes mypy typing and advertises it by including a `py.typed` file.
1 parent 0754d67 commit 8be271e

File tree

11 files changed

+404
-167
lines changed

11 files changed

+404
-167
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ __pycache__
33
htmlcov
44
dist
55
.direnv
6+
.mypy_cache
7+
.pytest_cache
8+
.ruff_cache

.pre-commit-config.yaml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
1+
# Configuration file for pre-commit (https://pre-commit.com/).
2+
# Please run `pre-commit run --all-files` when adding or changing entries.
13

24
repos:
35
- repo: https://github.com/MarcoGorelli/absolufy-imports
46
rev: v0.3.1
57
hooks:
68
- id: absolufy-imports
79
name: absolufy-imports
8-
- repo: https://github.com/pycqa/isort
9-
rev: 5.12.0
10-
hooks:
11-
- id: isort
12-
language_version: python3
1310
- repo: https://github.com/asottile/pyupgrade
1411
rev: v3.2.2
1512
hooks:
1613
- id: pyupgrade
1714
args:
1815
- --py38-plus
16+
- repo: https://github.com/astral-sh/ruff-pre-commit
17+
rev: 'v0.0.272'
18+
hooks:
19+
- id: ruff
20+
args: [--fix, --exit-non-zero-on-fix]
1921
- repo: https://github.com/psf/black
20-
rev: "23.1.0"
22+
rev: 23.1.0
2123
hooks:
22-
- id: black
23-
- repo: https://github.com/pycqa/flake8
24-
rev: 6.0.0
24+
- id: black
25+
- repo: https://github.com/pre-commit/mirrors-mypy
26+
rev: v0.991
2527
hooks:
26-
- id: flake8
27-
language_version: python3
28+
- id: mypy
29+
files: ".*\\.py$"

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,7 @@ dev = [
2626

2727
[project.entry-points."xarray.backends"]
2828
stac = "xpystac.xarray_plugin:STACBackend"
29+
30+
[tool.ruff]
31+
line-length = 88
32+
select = ["E", "F", "W", "I"]

tests/cassettes/fixtures/simple_reference_file.yaml

Lines changed: 165 additions & 57 deletions
Large diffs are not rendered by default.

tests/cassettes/fixtures/simple_search.yaml

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,38 +11,42 @@ interactions:
1111
User-Agent:
1212
- python-requests/2.28.2
1313
method: GET
14-
uri: https://earth-search.aws.element84.com/v0
14+
uri: https://earth-search.aws.element84.com/v1
1515
response:
1616
body:
17-
string: '{"stac_version":"1.0.0-beta.2","stac_api_version":"0.9.0","id":"earth-search","title":"Earth
18-
Search","description":"A STAC API of AWS Public Datasets powered by stac-server","links":[{"rel":"child","href":"https://earth-search.aws.element84.com/v0/collections/sentinel-s2-l2a"},{"rel":"child","href":"https://earth-search.aws.element84.com/v0/collections/sentinel-s2-l1c"},{"rel":"child","href":"https://earth-search.aws.element84.com/v0/collections/sentinel-s2-l2a-cogs"},{"rel":"child","href":"https://earth-search.aws.element84.com/v0/collections/landsat-8-l1-c1"},{"rel":"service-desc","type":"application/vnd.oai.openapi+json;version=3.0","href":"https://earth-search.aws.element84.com/v0/api"},{"rel":"conformance","type":"application/json","href":"https://earth-search.aws.element84.com/v0/conformance"},{"rel":"children","type":"application/json","href":"https://earth-search.aws.element84.com/v0/collections"},{"rel":"self","type":"application/json","href":"https://earth-search.aws.element84.com/v0/"},{"rel":"search","type":"application/json","href":"https://earth-search.aws.element84.com/v0/search"},{"rel":"docs","href":"https://stac-utils.github.io/stac-server/"}]}'
17+
string: '{"stac_version":"1.0.0","type":"Catalog","id":"earth-search-aws","title":"Earth-Search
18+
AWS","description":"A STAC API of public datasets on AWS","links":[{"rel":"self","type":"application/json","href":"https://earth-search.aws.element84.com/v1"},{"rel":"root","type":"application/json","href":"https://earth-search.aws.element84.com/v1"},{"rel":"conformance","type":"application/json","href":"https://earth-search.aws.element84.com/v1/conformance"},{"rel":"data","type":"application/json","href":"https://earth-search.aws.element84.com/v1/collections"},{"rel":"search","type":"application/geo+json","href":"https://earth-search.aws.element84.com/v1/search","method":"GET"},{"rel":"search","type":"application/geo+json","href":"https://earth-search.aws.element84.com/v1/search","method":"POST"},{"rel":"aggregate","type":"application/json","href":"https://earth-search.aws.element84.com/v1/aggregate","method":"GET"},{"rel":"aggregations","type":"application/json","href":"https://earth-search.aws.element84.com/v1/aggregations"},{"rel":"service-desc","type":"application/vnd.oai.openapi","href":"https://earth-search.aws.element84.com/v1/api"},{"rel":"service-doc","type":"text/html","href":"https://earth-search.aws.element84.com/v1/api.html"},{"rel":"http://www.opengis.net/def/rel/ogc/1.0/queryables","type":"application/schema+json","href":"https://earth-search.aws.element84.com/v1/queryables"},{"rel":"server","type":"text/html","href":"https://stac-utils.github.io/stac-server/"},{"rel":"child","type":"application/geo+json","href":"https://earth-search.aws.element84.com/v1/collections/cop-dem-glo-30"},{"rel":"child","type":"application/geo+json","href":"https://earth-search.aws.element84.com/v1/collections/naip"},{"rel":"child","type":"application/geo+json","href":"https://earth-search.aws.element84.com/v1/collections/sentinel-2-l2a"},{"rel":"child","type":"application/geo+json","href":"https://earth-search.aws.element84.com/v1/collections/sentinel-2-l1c"},{"rel":"child","type":"application/geo+json","href":"https://earth-search.aws.element84.com/v1/collections/landsat-c2-l2"},{"rel":"child","type":"application/geo+json","href":"https://earth-search.aws.element84.com/v1/collections/cop-dem-glo-90"},{"rel":"child","type":"application/geo+json","href":"https://earth-search.aws.element84.com/v1/collections/sentinel-1-grd"}],"conformsTo":["https://api.stacspec.org/v1.0.0/core","https://api.stacspec.org/v1.0.0/collections","https://api.stacspec.org/v1.0.0/ogcapi-features","https://api.stacspec.org/v1.0.0/item-search","https://api.stacspec.org/v1.0.0-rc.3/ogcapi-features#fields","https://api.stacspec.org/v1.0.0-rc.2/ogcapi-features#sort","https://api.stacspec.org/v1.0.0-rc.2/ogcapi-features#query","https://api.stacspec.org/v1.0.0-rc.3/item-search#fields","https://api.stacspec.org/v1.0.0-rc.2/item-search#sort","https://api.stacspec.org/v1.0.0-rc.2/item-search#query","https://api.stacspec.org/v0.3.0/aggregation","http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/core","http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/oas30","http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/geojson"]}'
1919
headers:
20-
Access-Control-Allow-Credentials:
21-
- 'true'
22-
Access-Control-Allow-Origin:
23-
- '*'
2420
Connection:
2521
- keep-alive
2622
Content-Length:
27-
- '1180'
23+
- '3131'
2824
Content-Type:
29-
- application/json
25+
- application/json; charset=utf-8
3026
Date:
31-
- Fri, 24 Feb 2023 14:00:56 GMT
27+
- Wed, 14 Jun 2023 16:31:57 GMT
3228
Via:
33-
- 1.1 b4fecc0ccf7e0c6aa3eab83d70c5766c.cloudfront.net (CloudFront)
29+
- 1.1 0d3bc0372b2119705524079214a98b3e.cloudfront.net (CloudFront)
3430
X-Amz-Cf-Id:
35-
- aRQ9whW8xQDfRCiAkz8yXsApL7yIJauKHxLbONigmD_tgfPI5MurTg==
31+
- DQbi7xc6BgAPe9SM3zebAv-aYtRAak_8QRJrWQKGB9G-PqCro0cWWA==
3632
X-Amz-Cf-Pop:
3733
- EWR52-C2
3834
X-Amzn-Trace-Id:
39-
- Root=1-63f8c318-3c0a337a4a04985a0b3d99b0;Sampled=0
35+
- Root=1-6489eb7d-0ab1c2021e3f6bce4f294a5c;Sampled=0;lineage=9e2884e9:0
4036
X-Cache:
4137
- Miss from cloudfront
38+
access-control-allow-origin:
39+
- '*'
40+
etag:
41+
- W/"c3b-v7CpzZWq4m5R7IzejcSaa8UIyAI"
4242
x-amz-apigw-id:
43-
- A2Nr5HdjPHcF3ew=
43+
- GhG7tH0pPHcF3uA=
44+
x-amzn-Remapped-content-length:
45+
- '3131'
4446
x-amzn-RequestId:
45-
- f186aeb2-6a03-4649-aca8-e92a03efc730
47+
- 6e1291ed-cb44-429d-91d1-cbc60c070ab7
48+
x-powered-by:
49+
- Express
4650
status:
4751
code: 200
4852
message: OK

0 commit comments

Comments
 (0)