[WIP] Fix failing GitHub Actions job due to import and NumPy issues#188
Merged
telegraphic merged 8 commits intomasterfrom Apr 30, 2026
Merged
[WIP] Fix failing GitHub Actions job due to import and NumPy issues#188telegraphic merged 8 commits intomasterfrom
telegraphic merged 8 commits intomasterfrom
Conversation
…astropy tostring Agent-Logs-Url: https://github.com/telegraphic/hickle/sessions/6e186643-c2fb-4c1d-9205-58dfb74a17f1 Co-authored-by: telegraphic <713251+telegraphic@users.noreply.github.com>
…umpy copy=False fixes Agent-Logs-Url: https://github.com/telegraphic/hickle/sessions/5ea2752b-a76b-43ce-9b45-2ebee1cfe815 Co-authored-by: telegraphic <713251+telegraphic@users.noreply.github.com>
…ompatibility Agent-Logs-Url: https://github.com/telegraphic/hickle/sessions/5ea2752b-a76b-43ce-9b45-2ebee1cfe815 Co-authored-by: telegraphic <713251+telegraphic@users.noreply.github.com>
…job only Agent-Logs-Url: https://github.com/telegraphic/hickle/sessions/d8fbf56b-c8c8-414c-ae93-a64641ca7a2a Co-authored-by: telegraphic <713251+telegraphic@users.noreply.github.com>
…rrors ci: fix Codecov rate-limit failures — upgrade to v5, single-job upload
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pkg_resourcesimport inhickle/legacy_v3/hickle.pywith try/except (ImportErrorfor broad compatibility); provide a stubget_distributionthat raisesDistributionNotFoundif called without setuptoolsnp.array(string_data, copy=False)withnp.asarray(string_data)inhickle/loaders/load_numpy.pycreate_np_array_datasetfor NumPy 2.0 compatibility.tobytes()fix (from PR replacendarray.tostringwithndarray.tobytes#187); no change needed hereOriginal prompt
Create a PR against the
masterbranch oftelegraphic/hickleto fix the failing GitHub Actions job.Context
17d0832db676f4acec086f07141845b7aaab4403.Failures to address
ModuleNotFoundError: No module named 'pkg_resources'hickle/legacy_v3/hickle.py(top-level import)pkg_resourcesoptional. Guard the import with try/except and ensure any later usage ofget_distributionis also guarded.ValueError: Unable to avoid copy while creating an array as requested.np.array(obj, copy=False)should be replaced withnp.asarray(obj).hickle/loaders/load_numpy.py:create_np_array_datasetstring scalar path usesnp.array(..., copy=False)load_ndarray_datasetstring dtype path usesnp.array(..., copy=False, dtype=...)np.asarray(...)(keeping dtype where needed) or otherwise allow copies when unavoidable, while preserving behavior for NumPy 1.x..tostring()AttributeError: 'numpy.str_' object has no attribute 'tostring'hickle/tests/test_06_load_astropy.pyaround assertions comparingreloaded.value[index].tostring().str(...)comparison or.tobytes()where appropriate).Acceptance criteria
The following is the prior conversation context from the user's chat exploration (may be truncated):
User: Please find a solution for this failing job. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.
Assistant: The job is failing for two independent reasons:
pkg_resourcesis missinghickle/legacy_v3/hickle.pyfails atfrom pkg_resources import get_distribution, DistributionNotFound(hickle/legacy_v3/hickle.py:28at ref17d0832db676f4acec086f07141845b7aaab4403).setuptools(which providespkg_resources), so this import is no longer safe.Fix
Make
pkg_resourcesoptional in the legacy loader (best: don’t require it at import time). Inhickle/legacy_v3/hickle.py(ref17d0832...), change the top-level import to a guarded import:If
get_distribution(...)is used later in that file, gate it like:This allows legacy-v3 loading to proceed instead of erroring before
hkl.load()can emit the expected “Using legacy load…” warning.(Alternative/workflow-only mitigation: ensure
setuptoolsis installed in the test env, but code should still be robust.)np.array(..., copy=False)now raisesSeveral tests fail with:
The culprit is in
hickle/loaders/load_numpy.py:load_ndarray_dataset()returnsnp.array(string_data, copy=False, dtype=dtype)for string dtypes (line ~235 in the retrieved file at ref17d0832...).create_np_array_dataset()also usesnp.array(string_data, copy=False)during string scalar dumping (line ~105).Fix
Replace
np.array(..., copy=False)withnp.asarray(...)(or allow copies when needed). Suggested minimal patches:A. In
load_ndarray_dataset(string path):B. In
create_np_array_dataset(scalar string path):Current code does:
Change to:
That should address the three NumPy-related failures reported in the summary:
test_load_hickle_4_0_X_stringtest_listlike_datasetThis pull request was created from Copilot chat.