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

Added numpy ^1.26.4 in pyproject.toml #312

Merged
merged 20 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
9c816f2
Added numpy ^1.26.4 in pyproject.toml
dmichaels-harvard Jul 8, 2024
497f085
backed out numpy dependency in pyproject - maybe not good solution
dmichaels-harvard Jul 8, 2024
be0bc60
added hack_for_elasticsearch_numpy_usage.py for numpy>2 issue
dmichaels-harvard Jul 8, 2024
d4c7098
added hack_for_elasticsearch_numpy_usage.py for numpy>2 issue
dmichaels-harvard Jul 8, 2024
df41fd4
added hack_for_elasticsearch_numpy_usage.py for numpy>2 issue
dmichaels-harvard Jul 8, 2024
af95f20
added hack_for_elasticsearch_numpy_usage.py for numpy>2 issue
dmichaels-harvard Jul 8, 2024
25d2f80
added hack_for_elasticsearch_numpy_usage.py for numpy>2 issue
dmichaels-harvard Jul 8, 2024
75d8012
added hack_for_elasticsearch_numpy_usage.py for numpy>2 issue
dmichaels-harvard Jul 8, 2024
d428612
added hack_for_elasticsearch_numpy_usage.py for numpy>2 issue
dmichaels-harvard Jul 8, 2024
fbd3a4b
added hack_for_elasticsearch_numpy_usage.py for numpy>2 issue
dmichaels-harvard Jul 8, 2024
02ab6d6
unit test for elasticsearch/numpy usage hack
dmichaels-harvard Jul 8, 2024
aafd547
unit test for elasticsearch/numpy usage hack
dmichaels-harvard Jul 8, 2024
3951f53
unit test for elasticsearch/numpy usage hack
dmichaels-harvard Jul 8, 2024
9b7b0bc
unit test for elasticsearch/numpy usage hack
dmichaels-harvard Jul 8, 2024
3e5999e
minor updates to utility view-portal-object script
dmichaels-harvard Jul 8, 2024
fb05879
minor updates to utility view-portal-object script
dmichaels-harvard Jul 8, 2024
8bd066f
mistake in makefile wrt pytest
dmichaels-harvard Jul 8, 2024
3ed9160
mistake in makefile wrt pytest
dmichaels-harvard Jul 8, 2024
bafa2dc
Added/updated dev/troubleshooting scripts.
dmichaels-harvard Jul 8, 2024
8710a40
ready to merge
dmichaels-harvard Jul 11, 2024
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
14 changes: 14 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@ dcicutils
Change Log
----------

8.13.3
======
* N.B. Accidentially tagged/pushed 8.13.1 -> PLEASE IGNORE VERSION: 8.13.1 (subsequently yanked).
And then to correct (while no permission to delete above) pushed unofficial 8.13.2.
* Fallout from Python 3.12 support.
- Though dcicutils is not dependent on numpy, elasticsearch tries to import it,
and if it is installed and if it is a version greater than 1.x, we get this error:
AttributeError: `np.float_` was removed in the NumPy 2.0 release. Use `np.float64` instead.
So added a hack in hack_for_elasticsearch_numpy_usage.py for this specific case;
to be imported before we import elasticsearch modules.
* Added/updated scripts from submitr: view_portal_object.py and update_portal_object.py
for dev/troubleshooting purposes.


8.13.0
======
* Updates related to Python 3.12.
Expand Down
24 changes: 16 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,61 +18,69 @@ build: # builds
test: # runs default tests, which are the unit tests
make test-units
make test-static
make test-last

test-for-ga:
poetry run flake8 dcicutils
poetry run flake8 test --exclude=data_files
make test-units-with-coverage
make test-last

test-last:
poetry run pytest -vv -m "last"

retest: # runs only failed tests from the last test run. (if no failures, it seems to run all?? -kmp 17-Dec-2020)
poetry run pytest -vv -r w --last-failed
poetry run pytest -vv -r w --last-failed -m "not last"

test-all: # you have to be really brave to want this. a lot of things will err
@git log -1 --decorate | head -1
@date
poetry run pytest -vv -r w
poetry run pytest -vv -r w -m "not last"
make test-last
@git log -1 --decorate | head -1
@date

test-most: # leaves out things that will probably err but runs unit tests and both kinds of integrations
@git log -1 --decorate | head -1
@date
poetry run pytest -vv -r w -m "not static and not beanstalk_failure and not direct_es_query"
poetry run pytest -vv -r w -m "not static and not beanstalk_failure and not direct_es_query and not last"
@git log -1 --decorate | head -1
@date

test-units-with-coverage:
@git log -1 --decorate | head -1
@date
poetry run coverage run --source dcicutils -m pytest -vv -r w -m "not static and not integratedx and not beanstalk_failure and not direct_es_query"
poetry run coverage run --source dcicutils -m pytest -vv -r w -m "not static and not integratedx and not beanstalk_failure and not direct_es_query and not last"
make test-last
@git log -1 --decorate | head -1
@date

test-units: # runs unit tests (and integration tests not backed by a unit test)
@git log -1 --decorate | head -1
@date
poetry run pytest -vv -r w -m "not static and not integratedx and not beanstalk_failure and not direct_es_query"
poetry run pytest -vv -r w -m "not static and not integratedx and not beanstalk_failure and not direct_es_query and not last"
make test-last
@git log -1 --decorate | head -1
@date

test-integrations: # runs integration tests
@git log -1 --decorate | head -1
@date
poetry run pytest -vv -r w -m "not static and (integrated or integratedx) and not beanstalk_failure and not direct_es_query"
poetry run pytest -vv -r w -m "not static and (integrated or integratedx) and not beanstalk_failure and not direct_es_query and not last"
@git log -1 --decorate | head -1
@date

test-direct-es-query: # must be called inside VPC (e.g., from foursight after cloning repo, setting up venv, etc)
@git log -1 --decorate | head -1
@date
poetry run pytest -vv -r w -m "direct_es_query"
poetry run pytest -vv -r w -m "direct_es_query and not last"
@git log -1 --decorate | head -1
@date

test-static:
@git log -1 --decorate | head -1
@date
poetry run pytest -vv -r w -m "static"
poetry run pytest -vv -r w -m "static and not last"
poetry run flake8 dcicutils
poetry run flake8 test --exclude=data_files
@git log -1 --decorate | head -1
Expand Down
1 change: 1 addition & 0 deletions dcicutils/es_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging
import boto3
from .misc_utils import PRINT
import dcicutils.hack_for_elasticsearch_numpy_usage # noqa
from elasticsearch import Elasticsearch, RequestsHttpConnection
from aws_requests_auth.boto_utils import BotoAWSRequestsAuth

Expand Down
1 change: 1 addition & 0 deletions dcicutils/ff_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import time

from collections import namedtuple
import dcicutils.hack_for_elasticsearch_numpy_usage # noqa
from elasticsearch.exceptions import AuthorizationException
from typing import Dict, List, Optional
from urllib.parse import parse_qs, urlencode, urlparse, urlunparse
Expand Down
10 changes: 10 additions & 0 deletions dcicutils/hack_for_elasticsearch_numpy_usage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Though dcicutils is not dependent on numpy, elasticsearch pulls it in iff it is installed,
# and if it is numpy 2.x the numpy.float_ constant has been retired and any reference to it
# yields an error from numpy (AttributeError: np.float_ was removed in the NumPy 2.0 release.
# Use np.float64 instead); this reference to numpy.float_ occurs in elasticsearch/serializer.py.
# and we short-circuit it here by explicitly setting numpy.float_ to numpyh.float64.
try:
import numpy
numpy.float_ = numpy.float64
except Exception:
pass
Loading
Loading