Skip to content

Commit 4ad3c60

Browse files
authored
Merge pull request #179 from icesat2py/development
Release v0.3.3
2 parents 8b8bdb9 + 08546a0 commit 4ad3c60

File tree

18 files changed

+124
-35
lines changed

18 files changed

+124
-35
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Publish archives to PyPI and TestPyPI using GitHub Actions
2+
name: Publish to PyPI
3+
4+
# Only run for tagged releases and pushes to the development branch
5+
on:
6+
release:
7+
types:
8+
- published
9+
push:
10+
branches:
11+
- development
12+
# Trigger manually at https://github.com/icesat2py/icepyx/actions/workflows/publish_to_pypi.yml
13+
workflow_dispatch:
14+
15+
jobs:
16+
publish-pypi:
17+
name: Publish to PyPI
18+
runs-on: ubuntu-latest
19+
if: github.repository == 'icesat2py/icepyx'
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v2.3.4
24+
with:
25+
# fetch all history so that setuptools-scm works
26+
fetch-depth: 0
27+
28+
- name: Set up Python
29+
uses: actions/setup-python@v2.2.1
30+
with:
31+
python-version: 3.9
32+
33+
- name: Install dependencies
34+
run: python -m pip install setuptools wheel
35+
36+
# This step is only necessary for testing purposes and for TestPyPI
37+
- name: Fix up version string for TestPyPI
38+
if: ${{ !startsWith(github.ref, 'refs/tags') }}
39+
run: |
40+
# Change setuptools-scm local_scheme to "no-local-version" so the
41+
# local part of the version isn't included, making the version string
42+
# compatible with PyPI.
43+
sed --in-place "s/node-and-date/no-local-version/g" setup.py
44+
45+
- name: Build source and wheel distributions
46+
run: |
47+
python setup.py sdist bdist_wheel
48+
echo ""
49+
echo "Generated files:"
50+
ls -lh dist/
51+
52+
- name: Publish to Test PyPI
53+
uses: pypa/gh-action-pypi-publish@v1.4.2
54+
with:
55+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
56+
repository_url: https://test.pypi.org/legacy/
57+
58+
- name: Publish to PyPI
59+
if: startsWith(github.ref, 'refs/tags')
60+
uses: pypa/gh-action-pypi-publish@v1.4.2
61+
with:
62+
password: ${{ secrets.PYPI_API_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ wheels/
2424
.installed.cfg
2525
*.egg
2626
MANIFEST
27+
_icepyx_version.py
2728

2829
# PyInstaller
2930
# Usually these files are written by a python script from a template

.travis.yml

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,3 @@ jobs:
2121
# script:
2222
# - export NSIDC_LOGIN=$NSIDC_LOGIN
2323
# - pytest icepyx/tests/behind_NSIDC_API_login.py
24-
25-
deploy:
26-
- provider: pypi
27-
server: https://test.pypi.org/legacy/
28-
username: "__token__"
29-
password: $test_PyPI_API_Token
30-
on:
31-
branch: development
32-
if: commit_message =~ test_pypi
33-
skip_existing: true
34-
distributions: "sdist bdist_wheel"
35-
36-
# NOTE: the API token on Travis must be set to ALL branches, because a tag build is not considered to be on the master branch: https://travis-ci.community/t/pypi-upload-with-api-token-not-working/5338/5
37-
- provider: pypi
38-
username: "__token__"
39-
password: $PyPI_API_Token
40-
on:
41-
branch: master
42-
tags: true
43-
skip_existing: true
44-
distributions: "sdist bdist_wheel"

CONTRIBUTORS.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@ order by last name) and are considered "The icepyx Developers":
2323
* `Ben Smith <https://github.com/smithb>`_ - University of Washington
2424
* `Amy Steiker <https://github.com/asteiker>`_ - NSIDC, University of Colorado
2525
* `Anna Valentine <https://github.com/annavalentine>`_ - Colorado School of Mines
26+
* `Bruce Wallin <https://github.com/wallinb>`_ - NSIDC, University of Colorado
2627
* `Molly Wieringa <https://github.com/mollymwieringa>`_ - University of Washington
2728
* `Bidhyananda Yadav <https://github.com/bidhya>`_ - Ohio State University

MANIFEST.in

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
prune .github*
2+
prune doc*
3+
prune examples*
4+
prune icepyx/tests*
5+
exclude .coveragerc
6+
exclude .gitignore
7+
exclude .mailmap
8+
exclude *.ini
9+
exclude *.txt
10+
exclude *.yaml
11+
exclude *.yml
12+
include requirements.txt

doc/source/conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@
5858
# location of master document (by default sphinx looks for contents.rst)
5959
master_doc = "index"
6060

61+
# bibtex file
62+
bibtex_bibfiles = ["tracking/icepyx_pubs.bib"]
6163

6264
# -- Configuration options ---------------------------------------------------
6365
autosummary_generate = True

icepyx/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
from icepyx.core.query import Query
2+
3+
from _icepyx_version import version as __version__

icepyx/core/APIformatting.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ def _get_possible_keys(self):
251251
"token",
252252
"email",
253253
"include_meta",
254+
"client_string",
254255
],
255256
}
256257
elif self.partype == "subset":
@@ -341,7 +342,7 @@ def build_params(self, **kwargs):
341342
are time, bbox OR Boundingshape, format, projection, projection_parameters, and Coverage.
342343
343344
Keyword argument inputs for 'CMR' may include: dataset, version, start, end, extent_type, spatial_extent
344-
Keyword argument inputs for 'required' may include: page_size, page_num, request_mode, include_meta
345+
Keyword argument inputs for 'required' may include: page_size, page_num, request_mode, include_meta, client_string
345346
Keyword argument inputs for 'subset' may include: geom_filepath, start, end, extent_type, spatial_extent
346347
347348
"""
@@ -352,7 +353,7 @@ def build_params(self, **kwargs):
352353
self._check_valid_keys()
353354

354355
if self.partype == "required":
355-
if self.check_req_values == True and kwargs == {}:
356+
if self.check_req_values() and kwargs == {}:
356357
pass
357358
else:
358359
reqkeys = self.poss_keys[self._reqtype]
@@ -361,6 +362,7 @@ def build_params(self, **kwargs):
361362
"page_num": 1,
362363
"request_mode": "async",
363364
"include_meta": "Y",
365+
"client_string": "icepyx"
364366
}
365367
for key in reqkeys:
366368
if key in kwargs:

icepyx/core/Earthdata.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,13 @@ def __init__(
4545
def _start_session(self):
4646
# Request CMR token using Earthdata credentials
4747
token_api_url = "https://cmr.earthdata.nasa.gov/legacy-services/rest/tokens"
48-
hostname = socket.gethostname()
49-
ip = socket.gethostbyname(hostname)
5048
# try initially with machine hostname
5149
# revert to using localhost if gaierror exception
5250
try:
5351
ip = socket.gethostbyname(socket.gethostname())
5452
except:
5553
ip = socket.gethostbyname("localhost")
5654

57-
5855
data = {
5956
"token": {
6057
"username": self.uid,
@@ -66,7 +63,7 @@ def _start_session(self):
6663

6764
response = None
6865
response = requests.post(
69-
token_api_url, json=data, headers={"Accept": "application/json"}
66+
token_api_url, json=data, headers={"Accept": "application/json", "Client-Id": "icepyx"}
7067
)
7168

7269
# check for a valid login

icepyx/core/granules.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def get_avail(self, CMRparams, reqparams):
148148

149149
granule_search_url = "https://cmr.earthdata.nasa.gov/search/granules"
150150

151-
headers = {"Accept": "application/json"}
151+
headers = {"Accept": "application/json", "Client-Id": "icepyx"}
152152
# DevGoal: check the below request/response for errors and show them if they're there; then gather the results
153153
# note we should also do this whenever we ping NSIDC-API - make a function to check for errors
154154
while True:

0 commit comments

Comments
 (0)