Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upstream CI #19

Merged
merged 5 commits into from
Mar 10, 2024
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
24 changes: 24 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down
3 changes: 2 additions & 1 deletion ci/requirements-minimal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ name: ndcsv
channels:
- conda-forge
dependencies:
- python=3.8
- pytest
- pytest-cov
- packaging
- packaging=22
- numpy=1.14
- pandas=0.24
- pshell=1.0
Expand Down
15 changes: 15 additions & 0 deletions ci/requirements-upstream.yml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 2 additions & 1 deletion ndcsv/tests/test_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
21 changes: 4 additions & 17 deletions ndcsv/tests/test_roundtrip.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand All @@ -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)
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ classifiers = [
]
requires-python = ">=3.8"
dependencies = [
"packaging >=22",
"numpy >=1.14",
"pandas >=0.24",
"pshell >=1.0",
Expand Down Expand Up @@ -63,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',
Expand Down
Loading