Skip to content

Commit 58d3f48

Browse files
authored
Merge pull request #9 from nasa/release/0.7.0
Release/0.7.0
2 parents c11485d + d7d7597 commit 58d3f48

File tree

14 files changed

+596
-132
lines changed

14 files changed

+596
-132
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -38,34 +38,34 @@ jobs:
3838
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
3939

4040
steps:
41-
- name: Checkout repository
42-
uses: actions/checkout@v2
41+
- name: Checkout repository
42+
uses: actions/checkout@v2
4343

44-
# Initializes the CodeQL tools for scanning.
45-
- name: Initialize CodeQL
46-
uses: github/codeql-action/init@v1
47-
with:
48-
languages: ${{ matrix.language }}
49-
# If you wish to specify custom queries, you can do so here or in a config file.
50-
# By default, queries listed here will override any specified in a config file.
51-
# Prefix the list here with "+" to use these queries and those in the config file.
52-
# queries: ./path/to/local/query, your-org/your-repo/queries@main
44+
# Initializes the CodeQL tools for scanning.
45+
- name: Initialize CodeQL
46+
uses: github/codeql-action/init@v1
47+
with:
48+
languages: ${{ matrix.language }}
49+
# If you wish to specify custom queries, you can do so here or in a config file.
50+
# By default, queries listed here will override any specified in a config file.
51+
# Prefix the list here with "+" to use these queries and those in the config file.
52+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
5353

54-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
55-
# If this step fails, then you should remove it and run the build manually (see below)
56-
- name: Autobuild
57-
uses: github/codeql-action/autobuild@v1
54+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
55+
# If this step fails, then you should remove it and run the build manually (see below)
56+
- name: Autobuild
57+
uses: github/codeql-action/autobuild@v1
5858

59-
# ℹ️ Command-line programs to run using the OS shell.
60-
# 📚 https://git.io/JvXDl
59+
# ℹ️ Command-line programs to run using the OS shell.
60+
# 📚 https://git.io/JvXDl
6161

62-
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
63-
# and modify them (or add more) to build your code if your project
64-
# uses a compiled language
62+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
63+
# and modify them (or add more) to build your code if your project
64+
# uses a compiled language
6565

66-
#- run: |
67-
# make bootstrap
68-
# make release
66+
#- run: |
67+
# make bootstrap
68+
# make release
6969

70-
- name: Perform CodeQL Analysis
71-
uses: github/codeql-action/analyze@v1
70+
- name: Perform CodeQL Analysis
71+
uses: github/codeql-action/analyze@v1

.github/workflows/python-app.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# This workflow will install Python dependencies, run tests and lint with a single version of Python
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: Python application
5+
6+
on:
7+
push:
8+
branches: [ develop ]
9+
pull_request:
10+
branches: [ develop ]
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Set up Python 3.10
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: "3.10"
23+
- name: Install Poetry
24+
uses: abatilo/[email protected]
25+
with:
26+
poetry-version: 1.1.11
27+
- name: Install dependencies
28+
run: |
29+
poetry run python -m pip install --upgrade pip
30+
poetry install
31+
- name: Lint with flake8
32+
run: |
33+
# stop the build if there are Python syntax errors or undefined names
34+
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
35+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
36+
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
37+
- name: Test with pytest
38+
run: |
39+
poetry run pytest

.github/workflows/python-publish.yml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,27 @@ name: Upload Python Package
1010

1111
on:
1212
release:
13-
types: [published]
13+
types: [ published ]
1414

1515
jobs:
1616
deploy:
1717

1818
runs-on: ubuntu-latest
1919

2020
steps:
21-
- uses: actions/checkout@v2
22-
- name: Set up Python
23-
uses: actions/setup-python@v2
24-
with:
25-
python-version: '3.x'
26-
- name: Install dependencies
27-
run: |
28-
python -m pip install --upgrade pip
29-
pip install build
30-
- name: Build package
31-
run: python -m build
32-
- name: Publish package
33-
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
34-
with:
35-
user: __token__
36-
password: ${{ secrets.POETRY_PYPI_TOKEN_PYPI }}
21+
- uses: actions/checkout@v2
22+
- name: Set up Python
23+
uses: actions/setup-python@v2
24+
with:
25+
python-version: '3.x'
26+
- name: Install Poetry
27+
uses: abatilo/[email protected]
28+
with:
29+
poetry-version: 1.1.11
30+
- name: Build package
31+
run: poetry build
32+
- name: Publish to pypi.org
33+
env:
34+
POETRY_PYPI_TOKEN_PYPI: ${{secrets.POETRY_PYPI_TOKEN_PYPI}}
35+
run: |
36+
poetry publish

CHANGELOG.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
# Changelog
2+
23
All notable changes to this project will be documented in this file.
34

4-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres
6+
to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
67

78
## [Unreleased]
89

10+
11+
## [0.7.0]
12+
### Added
13+
- New workflow that runs lint and test
14+
- New function `Query.token` to add an auth token to the request sent to CMR
15+
### Changed
16+
- Now building with [poetry](https://python-poetry.org/)
17+
918
## [0.6.0]
1019
### Added
1120
- New support for querying variables (UMM-V)
@@ -22,7 +31,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2231
## [Older]
2332
- Prior releases of this software originated from https://github.com/jddeal/python-cmr/releases
2433

25-
[Unreleased]: https://github.com/nasa/python_cmr/compare/v0.6.0...HEAD
34+
[Unreleased]: https://github.com/nasa/python_cmr/compare/v0.7.0...HEAD
35+
[0.7.0]: https://github.com/nasa/python_cmr/compare/v0.6.0...0.7.0
2636
[0.6.0]: https://github.com/nasa/python_cmr/compare/v0.5.0...v0.6.0
2737
[0.5.0]: https://github.com/nasa/python_cmr/compare/ef0f9e7d67ce99d342a568bd6a098c3462df16d2...v0.5.0
2838
[Older]: https://github.com/jddeal/python-cmr/releases

README.md

Lines changed: 82 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
This repository is a copy of [jddeal/python_cmr](https://github.com/jddeal/python-cmr/tree/ef0f9e7d67ce99d342a568bd6a098c3462df16d2) which is no longer maintained. It has been copied here with the permission of the original author for the purpose of continuing to develop a python library that can be used for CMR access.
1+
This repository is a copy
2+
of [jddeal/python_cmr](https://github.com/jddeal/python-cmr/tree/ef0f9e7d67ce99d342a568bd6a098c3462df16d2) which is no
3+
longer maintained. It has been copied here with the permission of the original author for the purpose of continuing to
4+
develop a python library that can be used for CMR access.
25

36
----
47

@@ -7,7 +10,10 @@ Python CMR
710

811
[![CodeQL](https://github.com/nasa/python_cmr/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/nasa/python_cmr/actions/workflows/codeql-analysis.yml)
912

10-
Python CMR is an easy to use wrapper to the NASA EOSDIS [Common Metadata Repository API](https://cmr.earthdata.nasa.gov/search/). This package aims to make querying the API intuitive and less error-prone by providing methods that will preemptively check for invalid input and handle the URL encoding the CMR API expects.
13+
Python CMR is an easy to use wrapper to the NASA
14+
EOSDIS [Common Metadata Repository API](https://cmr.earthdata.nasa.gov/search/). This package aims to make querying the
15+
API intuitive and less error-prone by providing methods that will preemptively check for invalid input and handle the
16+
URL encoding the CMR API expects.
1117

1218
Getting access to NASA's earth science metadata is as simple as this:
1319

@@ -47,7 +53,9 @@ To install from github, perhaps to try out the dev branch:
4753
Examples
4854
========
4955

50-
This library is broken into two classes, CollectionQuery and GranuleQuery. Each of these classes provide a large set of methods used to build a query for CMR. Not all parameters provided by the CMR API are covered by this version of python-cmr.
56+
This library is broken into two classes, CollectionQuery and GranuleQuery. Each of these classes provide a large set of
57+
methods used to build a query for CMR. Not all parameters provided by the CMR API are covered by this version of
58+
python-cmr.
5159

5260
The following methods are available to both collecton and granule queries:
5361

@@ -171,7 +179,8 @@ Variable searches support the following methods
171179
# Search via concept_id
172180
>>> api.concept_id('V2112019824-POCLOUD')
173181

174-
As an alternative to chaining methods together to set the parameters of your query, a method exists to allow you to pass your parameters as keyword arguments:
182+
As an alternative to chaining methods together to set the parameters of your query, a method exists to allow you to pass
183+
your parameters as keyword arguments:
175184

176185
# search for AST_L1T version 003 granules at latitude 42, longitude -100
177186
>>> api.parameters(
@@ -180,7 +189,8 @@ As an alternative to chaining methods together to set the parameters of your que
180189
point=(-100, 42)
181190
)
182191

183-
Note: the kwarg key should match the name of a method from the above examples, and the value should be a tuple if it's a parameter that requires multiple values.
192+
Note: the kwarg key should match the name of a method from the above examples, and the value should be a tuple if it's a
193+
parameter that requires multiple values.
184194

185195
To inspect and retreive results from the API, the following methods are available:
186196

@@ -196,26 +206,78 @@ To inspect and retreive results from the API, the following methods are availabl
196206
# retrieve all the granules possible for the query
197207
>>> granules = api.get_all() # this is a shortcut for api.get(api.hits())
198208

199-
By default the responses will return as json and be accessible as a list of python dictionaries. Other formats can be specified before making the request:
209+
By default the responses will return as json and be accessible as a list of python dictionaries. Other formats can be
210+
specified before making the request:
200211

201212
>>> granules = api.format("echo10").get(100)
202213

203214
The following formats are supported for both granule and collection queries:
204215

205-
- json (default)
206-
- xml
207-
- echo10
208-
- iso
209-
- iso19115
210-
- csv
211-
- atom
212-
- kml
213-
- native
216+
- json (default)
217+
- xml
218+
- echo10
219+
- iso
220+
- iso19115
221+
- csv
222+
- atom
223+
- kml
224+
- native
214225

215226
Collection queries also support the following formats:
216227

217-
- dif
218-
- dif10
219-
- opendata
220-
- umm\_json
221-
- umm\_json\_vX\_Y (ex: umm\_json\_v1\_9)
228+
- dif
229+
- dif10
230+
- opendata
231+
- umm\_json
232+
- umm\_json\_vX\_Y (ex: umm\_json\_v1\_9)
233+
234+
# Developing
235+
236+
python-cmr uses the [poetry](https://python-poetry.org/) build system. Download and install poetry before starting
237+
development
238+
239+
## Install Dependencies
240+
241+
With dev dependencies:
242+
```shell
243+
poetry install
244+
```
245+
246+
Without dev dependencies:
247+
```shell
248+
poetry install --no-dev
249+
```
250+
251+
## Update Dependencies
252+
253+
```shell
254+
poetry update
255+
```
256+
257+
## Add new Dependency
258+
259+
```shell
260+
poetry add requests
261+
```
262+
Development-only dependency:
263+
```shell
264+
poetry add --dev pytest
265+
```
266+
267+
## Build project
268+
269+
```shell
270+
poetry build
271+
```
272+
273+
## Lint project
274+
275+
```shell
276+
poetry run flake8
277+
```
278+
279+
## Run Tests
280+
281+
```shell
282+
poetry run pytest
283+
```

0 commit comments

Comments
 (0)