From 90d982a83e2e9f416cfb7fc49959c9e1a9221599 Mon Sep 17 00:00:00 2001 From: Matt Fisher Date: Mon, 19 Aug 2024 19:58:37 -0600 Subject: [PATCH 01/13] Add dependencies, build config to pyproject.toml --- pyproject.toml | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index eb5f589..56d59ff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,6 @@ [project] name = "iceflow" +version = "v0.2.0" authors = [ { name = "NSIDC", email = "nsidc@nsidc.org" }, ] @@ -22,7 +23,17 @@ classifiers = [ "Topic :: Scientific/Engineering", "Typing :: Typed", ] -dynamic = ["version"] +dependencies = [ + "numpy >=2.0.1", + "earthaccess >=0.10.0", + "pandas >=2.2", + "h5py >=3.11", + "gps-timemachine >=1.1.4", + "pyproj >=3.6.1", + "shapely >=2.0.5", + "pandera[mypy] >= 0.20.3", + "pydantic >=2.8.2", +] [project.urls] Homepage = "https://github.com/NSIDC/iceflow" @@ -30,6 +41,22 @@ Homepage = "https://github.com/NSIDC/iceflow" Discussions = "https://github.com/NSIDC/iceflow/discussions" Changelog = "https://github.com/NSIDC/iceflow/releases" +[project.optional-dependencies] +dev = [ + "bump-my-version", + "conda-lock >=2.5.7", + "invoke", + "mypy >=1.11.1", + "pandas-stubs >=2.2", + "pre-commit", + "pytest", +] + + +[build-system] +build-backend = "hatchling.build" +requires = ["hatchling"] + [tool.pytest.ini_options] minversion = "6.0" From 235ae846d353cc55e47b29b5565d7b6571e083ed Mon Sep 17 00:00:00 2001 From: Matt Fisher Date: Tue, 20 Aug 2024 10:27:29 -0600 Subject: [PATCH 02/13] Add new PyPI workflow and rename Anaconda one --- ...ild-and-release-anaconda-nsidc-channel.yml | 42 +++++++++++ .github/workflows/build-and-release.yml | 75 +++++++++++-------- 2 files changed, 86 insertions(+), 31 deletions(-) create mode 100644 .github/workflows/build-and-release-anaconda-nsidc-channel.yml diff --git a/.github/workflows/build-and-release-anaconda-nsidc-channel.yml b/.github/workflows/build-and-release-anaconda-nsidc-channel.yml new file mode 100644 index 0000000..e4233f5 --- /dev/null +++ b/.github/workflows/build-and-release-anaconda-nsidc-channel.yml @@ -0,0 +1,42 @@ +# TODO: Remove once we're on conda-forge! +name: Build & publish to Anaconda.org ("nsidc" channel) + +on: + push: + tags: + - v* + +# Default to bash in login mode; key to activating conda environment +# https://github.com/mamba-org/provision-with-micromamba#IMPORTANT +defaults: + run: + shell: "bash -l {0}" + +jobs: + build-and-release: + name: "Run build and release" + runs-on: "ubuntu-latest" + steps: + - name: "Check out repository" + uses: "actions/checkout@v4" + + - name: "Install Conda environment" + uses: "mamba-org/setup-micromamba@v1" + with: + environment-file: "conda-lock.yml" + # When using a lock-file, we have to set an environment name. + environment-name: "iceflow" + cache-environment: true + # Increase this key to trigger cache invalidation + cache-environment-key: 1 + + - name: "Run conda build" + run: "conda mambabuild recipe/" + + - name: "run anaconda upload" + env: + ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }} + run: | + for ARTIFACT in $(ls /home/runner/micromamba/envs/iceflow/conda-bld/noarch/*.tar.bz2) ; do + anaconda -t $ANACONDA_TOKEN upload -u nsidc -l main $ARTIFACT + done diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index ae916a1..4cf04c9 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -1,41 +1,54 @@ -name: build_and_release +name: Build & publish to PyPI on: + workflow_dispatch: + pull_request: push: tags: - - v* + - "v[0-9]+.[0-9]+.[0-9]+*" + +concurrency: + group: "${{ github.workflow }}-${{ github.ref }}" + cancel-in-progress: true + +env: + # Many color libraries just need this to be set to any value, but at least + # one distinguishes color depth, where "3" -> "256-bit color". + FORCE_COLOR: 3 -# Default to bash in login mode; key to activating conda environment -# https://github.com/mamba-org/provision-with-micromamba#IMPORTANT -defaults: - run: - shell: "bash -l {0}" jobs: - build-and-release: - name: "Run build and release" - runs-on: "ubuntu-latest" + dist: + name: Distribution build + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: hynek/build-and-inspect-python-package@v2 + + publish: + if: github.ref_type == 'tag' + name: Publish to PyPI + needs: [dist] + environment: pypi + permissions: + id-token: write + attestations: write + contents: read + runs-on: ubuntu-latest + steps: - - name: "Check out repository" - uses: "actions/checkout@v4" + - uses: actions/download-artifact@v4 + with: + name: Packages + path: dist - - name: "Install Conda environment" - uses: "mamba-org/setup-micromamba@v1" + - name: Generate artifact attestation for sdist and wheel + uses: actions/attest-build-provenance@v1.4.0 with: - environment-file: "conda-lock.yml" - # When using a lock-file, we have to set an environment name. - environment-name: "iceflow" - cache-environment: true - # Increase this key to trigger cache invalidation - cache-environment-key: 1 - - - name: "Run conda build" - run: "conda mambabuild recipe/" - - - name: "run anaconda upload" - env: - ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }} - run: | - for ARTIFACT in $(ls /home/runner/micromamba/envs/iceflow/conda-bld/noarch/*.tar.bz2) ; do - anaconda -t $ANACONDA_TOKEN upload -u nsidc -l main $ARTIFACT - done + subject-path: "dist/*" + + - uses: pypa/gh-action-pypi-publish@release/v1 From bfed4ecc8fc7ad29bb39a238e8fd9e4e8f7d8ead Mon Sep 17 00:00:00 2001 From: Matt Fisher Date: Tue, 20 Aug 2024 10:29:17 -0600 Subject: [PATCH 03/13] Use test PyPI for now --- .github/workflows/build-and-release.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 4cf04c9..80bee6a 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -52,3 +52,7 @@ jobs: subject-path: "dist/*" - uses: pypa/gh-action-pypi-publish@release/v1 + with: + # Remember to tell (test-)pypi about this repo before publishing + # Remove this line to publish to PyPI + repository-url: https://test.pypi.org/legacy/ From 2cab5218c5749ce48f4b07339bd751f1645841ba Mon Sep 17 00:00:00 2001 From: Matt Fisher Date: Tue, 20 Aug 2024 10:37:28 -0600 Subject: [PATCH 04/13] Update instructions to use pip dev install --- CONTRIBUTING.md | 10 ++++++---- README.md | 14 +++++++++++++- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b27f020..c8ce519 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,10 +5,13 @@ description of best practices for developing scientific packages. # Setting up a development environment -You can set up a development environment by running: +You can set up a development environment with `conda` or your environment manager of +choice: ```bash -conda env create -f environment.yml +conda create -n iceflow-dev pip +conda activate iceflow-dev +pip install --editable .[dev] ``` # Pre-commit @@ -17,12 +20,11 @@ You should prepare pre-commit, which will help you by checking that commits pass required checks: ```bash -pip install pre-commit # or brew install pre-commit on macOS pre-commit install # Will install a pre-commit hook into the git repo ``` You can also/alternatively run `pre-commit run` (changes only) or -`pre-commit run --all-files` to check even without installing the hook. +`pre-commit run --all-files` to check without installing the hook. # Common tasks diff --git a/README.md b/README.md index 8887cc7..f16c926 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,19 @@ TODO ## Usage -TODO +### Install + +```bash +pip install iceflow +``` + +### Using `iceflow` + +```python +import iceflow + +# TODO +``` ## Credit From 4d0bd2e93e033cf72ed33eff6dafbd42b1bac891 Mon Sep 17 00:00:00 2001 From: Matt Fisher Date: Tue, 20 Aug 2024 10:38:09 -0600 Subject: [PATCH 05/13] Add warning to bumpversion instructions --- CONTRIBUTING.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c8ce519..6061f13 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -50,7 +50,11 @@ reflect the version you plan to release. Then, bump the version with $ bump-my-version bump {major|minor|patch} ``` -This will update files containing the software version number. Commit these -changes and, once ready, merge them into `main` (through the use of a Pull -Request on a feature branch). Tag the commit you want to release on `main` to -initiate a GitHub Action (GHA) that will release the package to anaconda.org. +This will update files containing the software version number. + +> [!WARNING] +> Please do not attempt to update version numbers by hand! + +Commit these changes and, once ready, merge them into `main` (through the use of a Pull +Request on a feature branch). Tag the commit you want to release on `main` to initiate a +GitHub Action (GHA) that will release the package to anaconda.org. From e8265f5bc01fbe1dbfa027d0c3ac6670d97ac36a Mon Sep 17 00:00:00 2001 From: Matt Fisher Date: Tue, 20 Aug 2024 13:57:07 -0600 Subject: [PATCH 06/13] Temporarily alow publishing from non-tag builds (revert me!) --- .github/workflows/build-and-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 80bee6a..d55f973 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -30,7 +30,7 @@ jobs: - uses: hynek/build-and-inspect-python-package@v2 publish: - if: github.ref_type == 'tag' + # if: github.ref_type == 'tag' name: Publish to PyPI needs: [dist] environment: pypi From 4a8441931fb67f758ea0fd8b4736abe4ca122e61 Mon Sep 17 00:00:00 2001 From: Matt Fisher Date: Tue, 20 Aug 2024 16:36:49 -0600 Subject: [PATCH 07/13] "Namespace" the package to dodge conflict with similarly-named old package --- README.md | 4 ++-- pyproject.toml | 7 +++++-- src/{ => nsidc}/iceflow/__init__.py | 0 src/{ => nsidc}/iceflow/api.py | 8 ++++---- src/{ => nsidc}/iceflow/data/__init__.py | 0 src/{ => nsidc}/iceflow/data/atm1b.py | 2 +- src/{ => nsidc}/iceflow/data/fetch.py | 0 src/{ => nsidc}/iceflow/data/models.py | 2 +- src/{ => nsidc}/iceflow/data/read.py | 4 ++-- src/{ => nsidc}/iceflow/itrf/__init__.py | 0 src/{ => nsidc}/iceflow/itrf/converter.py | 4 ++-- src/{ => nsidc}/iceflow/itrf/plate_boundaries.py | 0 src/{ => nsidc}/iceflow/py.typed | 0 tests/integration/test_e2e.py | 4 ++-- tests/unit/test_data_models.py | 2 +- tests/unit/test_import_dep.py | 2 +- tests/unit/test_itrf.py | 2 +- tests/unit/test_itrf_converter.py | 4 ++-- tests/unit/test_package.py | 2 +- 19 files changed, 25 insertions(+), 22 deletions(-) rename src/{ => nsidc}/iceflow/__init__.py (100%) rename src/{ => nsidc}/iceflow/api.py (84%) rename src/{ => nsidc}/iceflow/data/__init__.py (100%) rename src/{ => nsidc}/iceflow/data/atm1b.py (99%) rename src/{ => nsidc}/iceflow/data/fetch.py (100%) rename src/{ => nsidc}/iceflow/data/models.py (98%) rename src/{ => nsidc}/iceflow/data/read.py (83%) rename src/{ => nsidc}/iceflow/itrf/__init__.py (100%) rename src/{ => nsidc}/iceflow/itrf/converter.py (97%) rename src/{ => nsidc}/iceflow/itrf/plate_boundaries.py (100%) rename src/{ => nsidc}/iceflow/py.typed (100%) diff --git a/README.md b/README.md index f16c926..f3b3076 100644 --- a/README.md +++ b/README.md @@ -33,13 +33,13 @@ TODO ### Install ```bash -pip install iceflow +pip install nsidc-iceflow ``` ### Using `iceflow` ```python -import iceflow +from nsidc import iceflow # TODO ``` diff --git a/pyproject.toml b/pyproject.toml index 56d59ff..492f8d7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [project] -name = "iceflow" +name = "nsidc-iceflow" version = "v0.2.0" authors = [ { name = "NSIDC", email = "nsidc@nsidc.org" }, @@ -57,6 +57,9 @@ dev = [ build-backend = "hatchling.build" requires = ["hatchling"] +[tool.hatch.build.targets.wheel] +packages = ["src/nsidc"] + [tool.pytest.ini_options] minversion = "6.0" @@ -168,7 +171,7 @@ commit = false tag = false [[tool.bumpversion.files]] -filename = "src/iceflow/__init__.py" +filename = "src/nsidc/iceflow/__init__.py" search = '__version__ = "v{current_version}"' replace = '__version__ = "v{new_version}"' diff --git a/src/iceflow/__init__.py b/src/nsidc/iceflow/__init__.py similarity index 100% rename from src/iceflow/__init__.py rename to src/nsidc/iceflow/__init__.py diff --git a/src/iceflow/api.py b/src/nsidc/iceflow/api.py similarity index 84% rename from src/iceflow/api.py rename to src/nsidc/iceflow/api.py index 532ec0c..26ddc39 100644 --- a/src/iceflow/api.py +++ b/src/nsidc/iceflow/api.py @@ -4,13 +4,13 @@ import pandas as pd -from iceflow.data.fetch import search_and_download -from iceflow.data.models import ( +from nsidc.iceflow.data.fetch import search_and_download +from nsidc.iceflow.data.models import ( DatasetSearchParameters, IceflowDataFrame, ) -from iceflow.data.read import read_data -from iceflow.itrf.converter import transform_itrf +from nsidc.iceflow.data.read import read_data +from nsidc.iceflow.itrf.converter import transform_itrf def fetch_iceflow_df( diff --git a/src/iceflow/data/__init__.py b/src/nsidc/iceflow/data/__init__.py similarity index 100% rename from src/iceflow/data/__init__.py rename to src/nsidc/iceflow/data/__init__.py diff --git a/src/iceflow/data/atm1b.py b/src/nsidc/iceflow/data/atm1b.py similarity index 99% rename from src/iceflow/data/atm1b.py rename to src/nsidc/iceflow/data/atm1b.py index 03cb07e..c19a83b 100644 --- a/src/iceflow/data/atm1b.py +++ b/src/nsidc/iceflow/data/atm1b.py @@ -13,7 +13,7 @@ from gps_timemachine.gps import leap_seconds from numpy.typing import DTypeLike -from iceflow.data.models import ATM1BDataFrame +from nsidc.iceflow.data.models import ATM1BDataFrame """ The dtypes used to read any of the input ATM1B input files. diff --git a/src/iceflow/data/fetch.py b/src/nsidc/iceflow/data/fetch.py similarity index 100% rename from src/iceflow/data/fetch.py rename to src/nsidc/iceflow/data/fetch.py diff --git a/src/iceflow/data/models.py b/src/nsidc/iceflow/data/models.py similarity index 98% rename from src/iceflow/data/models.py rename to src/nsidc/iceflow/data/models.py index d23a44f..4e24e3b 100644 --- a/src/iceflow/data/models.py +++ b/src/nsidc/iceflow/data/models.py @@ -8,7 +8,7 @@ import pydantic from pandera.typing import DataFrame, Index, Series -from iceflow.itrf import ITRF_REGEX +from nsidc.iceflow.itrf import ITRF_REGEX class CommonDataColumnsSchema(pa.DataFrameModel): diff --git a/src/iceflow/data/read.py b/src/nsidc/iceflow/data/read.py similarity index 83% rename from src/iceflow/data/read.py rename to src/nsidc/iceflow/data/read.py index b925627..40b7498 100644 --- a/src/iceflow/data/read.py +++ b/src/nsidc/iceflow/data/read.py @@ -3,8 +3,8 @@ import functools from pathlib import Path -from iceflow.data.atm1b import atm1b_data -from iceflow.data.models import ( +from nsidc.iceflow.data.atm1b import atm1b_data +from nsidc.iceflow.data.models import ( ATM1BDataFrame, ATM1BDataset, Dataset, diff --git a/src/iceflow/itrf/__init__.py b/src/nsidc/iceflow/itrf/__init__.py similarity index 100% rename from src/iceflow/itrf/__init__.py rename to src/nsidc/iceflow/itrf/__init__.py diff --git a/src/iceflow/itrf/converter.py b/src/nsidc/iceflow/itrf/converter.py similarity index 97% rename from src/iceflow/itrf/converter.py rename to src/nsidc/iceflow/itrf/converter.py index 8fbb64b..17dfeaa 100644 --- a/src/iceflow/itrf/converter.py +++ b/src/nsidc/iceflow/itrf/converter.py @@ -7,8 +7,8 @@ import pandera as pa from pyproj import Transformer -from iceflow.data.models import IceflowDataFrame -from iceflow.itrf import check_itrf +from nsidc.iceflow.data.models import IceflowDataFrame +from nsidc.iceflow.itrf import check_itrf def _datetime_to_decimal_year(date): diff --git a/src/iceflow/itrf/plate_boundaries.py b/src/nsidc/iceflow/itrf/plate_boundaries.py similarity index 100% rename from src/iceflow/itrf/plate_boundaries.py rename to src/nsidc/iceflow/itrf/plate_boundaries.py diff --git a/src/iceflow/py.typed b/src/nsidc/iceflow/py.typed similarity index 100% rename from src/iceflow/py.typed rename to src/nsidc/iceflow/py.typed diff --git a/tests/integration/test_e2e.py b/tests/integration/test_e2e.py index b6bac88..5b18197 100644 --- a/tests/integration/test_e2e.py +++ b/tests/integration/test_e2e.py @@ -14,8 +14,8 @@ import pandas as pd -from iceflow.api import fetch_iceflow_df -from iceflow.data.models import ATM1BDataset, DatasetSearchParameters, IceflowDataFrame +from nsidc.iceflow.api import fetch_iceflow_df +from nsidc.iceflow.data.models import ATM1BDataset, DatasetSearchParameters, IceflowDataFrame def test_e2e(tmp_path): diff --git a/tests/unit/test_data_models.py b/tests/unit/test_data_models.py index a421790..ac5acf7 100644 --- a/tests/unit/test_data_models.py +++ b/tests/unit/test_data_models.py @@ -4,7 +4,7 @@ import pandera as pa import pytest -from iceflow.data.models import IceflowDataFrame +from nsidc.iceflow.data.models import IceflowDataFrame _mock_bad_df = pd.DataFrame( { diff --git a/tests/unit/test_import_dep.py b/tests/unit/test_import_dep.py index fc3fec5..3b4b052 100644 --- a/tests/unit/test_import_dep.py +++ b/tests/unit/test_import_dep.py @@ -8,6 +8,6 @@ def test_gps_timemachine_import(): def test_import_package(): - import iceflow + from nsidc import iceflow assert iceflow is not None diff --git a/tests/unit/test_itrf.py b/tests/unit/test_itrf.py index bc36ad2..d1ec427 100644 --- a/tests/unit/test_itrf.py +++ b/tests/unit/test_itrf.py @@ -1,6 +1,6 @@ from __future__ import annotations -from iceflow.itrf import check_itrf +from nsidc.iceflow.itrf import check_itrf def test_check_itrf(): diff --git a/tests/unit/test_itrf_converter.py b/tests/unit/test_itrf_converter.py index 3ec4346..9af05f4 100644 --- a/tests/unit/test_itrf_converter.py +++ b/tests/unit/test_itrf_converter.py @@ -3,8 +3,8 @@ import pandas as pd import pytest -from iceflow.data.models import IceflowDataFrame -from iceflow.itrf.converter import _datetime_to_decimal_year, transform_itrf +from nsidc.iceflow.data.models import IceflowDataFrame +from nsidc.iceflow.itrf.converter import _datetime_to_decimal_year, transform_itrf def test_transform_itrf(): diff --git a/tests/unit/test_package.py b/tests/unit/test_package.py index ffb2537..43b36e9 100644 --- a/tests/unit/test_package.py +++ b/tests/unit/test_package.py @@ -1,6 +1,6 @@ from __future__ import annotations -import iceflow +from nsidc import iceflow def test_version(): From 0d257161df60d0fc92a9969b192642a5f7533044 Mon Sep 17 00:00:00 2001 From: Matt Fisher Date: Tue, 20 Aug 2024 15:42:16 -0600 Subject: [PATCH 08/13] Stop publishing to test-PyPI --- .github/workflows/build-and-release.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index d55f973..4cf04c9 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -30,7 +30,7 @@ jobs: - uses: hynek/build-and-inspect-python-package@v2 publish: - # if: github.ref_type == 'tag' + if: github.ref_type == 'tag' name: Publish to PyPI needs: [dist] environment: pypi @@ -52,7 +52,3 @@ jobs: subject-path: "dist/*" - uses: pypa/gh-action-pypi-publish@release/v1 - with: - # Remember to tell (test-)pypi about this repo before publishing - # Remove this line to publish to PyPI - repository-url: https://test.pypi.org/legacy/ From 486732b77f9c6a82219eddb0f0450e2d267c8078 Mon Sep 17 00:00:00 2001 From: Matt Fisher Date: Tue, 20 Aug 2024 15:47:52 -0600 Subject: [PATCH 09/13] Fix linting errors --- .github/workflows/build-and-release.yml | 1 - CONTRIBUTING.md | 12 +++++++----- src/nsidc/iceflow/data/models.py | 2 +- tests/integration/test_e2e.py | 6 +++++- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 4cf04c9..689cefe 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -16,7 +16,6 @@ env: # one distinguishes color depth, where "3" -> "256-bit color". FORCE_COLOR: 3 - jobs: dist: name: Distribution build diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6061f13..e3684a5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,8 +5,8 @@ description of best practices for developing scientific packages. # Setting up a development environment -You can set up a development environment with `conda` or your environment manager of -choice: +You can set up a development environment with `conda` or your environment +manager of choice: ```bash conda create -n iceflow-dev pip @@ -53,8 +53,10 @@ $ bump-my-version bump {major|minor|patch} This will update files containing the software version number. > [!WARNING] +> > Please do not attempt to update version numbers by hand! -Commit these changes and, once ready, merge them into `main` (through the use of a Pull -Request on a feature branch). Tag the commit you want to release on `main` to initiate a -GitHub Action (GHA) that will release the package to anaconda.org. +Commit these changes and, once ready, merge them into `main` (through the use of +a Pull Request on a feature branch). Tag the commit you want to release on +`main` to initiate a GitHub Action (GHA) that will release the package to +anaconda.org. diff --git a/src/nsidc/iceflow/data/models.py b/src/nsidc/iceflow/data/models.py index 4e24e3b..c450abe 100644 --- a/src/nsidc/iceflow/data/models.py +++ b/src/nsidc/iceflow/data/models.py @@ -2,7 +2,7 @@ import datetime as dt from collections.abc import Sequence -from typing import Literal +from typing import Generic, Literal, TypeVar import pandera as pa import pydantic diff --git a/tests/integration/test_e2e.py b/tests/integration/test_e2e.py index 5b18197..78a4d2e 100644 --- a/tests/integration/test_e2e.py +++ b/tests/integration/test_e2e.py @@ -15,7 +15,11 @@ import pandas as pd from nsidc.iceflow.api import fetch_iceflow_df -from nsidc.iceflow.data.models import ATM1BDataset, DatasetSearchParameters, IceflowDataFrame +from nsidc.iceflow.data.models import ( + ATM1BDataset, + DatasetSearchParameters, + IceflowDataFrame, +) def test_e2e(tmp_path): From 112135bf011599f0de46163cf4100bca8c8c0e7e Mon Sep 17 00:00:00 2001 From: Matt Fisher Date: Tue, 20 Aug 2024 16:17:00 -0600 Subject: [PATCH 10/13] Fix Mypy to work with namespaced package --- pyproject.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 492f8d7..b7c4dbc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -91,6 +91,10 @@ disallow_incomplete_defs = false check_untyped_defs = true plugins = "pandera.mypy" +# Needed to work with our namespaced package! See: https://mypy.readthedocs.io/en/stable/running_mypy.html#mapping-paths-to-modules +mypy_path = "$MYPY_CONFIG_FILE_DIR/src" +explicit_package_bases = true + [[tool.mypy.overrides]] module = [ "iceflow.*", From 619e9545287647f3f483d18a994b9614b3066f51 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 22:38:18 +0000 Subject: [PATCH 11/13] style: pre-commit fixes --- src/nsidc/iceflow/data/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nsidc/iceflow/data/models.py b/src/nsidc/iceflow/data/models.py index c450abe..4e24e3b 100644 --- a/src/nsidc/iceflow/data/models.py +++ b/src/nsidc/iceflow/data/models.py @@ -2,7 +2,7 @@ import datetime as dt from collections.abc import Sequence -from typing import Generic, Literal, TypeVar +from typing import Literal import pandera as pa import pydantic From a210a07241cafc1a0308eb708c5c4d4c65d67881 Mon Sep 17 00:00:00 2001 From: Matt Fisher Date: Tue, 20 Aug 2024 16:38:48 -0600 Subject: [PATCH 12/13] Remove conda environment specification Use pip! --- environment.yml | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 environment.yml diff --git a/environment.yml b/environment.yml deleted file mode 100644 index de1be41..0000000 --- a/environment.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: iceflow -channels: - - conda-forge - - nsidc -dependencies: - - python ~=3.12.0 - - numpy ~=2.0.1 - - earthaccess ~=0.10.0 - - pandas ~=2.2 - - h5py ~=3.11 - - gps-timemachine ~=1.1.4 - - pyproj ~=3.6.1 - - shapely ~=2.0.5 - - pandera[mypy] ~= 0.20.3 - - pydantic ~=2.8.2 - # dev tools - - pre-commit - - invoke ~=2.2.0 - - mypy ~=1.11.1 - - pandas-stubs ~=2.2 - - pytest ~=8.3.2 - - conda-lock ~=2.5.7 - - bump-my-version - # Build utilities - - conda-build ~=24.5.1 - - boa ~=0.17.0 - - anaconda-client ~=1.12.3 From 720ea4f1e64d3220f9013363fb3c2b9863c12219 Mon Sep 17 00:00:00 2001 From: Matt Fisher Date: Tue, 20 Aug 2024 16:40:10 -0600 Subject: [PATCH 13/13] Disable pre-commit autofix behavior --- .pre-commit-config.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b58efca..17b24bc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,7 @@ ci: + autoupdate_schedule: "monthly" autoupdate_commit_msg: "chore: update pre-commit hooks" - autofix_commit_msg: "style: pre-commit fixes" + autofix_prs: false # Comment "pre-commit.ci autofix" on a PR to trigger repos: - repo: https://github.com/adamchainz/blacken-docs