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

Compatibility and tests against Numpy 2.0.0rc1 #2471

Merged
merged 8 commits into from
Apr 17, 2024
11 changes: 9 additions & 2 deletions .github/workflows/ci_workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- linux: py39-test
- linux: py310-test-all
- linux: py311-test
- linux: py311-test-all
- linux: py312-test-all

# Documentation build
- linux: py38-docs
Expand All @@ -43,14 +43,21 @@ jobs:
- macos: py39-test
- macos: py310-test-all
- macos: py311-test
- macos: py312-test-all

# Test some configurations on Windows
- windows: py38-test
- windows: py310-test
- windows: py39-test

# Test against latest developer versions of some packages
- linux: py310-test-dev-all
- linux: py311-test-dev
- linux: py312-test-dev-all

- macos: py311-test-dev-all
- macos: py312-test-dev

- windows: py310-test-dev

publish:
needs: tests
Expand Down
2 changes: 2 additions & 0 deletions glue/utils/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,8 @@

def __new__(cls, value, dtype=None, copy=True, order=None, subok=False,
ndmin=0, categories=None):
if not copy and np.lib.NumpyVersion(np.__version__) >= "2.0.0rc1":
copy = None

Check warning on line 508 in glue/utils/array.py

View check run for this annotation

Codecov / codecov/patch

glue/utils/array.py#L508

Added line #L508 was not covered by tests
result = np.array(value, dtype=dtype, copy=copy, order=order,
subok=True, ndmin=ndmin).view(categorical_ndarray)
if categories is not None:
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ install_requires =
pandas>=1.2
echo>=0.6
astropy>=4.0
fast_histogram>=0.12
setuptools>=30.3.0
ipython>=4.0
dill>=0.2
Expand Down
12 changes: 10 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
envlist =
py{38,39,310,311}-{codestyle,test,docs}-all-{dev,legacy}{,-visual}
py{38,39,310,311,312}-{codestyle,test,docs}-all-{dev,legacy}{,-visual}
requires = pip >= 18.0
setuptools >= 30.3.0

Expand All @@ -10,7 +10,7 @@ passenv =
DISPLAY
HOME
setenv =
dev: PIP_EXTRA_INDEX_URL = https://pypi.anaconda.org/astropy/simple https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
dev: PIP_EXTRA_INDEX_URL = https://pypi.anaconda.org/astropy/simple https://pypi.anaconda.org/liberfa/simple https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
visual: MPLFLAGS = -m "mpl_image_compare" --mpl --mpl-generate-summary=html --mpl-results-path={toxinidir}/results --mpl-hash-library={toxinidir}/glue/tests/visual/{envname}.json --mpl-baseline-path=https://raw.githubusercontent.com/glue-viz/glue-core-visual-tests/images/{envname}/
whitelist_externals =
find
Expand All @@ -22,7 +22,9 @@ changedir =
docs: doc
deps =
dev: numpy>=0.0.dev0
dev: scipy>=0.0.dev0
dev: astropy>=0.0.dev0
# LTS
lts: astropy==5.0.*
lts: matplotlib==3.5.*
# Pin numpy-lts until permanent solution for #2353/#2428
Expand All @@ -46,6 +48,12 @@ extras =
all: all
docs: docs
visual: visualtest
# Need `--pre` for packages like pandas having no released version supporting numpy>=2.0 yet,
# + `--no-deps` for casa-formats-io having no branch for numpy>=2.0 -
# for as long all test deps need to be manually pulled in above as well!
install_command =
!dev: python -I -m pip install
dev: python -I -m pip install -v
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this help?

Suggested change
dev: python -I -m pip install -v
dev: python -I -m pip install -v --pre

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just removed this as we should no longer need any git installs; the >=0.0.dev0 versions apparently install without it 🤪

commands =
test: pip freeze
test: pytest --pyargs glue --cov glue --cov-config={toxinidir}/setup.cfg {env:MPLFLAGS} {posargs}
Expand Down
Loading