Skip to content

Commit

Permalink
Merge branch 'development' into extract-urls-module
Browse files Browse the repository at this point in the history
  • Loading branch information
mfisher87 authored Aug 29, 2024
2 parents 2dc7e78 + bd09d73 commit f63f1f0
Show file tree
Hide file tree
Showing 37 changed files with 225 additions and 109 deletions.
19 changes: 19 additions & 0 deletions .github/actions/install-icepyx/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: 'Install icepyx'
description: 'Install icepyx and dev dependencies'

inputs:
python-version:
required: true

runs:
using: "composite"
steps:
- uses: "actions/setup-python@v5"
with:
python-version: "${{ inputs.python-version }}"

- name: "Install package and test dependencies"
shell: "bash"
run: |
python -m pip install .
python -m pip install -r requirements-dev.txt
53 changes: 53 additions & 0 deletions .github/workflows/integration_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: "Integration test"
# NOTE: We're just running the tests that require earthdata login here; we
# don't distinguish between unit and integration tests yet.

on:
push:
branches:
- "main" # Releases
- "development" # PR merges
pull_request:
branches:
- "main" # Release pull requests
pull_request_review:
types:
- "submitted"
paths:
- ".github/**"
- "icepyx/**/*.py"
- "pyproject.toml"
- "requirements*.txt"


jobs:
test:
name: "Integration test"
# Job is conditional:
# - Do not run on PRs from forks
# - Do not run on `pull_request_review` events unless the PR is approved.
if: "${{ !github.event.pull_request.head.repo.fork && (github.event.action != 'pull_request_review' || github.event.review.state == 'approved') }}"
runs-on: "ubuntu-latest"

steps:
- uses: "actions/checkout@v4"
with:
fetch-depth: 0

- uses: "./.github/actions/install-icepyx"
with:
python-version: "3.12"

- name: "Run tests"
env:
EARTHDATA_PASSWORD: "${{ secrets.EARTHDATA_PASSWORD }}"
NSIDC_LOGIN: "${{ secrets.EARTHDATA_PASSWORD }}"
run: |
pytest icepyx/ --verbose --cov app \
icepyx/tests/test_behind_NSIDC_API_login.py \
icepyx/tests/test_auth.py
- name: "Upload coverage report"
uses: "codecov/[email protected]"
with:
token: "${{ secrets.CODECOV_TOKEN }}"
40 changes: 40 additions & 0 deletions .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: "Unit test"
# NOTE: We're just skipping the tests requiring earthdata login here; we don't
# distinguish yet between unit and integration tests.

on:
pull_request:
push:
branches:
- "main"
- "development"


jobs:
test:
name: "Unit test (Python ${{ matrix.python-version }})"
runs-on: "ubuntu-latest"
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.12"] #NOTE: min and max Python versions supported by icepyx

steps:
- uses: "actions/checkout@v4"
with:
fetch-depth: 0

- uses: "./.github/actions/install-icepyx"
with:
python-version: "${{ matrix.python-version }}"

- name: "Run tests"
run: |
pytest icepyx/ --verbose --cov app \
--ignore=icepyx/tests/test_behind_NSIDC_API_login.py \
--ignore=icepyx/tests/test_auth.py
- name: "Upload coverage report"
uses: "codecov/[email protected]"
with:
token: "${{ secrets.CODECOV_TOKEN }}"
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,17 @@ repos:
- id: check-yaml
- id: check-added-large-files
args: ["--maxkb=5000"]
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: debug-statements
- id: name-tests-test
args: ["--pytest-test-first"]
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
- id: requirements-txt-fixer

- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
Expand Down
44 changes: 0 additions & 44 deletions .travis.yml

This file was deleted.

18 changes: 12 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ icepyx

|JOSS| |Zenodo-all|

Latest release (main branch): |Docs Status main| |Travis main Build Status| |Code Coverage main|
Latest release (main branch): |Docs Status main| |Unit Tests Status (main)| |Integration Tests Status (main)| |Code Coverage main|

Current development version (development branch): |Docs Status dev| |Travis dev Build Status| |Code Coverage dev| |Pre-commit dev|
Current development version (development branch): |Docs Status dev| |Unit Tests Status (dev)| |Integration Tests Status (main)| |Code Coverage dev| |Pre-commit dev|

.. |GitHub license| image:: https://img.shields.io/badge/License-BSD%203--Clause-blue.svg
:target: https://opensource.org/licenses/BSD-3-Clause
Expand Down Expand Up @@ -38,11 +38,17 @@ Current development version (development branch): |Docs Status dev| |Travis dev
.. |Docs Status dev| image:: https://readthedocs.org/projects/icepyx/badge/?version=development
:target: https://icepyx.readthedocs.io/en/development

.. |Travis main Build Status| image:: https://app.travis-ci.com/icesat2py/icepyx.svg?branch=main
:target: https://app.travis-ci.com/icesat2py/icepyx
.. |Unit Tests Status (main)| image:: https://github.com/icesat2py/icepyx/actions/workflows/unit_test.yml/badge.svg?branch=main
:target: https://github.com/icesat2py/icepyx/actions/workflows/unit_test.yml

.. |Travis dev Build Status| image:: https://app.travis-ci.com/icesat2py/icepyx.svg?branch=development
:target: https://app.travis-ci.com/icesat2py/icepyx
.. |Integration Tests Status (main)| image:: https://github.com/icesat2py/icepyx/actions/workflows/integration_test.yml/badge.svg?branch=main
:target: https://github.com/icesat2py/icepyx/actions/workflows/integration_test.yml

.. |Unit Tests Status (dev)| image:: https://github.com/icesat2py/icepyx/actions/workflows/unit_test.yml/badge.svg?branch=development
:target: https://github.com/icesat2py/icepyx/actions/workflows/unit_test.yml

.. |Integration Tests Status (dev)| image:: https://github.com/icesat2py/icepyx/actions/workflows/integration_test.yml/badge.svg?branch=development
:target: https://github.com/icesat2py/icepyx/actions/workflows/integration_test.yml

.. |Code Coverage main| image:: https://codecov.io/gh/icesat2py/icepyx/branch/main/graph/badge.svg
:target: https://codecov.io/gh/icesat2py/icepyx
Expand Down
4 changes: 1 addition & 3 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import icepyx


# -- Project information -----------------------------------------------------

project = "icepyx"
Expand Down Expand Up @@ -120,10 +119,9 @@ def setup(app):

# this should possibly be moved to the sphinxext directory as a standalone .py file
# -- custom style for pybtex output -------------------------------------------
from pybtex.style.formatting.unsrt import Style as UnsrtStyle

# from pybtex.style.labels.alpha import LabelStyle as AlphaLabelStyle
from pybtex.plugin import register_plugin
from pybtex.style.formatting.unsrt import Style as UnsrtStyle

# I seem to be unable to figure out how to control what is used for the label. It would
# make sense if it were fed into this function, which then just formatted it, but I can't figure out from where
Expand Down
3 changes: 2 additions & 1 deletion doc/source/tracking/pypistats/get_pypi_stats.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import pypistats

import pandas as pd
import pypistats

cwd = os.getcwd()

Expand Down
3 changes: 2 additions & 1 deletion doc/source/tracking/traffic/traffic_data_mgmt.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import matplotlib.pyplot as plt
import os

import matplotlib.pyplot as plt
import pandas as pd

cwd = os.getcwd()
Expand Down
Empty file modified doc/sphinxext/announce.py
100644 → 100755
Empty file.
8 changes: 4 additions & 4 deletions icepyx/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from icepyx.core.query import Query, GenQuery
from _icepyx_version import version as __version__

from icepyx.core.query import GenQuery, Query
from icepyx.core.read import Read
from icepyx.quest.quest import Quest
from icepyx.core.variables import Variables

from _icepyx_version import version as __version__
from icepyx.quest.quest import Quest
3 changes: 2 additions & 1 deletion icepyx/conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import icepyx
import pytest

import icepyx


@pytest.fixture(autouse=True)
def add_ipx(doctest_namespace):
Expand Down
13 changes: 9 additions & 4 deletions icepyx/core/APIformatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import datetime as dt


# ----------------------------------------------------------------------
# parameter-specific formatting for display
# or input to a set of API parameters (CMR or NSIDC)
Expand Down Expand Up @@ -122,14 +121,17 @@ def combine_params(*param_dicts):
"""
Combine multiple dictionaries into one.
Merging is performed in sequence using `dict.update()`; dictionaries later in the
list overwrite those earlier.
Parameters
----------
params : dictionaries
Unlimited number of dictionaries to combine
Returns
-------
single dictionary of all input dictionaries combined
A single dictionary of all input dictionaries combined
Examples
--------
Expand Down Expand Up @@ -209,7 +211,7 @@ def __init__(self, partype, values=None, reqtype=None):
"CMR",
"required",
"subset",
], "You need to submit a valid parametery type."
], "You need to submit a valid parameter type."
self.partype = partype

if partype == "required":
Expand Down Expand Up @@ -411,7 +413,10 @@ def build_params(self, **kwargs):

for key in opt_keys:
if key == "Coverage" and key in kwargs:
# DevGoal: make there be an option along the lines of Coverage=default, which will get the default variables for that product without the user having to input is2obj.build_wanted_wanted_var_list as their input value for using the Coverage kwarg
# DevGoal: make an option along the lines of Coverage=default,
# which will get the default variables for that product without
# the user having to input is2obj.build_wanted_wanted_var_list
# as their input value for using the Coverage kwarg
self._fmted_keys.update(
{key: _fmt_var_subset_list(kwargs[key])}
)
Expand Down
3 changes: 1 addition & 2 deletions icepyx/core/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import datetime

import earthaccess

from icepyx.core.exceptions import DeprecationError


Expand All @@ -10,8 +11,6 @@ class AuthenticationError(Exception):
Raised when an error is encountered while authenticating Earthdata credentials
"""

pass


class EarthdataAuthMixin:
"""
Expand Down
4 changes: 0 additions & 4 deletions icepyx/core/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,12 @@ class DeprecationError(Exception):
Class raised for use of functionality that is no longer supported by icepyx.
"""

pass


class QueryError(Exception):
"""
Base class for Query object exceptions
"""

pass


class NsidcQueryError(QueryError):
"""
Expand Down
9 changes: 5 additions & 4 deletions icepyx/core/granules.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import datetime
import requests
import time
import io
import re
import json
import numpy as np
import os
import pprint
import re
import time
from xml.etree import ElementTree as ET
import zipfile

import numpy as np
import requests

import icepyx.core.APIformatting as apifmt
from icepyx.core.auth import EarthdataAuthMixin
import icepyx.core.exceptions
Expand Down
6 changes: 3 additions & 3 deletions icepyx/core/is2ref.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import h5py
import json
import numpy as np
import requests
import warnings
from xml.etree import ElementTree as ET

import earthaccess

from icepyx.core.urls import COLLECTION_SEARCH_BASE_URL, EGI_BASE_URL

import h5py
import numpy as np
import requests

# ICESat-2 specific reference functions

Check failure on line 13 in icepyx/core/is2ref.py

View workflow job for this annotation

GitHub Actions / lint

Ruff (I001)

icepyx/core/is2ref.py:1:1: I001 Import block is un-sorted or un-formatted

Expand Down
Loading

0 comments on commit f63f1f0

Please sign in to comment.