Skip to content

Commit fb8bb57

Browse files
authored
ci: use pixi for builds (#167)
docs: use pixi for builds
1 parent 9c7df52 commit fb8bb57

16 files changed

Lines changed: 12852 additions & 135 deletions

File tree

.binder/environment.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
# SCM syntax highlighting & preventing 3-way merges
2+
pixi.lock merge=binary linguist-language=YAML linguist-generated=true
13
gravity_toolkit/data/*.nc filter=lfs diff=lfs merge=lfs -text

.github/workflows/python-publish.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,11 @@ jobs:
2323
- name: Install dependencies
2424
run: |
2525
python -m pip install --upgrade pip
26-
pip install setuptools wheel twine
26+
pip install build setuptools wheel twine
2727
- name: Build and publish
2828
env:
2929
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
3030
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
3131
run: |
32-
python setup.py sdist bdist_wheel
32+
python -m build
3333
twine upload dist/*
34-

.github/workflows/python-request.yml

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,9 @@ jobs:
2020
runs-on: ${{ matrix.os }}
2121
strategy:
2222
matrix:
23-
os: [ubuntu-latest, macos-latest]
24-
python-version: [3.12]
23+
os: [ubuntu-latest, macos-latest, windows-latest]
2524
env:
2625
OS: ${{ matrix.os }}
27-
PYTHON: ${{ matrix.python-version }}
2826
defaults:
2927
run:
3028
shell: bash -l {0}
@@ -33,34 +31,21 @@ jobs:
3331
- uses: actions/checkout@v4
3432
with:
3533
lfs: true
36-
- name: Set up mamba ${{ matrix.python-version }}
37-
uses: mamba-org/setup-micromamba@v1
38-
with:
39-
micromamba-version: 'latest'
40-
environment-file: .binder/environment.yml
41-
init-shell: bash
42-
environment-name: gravity_toolkit
43-
cache-environment: true
44-
post-cleanup: 'all'
45-
create-args: >-
46-
python=${{ matrix.python-version }}
47-
flake8
48-
pytest
49-
pytest-cov
50-
cython
34+
- name: Set up pixi environment
35+
uses: prefix-dev/setup-pixi@v0.9.1
5136
- name: Lint with flake8
5237
run: |
5338
# stop the build if there are Python syntax errors or undefined names
54-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
39+
pixi run lint
5540
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
56-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
41+
pixi run lint "--exit-zero --max-complexity=10 --max-line-length=127"
5742
- name: Test with pytest
5843
run: |
59-
pip install --no-deps .
60-
pytest --verbose --capture=no --cov=./ --cov-report=xml \
44+
# install the package in editable mode
45+
pip install --no-deps --editable .
46+
pixi run --environment dev pytest -n 0 --cov=./ --cov-report=xml \
6147
--username=${{ secrets.EARTHDATA_USERNAME }} \
62-
--password=${{ secrets.EARTHDATA_PASSWORD }} \
63-
--webdav=${{ secrets.PODAAC_PASSWORD }}
48+
--password=${{ secrets.EARTHDATA_PASSWORD }}
6449
- name: Archive code coverage results
6550
uses: actions/upload-artifact@v4
6651
with:

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
*.gmtdefaults4
2929
.RData
3030
.Rhistory
31+
octave-workspace
3132
__pycache__
3233
build/
3334
_build/
@@ -40,7 +41,11 @@ wheels/
4041
.installed.cfg
4142
*.egg
4243
.pytest_cache
44+
.coverage
4345
pythonenv*/
46+
venv/
47+
*build-commands.txt
48+
setup-miniconda-patched-environment.yml
4449
# OS generated files #
4550
######################
4651
.DS_Store
@@ -64,6 +69,7 @@ Thumbs.db
6469
*.ilg
6570
*.ind
6671
*.ist
72+
*.jats
6773
*.lof
6874
*.lot
6975
*.nav
@@ -87,6 +93,11 @@ None*.png
8793
#######################
8894
.ipynb_checkpoints
8995
Untitled.ipynb
96+
core.*
9097
# Large data files #
9198
####################
9299
*-complete.dat
100+
# pixi environments #
101+
#####################
102+
.pixi/*
103+
!.pixi/config.toml

MANIFEST.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ graft gravity_toolkit/data
22
prune .github*
33
prune doc*
44
prune notebooks*
5+
prune run*
6+
prune test*
57
exclude *.cfg
68
exclude *.yml
7-
include requirements.txt
8-
include version.txt

doc/source/api_reference/utilities.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ Download and management utilities for syncing time and auxiliary files
66

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

1211
`Source code`__

doc/source/getting_started/Install.rst

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ The simplest installation for most users will likely be using ``conda`` or ``mam
1919
2020
conda update gravity-toolkit
2121
22+
Development Install
23+
###################
24+
2225
To use the development repository, please fork ``gravity-toolkit`` into your own account and then clone onto your system:
2326

2427
.. code-block:: bash
@@ -31,8 +34,43 @@ To use the development repository, please fork ``gravity-toolkit`` into your own
3134
3235
python3 -m pip install --user .
3336
37+
To include all optional dependencies:
38+
39+
.. code-block:: bash
40+
41+
python3 -m pip install --user .[all]
42+
3443
The development version of ``gravity-toolkit`` can also be installed directly from GitHub using ``pip``:
3544

3645
.. code-block:: bash
3746
3847
python3 -m pip install --user git+https://github.com/tsutterley/gravity-toolkit.git
48+
49+
Package Management with ``pixi``
50+
################################
51+
52+
Alternatively ``pixi`` can be used to create a `streamlined environment <https://pixi.sh/>`_ after cloning the repository:
53+
54+
.. code-block:: bash
55+
56+
pixi install
57+
58+
``pixi`` maintains isolated environments for each project, allowing for different versions of
59+
``gravity-toolkit`` and its dependencies to be used without conflict. The ``pixi.lock`` file within the
60+
repository defines the required packages and versions for the environment.
61+
62+
``pixi`` can also create shells for running programs within the environment:
63+
64+
.. code-block:: bash
65+
66+
pixi shell
67+
68+
To see the available tasks within the ``gravity-toolkit`` workspace:
69+
70+
.. code-block:: bash
71+
72+
pixi task list
73+
74+
.. note::
75+
76+
``pixi`` is under active development and may change in future releases

doc/source/project/Citations.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ This software is also dependent on other commonly used Python packages:
5454
Disclaimer
5555
##########
5656

57+
This work is currently supported by the NASA GRACE-FO Science Team (Grant Number 80NSSC24K1153).
5758
This program is not sponsored or maintained by the Universities Space Research Association (USRA),
5859
the Center for Space Research at the University of Texas (UTCSR),
5960
the Jet Propulsion Laboratory (JPL),

doc/source/project/Testing.rst

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,61 @@ Testing
33
=======
44

55
``gravity-toolkit`` uses the ``pytest`` framework to run tests and verify outputs.
6+
Running the test suite requires a `dev installation <../getting_started/Install.html>`_ of the ``gravity-toolkit`` package to include all of the optional dependencies.
7+
8+
.. code-block:: bash
9+
10+
python -m pip install --editable '.[dev]'
611
712
Running the Test Suite
813
^^^^^^^^^^^^^^^^^^^^^^
914

15+
Using the ``pytest`` command:
16+
1017
.. code-block:: bash
1118
1219
pytest --directory <path_to_tide_models> test/
1320
21+
Using ``pixi``:
22+
23+
.. code-block:: bash
24+
25+
pixi run test "--directory <path_to_tide_models>"
26+
1427
The test suite is run in verbose mode as a default.
1528

29+
Coverage Reports
30+
^^^^^^^^^^^^^^^^
31+
32+
Coverage reports can be generated using the ``pytest-cov`` plugin (which is installed with the dev installation).
33+
34+
.. code-block:: bash
35+
36+
pytest --cov pyTMD --cov-report=term
37+
38+
.. code-block:: bash
39+
40+
pixi run test "--cov ../gravity-toolkit --cov-report=term"
41+
42+
Parallelization
43+
^^^^^^^^^^^^^^^
44+
45+
As a default, the ``pytest`` suite is run in parallel using the ``pytest-xdist`` plugin (which is also installed with the dev installation).
46+
To run in series and disable parallelization, set the number of processes to 0:
47+
48+
.. code-block:: bash
49+
50+
pytest -n 0
51+
52+
.. code-block:: bash
53+
54+
pixi run test "-n 0"
55+
1656
Continuous Integration
1757
^^^^^^^^^^^^^^^^^^^^^^
1858
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.
1959
The configuration files for this service are in the `GitHub workflows <https://github.com/tsutterley/gravity-toolkit/tree/main/.github/workflows>`_ directory.
20-
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.
60+
The workflows use ``pixi`` to install the required dependencies and build the custom environment.
2161

2262
The GitHub Actions jobs include:
2363

0 commit comments

Comments
 (0)