From 92f50c35bbc5f0ff674c4deb4294488248d02b82 Mon Sep 17 00:00:00 2001 From: crusaderky Date: Sun, 10 Mar 2024 20:38:31 +0000 Subject: [PATCH 1/5] Upstream CI --- .github/workflows/pytest.yml | 24 ++++++++++++++++++++++++ ci/requirements-minimal.yml | 1 + ci/requirements-upstream.yml | 15 +++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 ci/requirements-upstream.yml diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 2141e36..39c9f93 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -6,6 +6,12 @@ on: pull_request: branches: ['*'] +# When this workflow is queued, automatically cancel any previous running +# or pending jobs from the same branch +concurrency: + group: tests-${{ github.ref }} + cancel-in-progress: true + defaults: run: shell: bash -l {0} @@ -44,6 +50,10 @@ jobs: - os: windows python-version: '3.8' requirements: minimal + # Test on nightly builds of requirements + - os: ubuntu + python-version: '3.12' + requirements: upstream steps: - name: Checkout @@ -61,6 +71,20 @@ jobs: environment-file: ci/requirements-${{ matrix.requirements }}.yml activate-environment: ndcsv + - name: Install nightly builds + if: ${{ matrix.requirements == 'upstream' }} + run: | + # Pick up https://github.com/mamba-org/mamba/pull/2903 + mamba install -n base 'mamba>=1.5.2' + + mamba uninstall --force numpy pandas pyarrow + python -m pip install --no-deps --pre --prefer-binary \ + --extra-index-url https://pypi.fury.io/arrow-nightlies/ \ + pyarrow + python -m pip install --no-deps --pre \ + -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple \ + numpy pandas + - name: Show conda options run: conda config --show diff --git a/ci/requirements-minimal.yml b/ci/requirements-minimal.yml index 286f885..1b9250e 100644 --- a/ci/requirements-minimal.yml +++ b/ci/requirements-minimal.yml @@ -2,6 +2,7 @@ name: ndcsv channels: - conda-forge dependencies: + - pyton=3.8 - pytest - pytest-cov - packaging diff --git a/ci/requirements-upstream.yml b/ci/requirements-upstream.yml new file mode 100644 index 0000000..2ccafa9 --- /dev/null +++ b/ci/requirements-upstream.yml @@ -0,0 +1,15 @@ +name: ndcsv +channels: + - conda-forge +dependencies: + - pytest + - pytest-cov + - packaging + - numpy + - pandas + - pyarrow # TODO remove when pandas 3.0 is released + - pshell + - xarray + - pip: + - git+https://github.com/pydata/xarray + # numpy, pandas, and pyarrow are upgraded to nightly builds by pytest.yml From 6d45941b24cd23030b66992094cb69fa5581d99b Mon Sep 17 00:00:00 2001 From: crusaderky Date: Sun, 10 Mar 2024 20:51:08 +0000 Subject: [PATCH 2/5] tweak --- ci/requirements-minimal.yml | 2 +- ndcsv/tests/test_read.py | 3 ++- pyproject.toml | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ci/requirements-minimal.yml b/ci/requirements-minimal.yml index 1b9250e..e932df8 100644 --- a/ci/requirements-minimal.yml +++ b/ci/requirements-minimal.yml @@ -5,7 +5,7 @@ dependencies: - pyton=3.8 - pytest - pytest-cov - - packaging + - packaging=22 - numpy=1.14 - pandas=0.24 - pshell=1.0 diff --git a/ndcsv/tests/test_read.py b/ndcsv/tests/test_read.py index ddf43ad..d21a597 100644 --- a/ndcsv/tests/test_read.py +++ b/ndcsv/tests/test_read.py @@ -7,10 +7,11 @@ import pandas import pytest import xarray +from packaging.version import parse as parse_version from ndcsv import read_csv -PANDAS_GE_150 = [int(x) for x in pandas.__version__.split(".")] >= [1, 5] +PANDAS_GE_150 = parse_version(pandas.__version__).release >= (1, 5) def test_malformed_input(): diff --git a/pyproject.toml b/pyproject.toml index aed791e..5bb0b3f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,6 +23,7 @@ classifiers = [ ] requires-python = ">=3.8" dependencies = [ + "packaging >=22", "numpy >=1.14", "pandas >=0.24", "pshell >=1.0", From cc9c7e6b7a1d4159e3577859f7893d1919f816dd Mon Sep 17 00:00:00 2001 From: crusaderky Date: Sun, 10 Mar 2024 21:07:56 +0000 Subject: [PATCH 3/5] Remove test --- ndcsv/tests/test_roundtrip.py | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/ndcsv/tests/test_roundtrip.py b/ndcsv/tests/test_roundtrip.py index 4b85b2f..89455df 100644 --- a/ndcsv/tests/test_roundtrip.py +++ b/ndcsv/tests/test_roundtrip.py @@ -301,21 +301,8 @@ def test_duplicate_index(): xarray.testing.assert_equal(a, b) -@pytest.mark.parametrize( - "unstack", - [ - False, - pytest.param( - True, - marks=pytest.mark.skipif( - xarray.__version__ < "0.17", - reason="Unstacking duplicate indices requires xarray 0.17", - ), - ), - ], -) -def test_duplicate_index_multiindex(unstack): - """Duplicate indices are OK""" +def test_duplicate_index_multiindex(): + """Duplicate indices are OK as long as you don't try to unstack""" a = xarray.DataArray( [1, 2], dims=["dim_0"], @@ -332,5 +319,5 @@ def test_duplicate_index_multiindex(unstack): write_csv(a, buf) assert buf.getvalue().replace("\r", "") == txt buf.seek(0) - b = read_csv(buf, unstack=unstack) - xarray.testing.assert_equal(a.unstack() if unstack else a, b) + b = read_csv(buf, unstack=False) + xarray.testing.assert_equal(a, b) From 4480f2808edd1267c5274dcf197c89813df378ac Mon Sep 17 00:00:00 2001 From: crusaderky Date: Sun, 10 Mar 2024 21:10:38 +0000 Subject: [PATCH 4/5] removed warning --- pyproject.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 5bb0b3f..6a71843 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,8 +64,6 @@ python_files = ["test_*.py"] testpaths = ["ndcsv/tests"] filterwarnings = [ "error", - # Raised internally by pandas - 'ignore:datetime.datetime.utcfromtimestamp\(\) is deprecated:DeprecationWarning', # minimum versions only 'ignore:Updating MultiIndexed coordinate .* would corrupt indices for other variables:FutureWarning', 'ignore:The signature of `Series.to_csv` was aligned to that of `DataFrame.to_csv`:FutureWarning', From 547bfc29009fede3be2b1a3e43cebaf72196c6a7 Mon Sep 17 00:00:00 2001 From: crusaderky Date: Sun, 10 Mar 2024 21:12:16 +0000 Subject: [PATCH 5/5] typo --- ci/requirements-minimal.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/requirements-minimal.yml b/ci/requirements-minimal.yml index e932df8..8e7fa74 100644 --- a/ci/requirements-minimal.yml +++ b/ci/requirements-minimal.yml @@ -2,7 +2,7 @@ name: ndcsv channels: - conda-forge dependencies: - - pyton=3.8 + - python=3.8 - pytest - pytest-cov - packaging=22