Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions .binder/environment.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# SCM syntax highlighting & preventing 3-way merges
pixi.lock merge=binary linguist-language=YAML linguist-generated=true
gravity_toolkit/data/*.nc filter=lfs diff=lfs merge=lfs -text
5 changes: 2 additions & 3 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install build setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
python -m build
twine upload dist/*

33 changes: 9 additions & 24 deletions .github/workflows/python-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: [3.12]
os: [ubuntu-latest, macos-latest, windows-latest]
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
defaults:
run:
shell: bash -l {0}
Expand All @@ -33,34 +31,21 @@ jobs:
- uses: actions/checkout@v4
with:
lfs: true
- name: Set up mamba ${{ matrix.python-version }}
uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: 'latest'
environment-file: .binder/environment.yml
init-shell: bash
environment-name: gravity_toolkit
cache-environment: true
post-cleanup: 'all'
create-args: >-
python=${{ matrix.python-version }}
flake8
pytest
pytest-cov
cython
- name: Set up pixi environment
uses: prefix-dev/setup-pixi@v0.9.1
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
pixi run lint
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
pixi run lint "--exit-zero --max-complexity=10 --max-line-length=127"
- name: Test with pytest
run: |
pip install --no-deps .
pytest --verbose --capture=no --cov=./ --cov-report=xml \
# install the package in editable mode
pip install --no-deps --editable .
pixi run --environment dev pytest -n 0 --cov=./ --cov-report=xml \
--username=${{ secrets.EARTHDATA_USERNAME }} \
--password=${{ secrets.EARTHDATA_PASSWORD }} \
--webdav=${{ secrets.PODAAC_PASSWORD }}
--password=${{ secrets.EARTHDATA_PASSWORD }}
- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
Expand Down
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
*.gmtdefaults4
.RData
.Rhistory
octave-workspace
__pycache__
build/
_build/
Expand All @@ -40,7 +41,11 @@ wheels/
.installed.cfg
*.egg
.pytest_cache
.coverage
pythonenv*/
venv/
*build-commands.txt
setup-miniconda-patched-environment.yml
# OS generated files #
######################
.DS_Store
Expand All @@ -64,6 +69,7 @@ Thumbs.db
*.ilg
*.ind
*.ist
*.jats
*.lof
*.lot
*.nav
Expand All @@ -87,6 +93,11 @@ None*.png
#######################
.ipynb_checkpoints
Untitled.ipynb
core.*
# Large data files #
####################
*-complete.dat
# pixi environments #
#####################
.pixi/*
!.pixi/config.toml
4 changes: 2 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ graft gravity_toolkit/data
prune .github*
prune doc*
prune notebooks*
prune run*
prune test*
exclude *.cfg
exclude *.yml
include requirements.txt
include version.txt
1 change: 0 additions & 1 deletion doc/source/api_reference/utilities.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Download and management utilities for syncing time and auxiliary files

- Can list a directory on a ftp host
- Can download a file from a ftp or http host
- Can download a file from PO.DAAC via https when WebDAV credentials are supplied
- Checks ``MD5`` or ``sha1`` hashes between local and remote files

`Source code`__
Expand Down
38 changes: 38 additions & 0 deletions doc/source/getting_started/Install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ The simplest installation for most users will likely be using ``conda`` or ``mam

conda update gravity-toolkit

Development Install
###################

To use the development repository, please fork ``gravity-toolkit`` into your own account and then clone onto your system:

.. code-block:: bash
Expand All @@ -31,8 +34,43 @@ To use the development repository, please fork ``gravity-toolkit`` into your own

python3 -m pip install --user .

To include all optional dependencies:

.. code-block:: bash

python3 -m pip install --user .[all]

The development version of ``gravity-toolkit`` can also be installed directly from GitHub using ``pip``:

.. code-block:: bash

python3 -m pip install --user git+https://github.com/tsutterley/gravity-toolkit.git

Package Management with ``pixi``
################################

Alternatively ``pixi`` can be used to create a `streamlined environment <https://pixi.sh/>`_ after cloning the repository:

.. code-block:: bash

pixi install

``pixi`` maintains isolated environments for each project, allowing for different versions of
``gravity-toolkit`` and its dependencies to be used without conflict. The ``pixi.lock`` file within the
repository defines the required packages and versions for the environment.

``pixi`` can also create shells for running programs within the environment:

.. code-block:: bash

pixi shell

To see the available tasks within the ``gravity-toolkit`` workspace:

.. code-block:: bash

pixi task list

.. note::

``pixi`` is under active development and may change in future releases
1 change: 1 addition & 0 deletions doc/source/project/Citations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ This software is also dependent on other commonly used Python packages:
Disclaimer
##########

This work is currently supported by the NASA GRACE-FO Science Team (Grant Number 80NSSC24K1153).
This program is not sponsored or maintained by the Universities Space Research Association (USRA),
the Center for Space Research at the University of Texas (UTCSR),
the Jet Propulsion Laboratory (JPL),
Expand Down
42 changes: 41 additions & 1 deletion doc/source/project/Testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,61 @@ Testing
=======

``gravity-toolkit`` uses the ``pytest`` framework to run tests and verify outputs.
Running the test suite requires a `dev installation <../getting_started/Install.html>`_ of the ``gravity-toolkit`` package to include all of the optional dependencies.

.. code-block:: bash

python -m pip install --editable '.[dev]'

Running the Test Suite
^^^^^^^^^^^^^^^^^^^^^^

Using the ``pytest`` command:

.. code-block:: bash

pytest --directory <path_to_tide_models> test/

Using ``pixi``:

.. code-block:: bash

pixi run test "--directory <path_to_tide_models>"

The test suite is run in verbose mode as a default.

Coverage Reports
^^^^^^^^^^^^^^^^

Coverage reports can be generated using the ``pytest-cov`` plugin (which is installed with the dev installation).

.. code-block:: bash

pytest --cov pyTMD --cov-report=term

.. code-block:: bash

pixi run test "--cov ../gravity-toolkit --cov-report=term"

Parallelization
^^^^^^^^^^^^^^^

As a default, the ``pytest`` suite is run in parallel using the ``pytest-xdist`` plugin (which is also installed with the dev installation).
To run in series and disable parallelization, set the number of processes to 0:

.. code-block:: bash

pytest -n 0

.. code-block:: bash

pixi run test "-n 0"

Continuous Integration
^^^^^^^^^^^^^^^^^^^^^^
We use `GitHub Actions <https://github.com/tsutterley/gravity-toolkit/actions>`_ continuous integration (CI) services to build and test the project on Linux (``ubuntu-latest``), Mac (``macos-latest``) and Windows (``windows-latest``) Operating Systems.
The configuration files for this service are in the `GitHub workflows <https://github.com/tsutterley/gravity-toolkit/tree/main/.github/workflows>`_ directory.
The workflows use ``mamba`` and the `environment.yml <https://github.com/tsutterley/gravity-toolkit/blob/main/environment.yml>`_ file to install the required dependencies and build the environment.
The workflows use ``pixi`` to install the required dependencies and build the custom environment.

The GitHub Actions jobs include:

Expand Down
6 changes: 3 additions & 3 deletions gravity_toolkit/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@ def get_token(
password: str or NoneType, default None
NASA Earthdata password
build: bool, default True
Build opener and check WebDAV credentials
Build opener and check credentials
timeout: int or NoneType, default None
timeout in seconds for blocking operations
context: obj, default gravity_toolkit.utilities._default_ssl_context
Expand Down Expand Up @@ -1093,7 +1093,7 @@ def list_tokens(
password: str or NoneType, default None
NASA Earthdata password
build: bool, default True
Build opener and check WebDAV credentials
Build opener and check credentials
timeout: int or NoneType, default None
timeout in seconds for blocking operations
context: obj, default gravity_toolkit.utilities._default_ssl_context
Expand Down Expand Up @@ -1153,7 +1153,7 @@ def revoke_token(
password: str or NoneType, default None
NASA Earthdata password
build: bool, default True
Build opener and check WebDAV credentials
Build opener and check credentials
timeout: int or NoneType, default None
timeout in seconds for blocking operations
context: obj, default gravity_toolkit.utilities._default_ssl_context
Expand Down
Loading