Skip to content

Commit e29e879

Browse files
authored
Merge pull request #125 from oceanmodeling/dev
Unify IOC/COOPS API
2 parents 5c4dd83 + 536ddbc commit e29e879

26 files changed

+3193
-855
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: "Test installation from PyPI"
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "4 5 * * *" # Every day at 05:04
7+
8+
jobs:
9+
test_pypi_installation:
10+
name: test PyPI installation
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
include:
15+
- os: "ubuntu-latest"
16+
python: "3.12"
17+
steps:
18+
- uses: actions/checkout@main
19+
- uses: actions/setup-python@main
20+
with:
21+
python-version: ${{ matrix.python }}
22+
# Debug
23+
- run: type -a python
24+
- run: python --version
25+
- run: python -m pip --version
26+
- run: python -m pip cache info
27+
# Install the package from pypi
28+
- run: python -m pip install searvey
29+
- run: python -m pip freeze
30+
# Checkout the version of code that got installed from PyPI
31+
- run: git fetch --tags
32+
- run: git checkout v$(python -c 'import importlib.metadata; print(importlib.metadata.version("searvey"))')
33+
# Install test dependencies
34+
- run: pip install -U $(cat requirements/requirements-dev.txt| grep --extended-regexp 'pytest=|pytest-recording=|urllib3=' | cut -d ';' -f1)
35+
# Remove the source code (just to be sure that it is not being used)
36+
- run: rm -rf searvey
37+
# Run the tests
38+
- run: make test

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ repos:
4141
- id: "shellcheck"
4242

4343
- repo: "https://github.com/python-jsonschema/check-jsonschema"
44-
rev: "0.28.3"
44+
rev: "0.28.5"
4545
hooks:
4646
- id: "check-github-workflows"
4747
- id: "check-readthedocs"
4848

4949
- repo: "https://github.com/asottile/reorder_python_imports"
50-
rev: "v3.12.0"
50+
rev: "v3.13.0"
5151
hooks:
5252
- id: "reorder-python-imports"
5353
args:
@@ -60,7 +60,7 @@ repos:
6060

6161
- repo: "https://github.com/charliermarsh/ruff-pre-commit"
6262
# Ruff version.
63-
rev: 'v0.4.4'
63+
rev: 'v0.4.9'
6464
hooks:
6565
- id: "ruff"
6666

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ clean_notebooks:
2727
pre-commit run nbstripout -a
2828

2929
exec_notebooks:
30-
python -m nbconvert --to notebook --execute --ExecutePreprocessor.kernel_name=python3 --stdout examples/* >/dev/null
30+
pytest --ff --nbmake --nbmake-timeout=90 --nbmake-kernel=python3 $$(git ls-files | grep ipynb)
3131

3232
docs:
3333
make -C docs html

docs/source/conf.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,17 @@ def repository_root(path: PathLike = None) -> Path:
7373
"sphinx.ext.autosummary",
7474
# The Napoleon extension allows for nicer argument formatting.
7575
"sphinx.ext.napoleon",
76+
"sphinx_autodoc_typehints",
7677
"sphinxext.opengraph",
7778
"m2r2",
7879
]
7980

81+
# sphinx_autodoc_typehints settings
82+
always_use_bars_union = True
83+
typehints_use_rtype = False
84+
typehints_use_signature = False
85+
typehints_use_signature_return = False
86+
8087
# Add any paths that contain templates here, relative to this directory.
8188
templates_path = ["_templates"]
8289

docs/source/coops.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,9 @@ CO-OPS query class
5555
The ``COOPS_Query`` class lets you send an individual query to the CO-OPS API by specifying a station, data product, and time interval.
5656

5757
.. autoclass:: searvey.coops.COOPS_Query
58+
59+
New API
60+
-------
61+
62+
.. autofunction:: searvey.get_coops_stations
63+
.. autofunction:: searvey.fetch_coops_station

docs/source/ioc.rst

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,15 @@ website is focused on operational monitoring of sea level measuring stations acr
66
`Intergovernmental Oceanographic Commission (IOC) <https://ioc.unesco.org>`_ aggregating data from more than 170 providers.
77

88

9-
A list of IOC stations is provided with the ``get_ioc_stations()`` function with various subsetting options.
9+
A DataFrame with the IOC station metadata can be retrieved with ``get_ioc_stations()``
10+
while the station data can be fetched with ``fetch_ioc_station()``:
1011

11-
.. autofunction:: searvey.ioc.get_ioc_stations
12+
.. autofunction:: searvey.get_ioc_stations
1213

13-
The station data can be retrieved with
1414

15-
.. autofunction:: searvey.ioc.get_ioc_data
15+
.. autofunction:: searvey.fetch_ioc_station
16+
17+
Deprecated API
18+
``````````````
19+
20+
.. autofunction:: searvey.get_ioc_data

0 commit comments

Comments
 (0)