Repository navigation
Fit cache_remedy to the cache location numba picked - #119
nelson2005 wants to merge 167 commits into
Conversation
… that asks about its own files tells the reader to install that package again, at a shorter path or with its source files on disk, not numbox
…ound on its own functions' file names; LONGEST_CACHE_FILE_NAME holds numbox's, and a package with longer names that took it passed a location its first save overflowed
…der NUMBA_CACHE_DIR, the directory's name and a hash of its path, not the checkout's path, and say so where cache_remedy's docstring and the docs gave the location as the source's directory path; from a short checkout the location went past the limit and numba cached in the tree
MiniMax Code ReviewThe user is asking me to review a pull request that modifies documentation files. Let me analyze the changes:
Let me review these changes for clarity, accuracy, and consistency: Issues I can identify:1. docs/numbox.core.configurations.rstThis is a very dense documentation file. Some observations:
2. docs/numbox.core.proxy.rst
3. docs/numbox.utils.rstI notice the documentation provides a more precise explanation of cache file naming and directory structure. The modifications clarify how anchor stems and cache subdirectories are generated, highlighting the nuanced naming mechanism for compiled files. The text now more explicitly describes the relationship between anchor files, cache subdirectories, and how different functions are distinguished within the caching system. The updates seem primarily focused on improving technical documentation precision, offering clearer insights into the caching mechanism's inner workings. While technically accurate, the documentation remains quite dense and might benefit from more accessible formatting. Code Review: Documentation Pull RequestSummaryThis PR updates three documentation files with more detailed explanations about caching behavior, path length limits, and bug fixes. The changes are purely documentation changes with no code modifications. Review by File1. docs/numbox.core.configurations.rstChanges: Major expansion of the caching troubleshooting section with extensive detail about:
Observations:
Suggestions:
2. docs/numbox.core.proxy.rstChanges: Clarified the timeline of the mixed-container limit bug fix:
Observations:
No issues found. 3. docs/numbox.utils.rstChanges: Improved explanation of cache file naming:
Observations:
No issues found. Overall Assessment
Recommendation: The changes are technically sound and provide valuable additional context. However, the formatting in |
There was a problem hiding this comment.
High — _CacheLocator.get_suitable_cache_subpath may not exist in all supported numba versions
File: test/core/test_no_cache_location.py:700
Problem: The test now calls numba.core.caching._CacheLocator.get_suitable_cache_subpath, a private API. If the installed numba version does not have this method (or has a different signature), the test will fail with AttributeError on import/collection, breaking the test suite for those environments.
Fix: Guard the call with a version check or use a public API/fallback that computes the subpath consistently across supported numba versions.
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The backward-compatible API change is documented and covered by focused regression tests.
Review effort: Balanced
Findings: None
What changed in this PR
Adds package-aware cache remedies for downstream projects while preserving numbox’s default messaging.
Changes:
- Adds a configurable package name to
cache_remedy. - Corrects cache-path sizing and adds regression tests.
- Documents downstream reuse of cache helpers.
| File | Description |
|---|---|
numbox/core/configurations.py |
Parameterizes package names in remedies. |
test/core/test_no_cache_location.py |
Tests package naming and accurate cache paths. |
docs/numbox.core.configurations.rst |
Documents cache paths and downstream usage. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
… is: NUMBA_CACHE_DIR's, the package's beside the source, or the user's cache directory's through XDG_CACHE_HOME or HOME; under the user's cache directory the remedy named a variable that was not set and a reinstall that changes nothing, and the docs said numba caches beside the source without the variable
…IR is a directory named for its own, by its name and a hash of its path; the page said it appends the directory's path, against the configurations page
…e package, ending 20 bytes short of the limit; at the home's depth numba's own check failed the location where the file system makes no unnamed temporary file, numba moved on to the tree, and the anchor answered instead of the package
…tion too long is told what shortens the one it is, as cache_remedy sets out; it still gave a shorter NUMBA_CACHE_DIR, or none, for all three
… each from the file, not by which directory a location starts with; where they nest, an install under either cache directory or NUMBA_CACHE_DIR above the user's, one was told the cure for another
…f the path limit passes the anchor's check and overflows at numba's first save, as the user's cache directory does; the package's own check answers first only within about 175 bytes, its location under the variable being a directory named for its own, where the page had it answer for the whole 230
…h none numba can take a location as long, the user's cache directory where NUMBA_CACHE_DIR was set to it; and have the path-limit test read the remedy to its end, where a prefix of it passed the remedy that came before the locations were told apart
…ng beside the source or under the user's cache directory, and ask for it writable at a short path; the remedy told the reader to set a variable that was set
… locators: the user's cache directory is moved through XDG_CACHE_HOME or HOME, HOME alone on macOS and nothing on Windows; NUMBA_CACHE_DIR is offered, or named as passed over, only where numba takes it first, which NUMBA_CACHE_LOCATOR_CLASSES can change from numba 0.64; and an error naming a file in the location, as numba's first save does, is told the same as one naming the location
…MBA_CACHE_DIR it passed over is named and asked for at a short path, since numba passes one too deep for its directory over as it does an unwritable one, and a NUMBA_CACHE_LOCATOR_CLASSES without the user-provided locator first gets its own locations, not the variable numba never reads; NUMBA_CACHE_LOCATOR_CLASSES arrived in numba 0.62, not 0.64, and a dotted entry is tested
There was a problem hiding this comment.
High — _moved_through() returns incorrect guidance on macOS for .zip/frozen-app path
File: numbox/core/configurations.py:220-229
Problem: For macOS (sys.platform == "darwin"), _moved_through() returns ", through HOME", but numba's appdirs on macOS uses HOME only for the user cache directory. However, the function is also used in the .zip/frozen-app branch (line 340), where the location is the user's cache directory — that part is correct. The defect is that on macOS, XDG_CACHE_HOME does not move the cache directory, so the message is correct. No defect here.
High — cache_remedy crashes when failure.filename is None
File: numbox/core/configurations.py:255
Problem: failure.filename may be None for an OSError with errno.ENAMETOOLONG (e.g., when the error is raised without a filename). The code does os.path.abspath(failure.filename or ""), which handles None by using "", so named becomes {os.path.abspath(""), os.path.dirname(os.path.abspath(""))}. This is safe but may produce an incorrect match, leading to the fallback cure message. Not a crash.
Medium — _CacheLocator.get_suitable_cache_subpath may not exist in older numba versions
File: numbox/core/configurations.py:254
Problem: The code imports _CacheLocator from numba.core.caching unconditionally. If the installed numba version does not have _CacheLocator or get_suitable_cache_subpath (e.g., numba < 0.61 or a future version that renames it), this import will raise ImportError or AttributeError, breaking cache_remedy entirely. The diff references numba 0.61 and 0.62 features, but does not guard against older versions.
Medium — config.CACHE_LOCATOR_CLASSES may not exist in older numba versions
File: numbox/core/configurations.py:241
Problem: getattr(config, "CACHE_LOCATOR_CLASSES", "") is safe, but the subsequent code assumes the attribute exists and is a string. If the attribute exists but is None (possible in some numba versions), locators.split(",") will raise AttributeError. The code does not handle None.
Medium — first.lstrip("_") may not correctly identify the locator class
File: numbox/core/configurations.py:243
Problem: The code strips leading underscores from the class name to compare against "UserProvidedCacheLocator". If numba's actual class name is _UserProvidedCacheLocator (with a leading underscore), the comparison works. However, if the class name has a different prefix or suffix (e.g., UserProvidedCacheLocator vs _UserProvidedCacheLocator), the comparison may fail, causing cache_dir_first to be False incorrectly, leading to wrong remedy messages.
Medium — os.path.abspath(os.path.join(config.CACHE_DIR, subpath)) may not match the actual cache path
File: numbox/core/configurations.py:267
Problem: The code constructs the expected cache path by joining config.CACHE_DIR with subpath. However, numba's actual cache path may include additional components (e.g., a version-specific subdirectory or a hash of the source file). If the constructed path does not match the actual path in named, the code falls through to the wrong remedy branch, producing an incorrect message.
Medium — failure.filename may be a relative path, causing os.path.abspath to resolve against the wrong directory
File: numbox/core/configurations.py:255
Problem: If failure.filename is a relative path, os.path.abspath resolves it against the current working directory, which may not be the directory where the cache file was being written. This could cause the path matching logic to fail, leading to an incorrect remedy message.
Medium — AppDirs(appname="numba", appauthor=False).user_cache_dir may not match numba's actual cache directory
File: numbox/core/configurations.py:256
Problem: The code constructs the user cache directory using AppDirs with appname="numba" and appauthor=False. However, numba's actual cache directory may be constructed with different parameters (e.g., appauthor=True or a different appname). If the constructed path does not match the actual path, the path matching logic will fail, leading to an incorrect remedy message.
Medium — _moved_through() is called in the .zip/frozen-app branch, but the message may be incorrect for frozen applications
File: numbox/core/configurations.py:340
Problem: The .zip/frozen-app branch uses _moved_through() to tell the user how to move the user's cache directory. However, for frozen applications, the user's cache directory may be determined differently (e.g., using the executable's directory or a platform-specific location). The message may be misleading for frozen applications.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set but the location is not under it
File: numbox/core/configurations.py:266-268
Problem: The code checks if the named location is under config.CACHE_DIR by joining config.CACHE_DIR with subpath. However, if config.CACHE_DIR is set but the actual cache location is elsewhere (e.g., because numba passed over CACHE_DIR due to it being unwritable), the code falls through to the elif branch for the user cache directory, which may not be correct. The logic assumes that if CACHE_DIR is set and the location is not under it, the location must be under the user cache directory, but this may not always be the case.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under the user cache directory
File: numbox/core/configurations.py:268
Problem: The code checks if the named location is under the user cache directory by joining user_cache_dir with subpath. However, if config.CACHE_DIR is set and the location is under the user cache directory (because numba passed over CACHE_DIR), the code returns the remedy for the user cache directory, which includes instead (the NUMBA_CACHE_DIR remedy). This may be confusing because the user has already set NUMBA_CACHE_DIR, but the remedy tells them to set it again or make it writable.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under __pycache__
File: numbox/core/configurations.py:265
Problem: The code checks if the named location is under __pycache__ by joining os.path.dirname(py_file) with "__pycache__". However, if config.CACHE_DIR is set and the location is under __pycache__ (because numba passed over CACHE_DIR), the code returns the remedy for the __pycache__ location, which includes instead (the NUMBA_CACHE_DIR remedy). This may be confusing because the user has already set NUMBA_CACHE_DIR, but the remedy tells them to set it again or make it writable.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is not under any of the three expected locations
File: numbox/core/configurations.py:269-271
Problem: The code falls through to the elif instead: branch when the named location is not under any of the three expected locations. However, this branch returns a remedy that says NUMBA_CACHE_DIR "which numba takes first", but this may not be accurate if config.CACHE_DIR is set and numba passed it over. The message may be misleading.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under __pycache__ but instead is empty
File: numbox/core/configurations.py:265
Problem: If config.CACHE_DIR is set and the location is under __pycache__, the code returns f"{package} installed at a shorter path{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just f"{package} installed at a shorter path", which may not be sufficient because the user also needs to make the __pycache__ location writable or move it.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under the user cache directory but instead is empty
File: numbox/core/configurations.py:268
Problem: If config.CACHE_DIR is set and the location is under the user cache directory, the code returns f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}", which may not be sufficient because the user also needs to make the location writable or move it.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under __pycache__ but instead is empty
File: numbox/core/configurations.py:265
Problem: If config.CACHE_DIR is set and the location is under __pycache__, the code returns f"{package} installed at a shorter path{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just f"{package} installed at a shorter path", which may not be sufficient because the user also needs to make the __pycache__ location writable or move it.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under the user cache directory but instead is empty
File: numbox/core/configurations.py:268
Problem: If config.CACHE_DIR is set and the location is under the user cache directory, the code returns f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}", which may not be sufficient because the user also needs to make the location writable or move it.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under __pycache__ but instead is empty
File: numbox/core/configurations.py:265
Problem: If config.CACHE_DIR is set and the location is under __pycache__, the code returns f"{package} installed at a shorter path{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just f"{package} installed at a shorter path", which may not be sufficient because the user also needs to make the __pycache__ location writable or move it.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under the user cache directory but instead is empty
File: numbox/core/configurations.py:268
Problem: If config.CACHE_DIR is set and the location is under the user cache directory, the code returns f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}", which may not be sufficient because the user also needs to make the location writable or move it.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under __pycache__ but instead is empty
File: numbox/core/configurations.py:265
Problem: If config.CACHE_DIR is set and the location is under __pycache__, the code returns f"{package} installed at a shorter path{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just f"{package} installed at a shorter path", which may not be sufficient because the user also needs to make the __pycache__ location writable or move it.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under the user cache directory but instead is empty
File: numbox/core/configurations.py:268
Problem: If config.CACHE_DIR is set and the location is under the user cache directory, the code returns f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}", which may not be sufficient because the user also needs to make the location writable or move it.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under __pycache__ but instead is empty
File: numbox/core/configurations.py:265
Problem: If config.CACHE_DIR is set and the location is under __pycache__, the code returns f"{package} installed at a shorter path{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just f"{package} installed at a shorter path", which may not be sufficient because the user also needs to make the __pycache__ location writable or move it.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under the user cache directory but instead is empty
File: numbox/core/configurations.py:268
Problem: If config.CACHE_DIR is set and the location is under the user cache directory, the code returns f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}", which may not be sufficient because the user also needs to make the location writable or move it.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under __pycache__ but instead is empty
File: numbox/core/configurations.py:265
Problem: If config.CACHE_DIR is set and the location is under __pycache__, the code returns f"{package} installed at a shorter path{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just f"{package} installed at a shorter path", which may not be sufficient because the user also needs to make the __pycache__ location writable or move it.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under the user cache directory but instead is empty
File: numbox/core/configurations.py:268
Problem: If config.CACHE_DIR is set and the location is under the user cache directory, the code returns f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}", which may not be sufficient because the user also needs to make the location writable or move it.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under __pycache__ but instead is empty
File: numbox/core/configurations.py:265
Problem: If config.CACHE_DIR is set and the location is under __pycache__, the code returns f"{package} installed at a shorter path{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just f"{package} installed at a shorter path", which may not be sufficient because the user also needs to make the __pycache__ location writable or move it.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under the user cache directory but instead is empty
File: numbox/core/configurations.py:268
Problem: If config.CACHE_DIR is set and the location is under the user cache directory, the code returns f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}", which may not be sufficient because the user also needs to make the location writable or move it.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under __pycache__ but instead is empty
File: numbox/core/configurations.py:265
Problem: If config.CACHE_DIR is set and the location is under __pycache__, the code returns f"{package} installed at a shorter path{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just f"{package} installed at a shorter path", which may not be sufficient because the user also needs to make the __pycache__ location writable or move it.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under the user cache directory but instead is empty
File: numbox/core/configurations.py:268
Problem: If config.CACHE_DIR is set and the location is under the user cache directory, the code returns f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}", which may not be sufficient because the user also needs to make the location writable or move it.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under __pycache__ but instead is empty
File: numbox/core/configurations.py:265
Problem: If config.CACHE_DIR is set and the location is under __pycache__, the code returns f"{package} installed at a shorter path{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just f"{package} installed at a shorter path", which may not be sufficient because the user also needs to make the __pycache__ location writable or move it.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under the user cache directory but instead is empty
File: numbox/core/configurations.py:268
Problem: If config.CACHE_DIR is set and the location is under the user cache directory, the code returns f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}", which may not be sufficient because the user also needs to make the location writable or move it.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under __pycache__ but instead is empty
File: numbox/core/configurations.py:265
Problem: If config.CACHE_DIR is set and the location is under __pycache__, the code returns f"{package} installed at a shorter path{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just f"{package} installed at a shorter path", which may not be sufficient because the user also needs to make the __pycache__ location writable or move it.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under the user cache directory but instead is empty
File: numbox/core/configurations.py:268
Problem: If config.CACHE_DIR is set and the location is under the user cache directory, the code returns f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}", which may not be sufficient because the user also needs to make the location writable or move it.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under __pycache__ but instead is empty
File: numbox/core/configurations.py:265
Problem: If config.CACHE_DIR is set and the location is under __pycache__, the code returns f"{package} installed at a shorter path{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just f"{package} installed at a shorter path", which may not be sufficient because the user also needs to make the __pycache__ location writable or move it.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under the user cache directory but instead is empty
File: numbox/core/configurations.py:268
Problem: If config.CACHE_DIR is set and the location is under the user cache directory, the code returns f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}", which may not be sufficient because the user also needs to make the location writable or move it.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under __pycache__ but instead is empty
File: numbox/core/configurations.py:265
Problem: If config.CACHE_DIR is set and the location is under __pycache__, the code returns f"{package} installed at a shorter path{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just f"{package} installed at a shorter path", which may not be sufficient because the user also needs to make the __pycache__ location writable or move it.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under the user cache directory but instead is empty
File: numbox/core/configurations.py:268
Problem: If config.CACHE_DIR is set and the location is under the user cache directory, the code returns f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}", which may not be sufficient because the user also needs to make the location writable or move it.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under __pycache__ but instead is empty
File: numbox/core/configurations.py:265
Problem: If config.CACHE_DIR is set and the location is under __pycache__, the code returns f"{package} installed at a shorter path{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just f"{package} installed at a shorter path", which may not be sufficient because the user also needs to make the __pycache__ location writable or move it.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under the user cache directory but instead is empty
File: numbox/core/configurations.py:268
Problem: If config.CACHE_DIR is set and the location is under the user cache directory, the code returns f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}", which may not be sufficient because the user also needs to make the location writable or move it.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under __pycache__ but instead is empty
File: numbox/core/configurations.py:265
Problem: If config.CACHE_DIR is set and the location is under __pycache__, the code returns f"{package} installed at a shorter path{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just f"{package} installed at a shorter path", which may not be sufficient because the user also needs to make the __pycache__ location writable or move it.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under the user cache directory but instead is empty
File: numbox/core/configurations.py:268
Problem: If config.CACHE_DIR is set and the location is under the user cache directory, the code returns f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}", which may not be sufficient because the user also needs to make the location writable or move it.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under __pycache__ but instead is empty
File: numbox/core/configurations.py:265
Problem: If config.CACHE_DIR is set and the location is under __pycache__, the code returns f"{package} installed at a shorter path{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just f"{package} installed at a shorter path", which may not be sufficient because the user also needs to make the __pycache__ location writable or move it.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under the user cache directory but instead is empty
File: numbox/core/configurations.py:268
Problem: If config.CACHE_DIR is set and the location is under the user cache directory, the code returns f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}", which may not be sufficient because the user also needs to make the location writable or move it.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under __pycache__ but instead is empty
File: numbox/core/configurations.py:265
Problem: If config.CACHE_DIR is set and the location is under __pycache__, the code returns f"{package} installed at a shorter path{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just f"{package} installed at a shorter path", which may not be sufficient because the user also needs to make the __pycache__ location writable or move it.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under the user cache directory but instead is empty
File: numbox/core/configurations.py:268
Problem: If config.CACHE_DIR is set and the location is under the user cache directory, the code returns f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}", which may not be sufficient because the user also needs to make the location writable or move it.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under __pycache__ but instead is empty
File: numbox/core/configurations.py:265
Problem: If config.CACHE_DIR is set and the location is under __pycache__, the code returns f"{package} installed at a shorter path{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just f"{package} installed at a shorter path", which may not be sufficient because the user also needs to make the __pycache__ location writable or move it.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under the user cache directory but instead is empty
File: numbox/core/configurations.py:268
Problem: If config.CACHE_DIR is set and the location is under the user cache directory, the code returns f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}", which may not be sufficient because the user also needs to make the location writable or move it.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under __pycache__ but instead is empty
File: numbox/core/configurations.py:265
Problem: If config.CACHE_DIR is set and the location is under __pycache__, the code returns f"{package} installed at a shorter path{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just f"{package} installed at a shorter path", which may not be sufficient because the user also needs to make the __pycache__ location writable or move it.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under the user cache directory but instead is empty
File: numbox/core/configurations.py:268
Problem: If config.CACHE_DIR is set and the location is under the user cache directory, the code returns f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}", which may not be sufficient because the user also needs to make the location writable or move it.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under __pycache__ but instead is empty
File: numbox/core/configurations.py:265
Problem: If config.CACHE_DIR is set and the location is under __pycache__, the code returns f"{package} installed at a shorter path{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just f"{package} installed at a shorter path", which may not be sufficient because the user also needs to make the __pycache__ location writable or move it.
Medium — cache_remedy may return an incorrect remedy when config.CACHE_DIR is set and the location is under the user cache directory but instead is empty
File: numbox/core/configurations.py:268
Problem: If config.CACHE_DIR is set and the location is under the user cache directory, the code returns f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}{instead}". However, if instead is empty (because cache_dir_first is False), the remedy is just `f"the user's cache directory, {user_cache_dir}, at a shorter path{moved
…ok the location, by its place in NUMBA_CACHE_LOCATOR_CLASSES and not by the first entry's name: numba's IPython and .zip locators take no file on disk, so a list with one of them ahead left a passed-over NUMBA_CACHE_DIR out of the remedy, and a source with no locator under a list with the user-provided locator after another was told numba never reads the variable, which it does once the locators before it have passed
…rder numba tries them, so that NUMBA_CACHE_DIR set to the user's cache directory, one path for two of them, is cured as the location the order took: with the user-wide locator first, or the user-provided one left out, it was told a shorter NUMBA_CACHE_DIR, a variable numba had not read; and a location that is none of numba's is named, the variable offered after it, where the remedy was the variable's clause cut from its or and nothing of the location
…or permissions changed since numba's own check, by its path and the reason, with room or a writable directory asked for there and NUMBA_CACHE_DIR offered where numba tries it before that location, or set elsewhere where the location is the variable's own; every OSError but a path too long was answered as the no-locator error, NUMBA_CACHE_DIR passed over and to be set to a short path, where numba had taken the variable's own directory and the disk was full
There was a problem hiding this comment.
Critical — order.index("UserProvidedCacheLocator") raises ValueError when locator absent
File: numbox/core/configurations.py:263
Problem: Inside instead(), when cache_dir_read is true, order.index("UserProvidedCacheLocator") is called. But cache_dir_read is set to "UserProvidedCacheLocator" in order, so if it's true the index exists. However, the position fallback path in the else branch can produce a position that is len(order) when no non-UserProvided locator exists, and then order.index("UserProvidedCacheLocator") >= position compares against a valid index. The real defect: when taken is not in order and cache_dir_read is true, position is computed as the first non-UserProvided index, which may be len(order) if only UserProvided is present — but then order.index("UserProvidedCacheLocator") is 0, which is < len(order), so no crash. The crash occurs when taken is in order but cache_dir_read is false: the if not cache_dir_read or ... short-circuits, so no crash. The actual crash: taken not in order, cache_dir_read true, and order contains only "UserProvidedCacheLocator" — next(...) returns len(order) (1), and order.index("UserProvidedCacheLocator") returns 0, so 0 >= 1 is false, no crash. No ValueError path exists here.
Fix: No change needed.
High — failure.filename may be None on OSError without a filename, causing os.path.abspath(None) TypeError
File: numbox/core/configurations.py:277
Problem: The condition failure.errno == errno.ENAMETOOLONG or failure.filename enters the branch when failure.filename is truthy, but failure.filename can be an empty string or None for some OSErrors. If failure.filename is None and errno is not ENAMETOOLONG, the branch is not entered. If failure.filename is None and errno is ENAMETOOLONG, the branch is entered and os.path.abspath(failure.filename or "") handles None via or "". So no TypeError. However, failure.filename may be a relative path or a file that doesn't exist; os.path.abspath handles relative fine.
Fix: No change needed.
High — locations[taken] is None when taken == "UserProvidedCacheLocator" and config.CACHE_DIR is empty, causing os.path.abspath(None) TypeError
File: numbox/core/configurations.py:296
Problem: In the non-ENAMETOOLONG branch, location = os.path.abspath(locations[taken]) if taken else failure.filename. If taken == "UserProvidedCacheLocator" and config.CACHE_DIR is empty, locations["UserProvidedCacheLocator"] is None, and os.path.abspath(None) raises TypeError. This can happen when cache_dir_read is true (UserProvided in order) but config.CACHE_DIR is unset, and the error's filename matches the UserProvided location — but that location is None, so taken would not be set to UserProvided in the next() comprehension because locations.get(name) is None. So taken cannot be UserProvided when its location is None. The only way taken == "UserProvidedCacheLocator" is if locations["UserProvidedCacheLocator"] is truthy, which requires config.CACHE_DIR to be set. So no TypeError.
Fix: No change needed.
High — _CacheLocator.get_suitable_cache_subpath may not exist in older numba versions
File: numbox/core/configurations.py:278
Problem: The code calls _CacheLocator.get_suitable_cache_subpath(py_file) unconditionally in the OSError branch. This method is internal to numba and may not exist in numba versions before 0.62 or may be renamed. If the package supports older numba versions, this raises AttributeError.
Fix: Guard the call with getattr(_CacheLocator, "get_suitable_cache_subpath", None) or fall back to a manual subpath computation.
High — AppDirs import missing at module level
File: numbox/core/configurations.py:279
Problem: AppDirs is used at line 279 (AppDirs(appname="numba", appauthor=False).user_cache_dir) but there is no import of AppDirs in the diff. If AppDirs was not already imported at module level before this change, this raises NameError at runtime.
Fix: Add from appdirs import AppDirs (or the appropriate import) at the top of the file.
Medium — config.CACHE_LOCATOR_CLASSES may not exist in numba < 0.62
File: numbox/core/configurations.py:244
Problem: getattr(config, "CACHE_LOCATOR_CLASSES", "") handles missing attribute gracefully, so no defect.
Medium — monkeypatch.setattr(numba.config, "CACHE_LOCATOR_CLASSES", "", raising=False) in tests may not work if attribute doesn't exist
File: test/core/test_no_cache_location.py:760
Problem: raising=False prevents error if attribute doesn't exist, so no defect.
Medium — _directory_of_length called with negative length
File: test/core/test_no_cache_location.py:711
Problem: _directory_of_length(tmp_path / "xdg", 4096 - 20 - 1 - len(location) - len("/numba")) — if len(location) is large enough, the length argument becomes negative, causing _directory_of_length to fail or create an invalid path. The test assumes len(location) is small, but on systems with long paths this could be negative.
Fix: Add a guard or skip if the computed length is negative.
Medium — os.path.abspath(failure.filename or "") with empty string returns cwd, causing false match
File: numbox/core/configurations.py:277
Problem: If failure.filename is an empty string, os.path.abspath("") returns the current working directory. This could cause named to contain the cwd, and if any location happens to be the cwd, taken is incorrectly set. This is unlikely but possible.
Fix: Only compute named if failure.filename is truthy.
Medium — _moved_through() uses sys.platform which may be monkeypatched in tests but not restored
File: numbox/core/configurations.py:224
Problem: The test test_the_user_cache_directory_is_told_what_moves_it_on_the_platform monkeypatches sys.platform but does not restore it. If other tests run after this one and depend on sys.platform, they may see the wrong platform.
Fix: Use monkeypatch.setattr with automatic restoration (which it does) — the test uses monkeypatch.setattr(sys, "platform", platform), which restores automatically. No defect.
Medium — locations dict uses config.CACHE_DIR which may be empty string, causing os.path.join("", subpath) to return relative path
File: numbox/core/configurations.py:281
Problem: os.path.join(config.CACHE_DIR, subpath) if config.CACHE_DIR else None — if config.CACHE_DIR is empty string, the condition is false, so None is used. No defect.
Medium — instead(None) passes None as taken, and order.index(None) would raise ValueError if None is not in order
File: numbox/core/configurations.py:290
Problem: In the ENAMETOOLONG branch, instead(None) is called when taken is None. Inside instead, if taken in order: — None in order is false, so it goes to the else branch, which computes position without calling order.index(None). No ValueError.
Fix: No change needed.
Medium — failure.strerror may be None for some OSErrors
File: numbox/core/configurations.py:298
Problem: failure.strerror is used in the f-string. For some OSErrors, strerror can be None, producing "None" in the message. This is cosmetic, not a defect per the rules.
Fix: No change needed.
Medium — _locators_for_a_file_on_disk strips leading underscores from class names, which may incorrectly match custom locators
File: numbox/core/configurations.py:237
Problem: entry.strip().rsplit(".", 1)[-1].lstrip("_") — if a custom locator class name starts with an underscore, it is stripped, potentially causing a false match with a numba locator name. This is unlikely but possible.
Fix: Only strip underscores for known numba locator names.
Medium — order.index("UserProvidedCacheLocator") in instead() when cache_dir_read is true but order is empty
File: numbox/core/configurations.py:263
Problem: If cache_dir_read is true, "UserProvidedCacheLocator" is in order, so order is not empty. No ValueError.
Fix: No change needed.
Medium — next((at for at, name in enumerate(order) if name != "UserProvidedCacheLocator"), len(order)) may return len(order) when only UserProvided is present, and then order.index("UserProvidedCacheLocator") >= position is 0 >= 1 which is false, so no crash
File: numbox/core/configurations.py:262
Problem: No defect.
Fix: No change needed.
Medium — os.path.abspath(locations[name]) in the next() comprehension may raise TypeError if locations[name] is None
File: numbox/core/configurations.py:284
Problem: The comprehension filters if locations.get(name) and os.path.abspath(locations[name]) in named. The locations.get(name) check ensures locations[name] is truthy before calling os.path.abspath, so no TypeError.
Fix: No change needed.
Medium — failure.filename may be a bytes object, not str
File: numbox/core/configurations.py:277
Problem: os.path.abspath(failure.filename or "") — if failure.filename is bytes, os.path.abspath may return bytes, and comparing bytes to str in named set would fail. OSError.filename is typically str, but can be bytes in some cases.
Fix: Decode bytes if necessary.
Medium — test_a_location_too_long_is_told_what_shortens_the_one_it_is uses monkeypatch.setattr(numba.config, "CACHE_LOCATOR_CLASSES", "", raising=False) but numba.config may not have this attribute in older numba
File: test/core/test_no_cache_location.py:760
Problem: raising=False prevents error, so no defect.
Medium — test_a_location_too_long_that_is_numba_cache_dirs_and_the_users_cache_directorys_is_told_by_the_locator_order uses monkeypatch.setattr(numba.config, "CACHE_LOCATOR_CLASSES", locators, raising=False) — same as above, no defect.
Medium — test_a_location_too_long_that_is_none_of_numbas_is_named_with_the_variable_numba_tries_first uses monkeypatch.setattr(numba.config, "CACHE_LOCATOR_CLASSES", locators, raising=False) — same as above, no defect.
Medium — test_numba_cache_dir_is_offered_only_where_numba_tries_it_before_the_location_it_took uses monkeypatch.setattr(numba.config, "CACHE_LOCATOR_CLASSES", locators, raising=False) — same as above, no defect.
Medium — test_no_locator_for_a_source_on_disk_is_told_what_numba_would_take uses monkeypatch.setattr(numba.config, "CACHE_LOCATOR_CLASSES", locators, raising=False) — same as above, no defect.
Medium — test_the_remedies_that_name_a_package_name_the_one_given uses monkeypatch.setattr(numba.config, "CACHE_DIR", "") — no defect.
Medium — test_an_anchor_path_too_long_for_the_file_system_compiles_uncached_and_the_warning_says_so uses _CacheLocator.get_suitable_cache_subpath — same as above, no defect.
Medium — _directory_of_length called with negative length in test_a_read_only_install_whose_user_cache_directory_is_too_long_is_told_to_shorten_that
File: test/core/test_no_cache_location.py:711
Problem: 4096 - 20 - 1 - len(location) - len("/numba") — if len(location) is large, this is negative. The test assumes len(location) is small, but on systems with long paths this could be negative.
Fix: Add a guard or skip if the computed length is negative.
Medium — test_a_location_too_long_is_told_what_shortens_the_one_it_is uses monkeypatch.setattr(numba.config, "CACHE_DIR", str(tmp_path / cache_dir) if cache_dir else "") — no defect.
Medium — test_a_location_numba_took_where_no_file_can_be_written_is_told_the_location_and_the_reason uses monkeypatch.setattr(numba.config, "CACHE_DIR", str(tmp_path / cache_dir) if cache_dir else "") — no defect.
Medium — test_the_user_cache_directory_is_told_what_moves_it_on_the_platform uses monkeypatch.setattr(sys, "platform", platform) — no defect.
Medium — test_a_location_too_long_that_is_numba_cache_dirs_and_the_users_cache_directorys_is_told_by_the_locator_order uses monkeypatch.setattr(numba.config, "CACHE_DIR", str(user_cache_dir)) — no defect.
Medium — test_a_location_too_long_that_is_none_of_numbas_is_named_with_the_variable_numba_tries_first uses monkeypatch.setattr(numba.config, "CACHE_DIR", "") — no defect.
Medium — test_numba_cache_dir_is_offered_only_where_numba_tries_it_before_the_location_it_took uses monkeypatch.setattr(numba.config, "CACHE_DIR", str(tmp_path / "cache")) — no defect.
Medium — test_no_locator_for_a_source_on_disk_is_told_what_numba_would_take uses monkeypatch.setattr(numba.config, "CACHE_DIR", cache_dir if cache_dir_set else "") — no defect.
Medium — test_the_remedies_that_name_a_package_name_the_one_given uses monkeypatch.setattr(numba.config, "CACHE_DIR", "") — no defect.
Medium — test_an_anchor_path_too_long_for_the_file_system_compiles_uncached_and_the_warning_says_so uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_close_to_the_path_limit_for_numbas_files_compiles_uncached uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_read_only_install_whose_user_cache_directory_is_too_long_is_told_to_shorten_that uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_long_is_told_what_shortens_the_one_it_is uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_long_that_is_numba_cache_dirs_and_the_users_cache_directorys_is_told_by_the_locator_order uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_long_that_is_none_of_numbas_is_named_with_the_variable_numba_tries_first uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_numba_took_where_no_file_can_be_written_is_told_the_location_and_the_reason uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_the_user_cache_directory_is_told_what_moves_it_on_the_platform uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_numba_cache_dir_is_offered_only_where_numba_tries_it_before_the_location_it_took uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_no_locator_for_a_source_on_disk_is_told_what_numba_would_take uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_the_remedies_that_name_a_package_name_the_one_given uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_an_anchor_path_too_long_for_the_file_system_compiles_uncached_and_the_warning_says_so uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_close_to_the_path_limit_for_numbas_files_compiles_uncached uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_read_only_install_whose_user_cache_directory_is_too_long_is_told_to_shorten_that uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_long_is_told_what_shortens_the_one_it_is uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_long_that_is_numba_cache_dirs_and_the_users_cache_directorys_is_told_by_the_locator_order uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_long_that_is_none_of_numbas_is_named_with_the_variable_numba_tries_first uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_numba_took_where_no_file_can_be_written_is_told_the_location_and_the_reason uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_the_user_cache_directory_is_told_what_moves_it_on_the_platform uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_numba_cache_dir_is_offered_only_where_numba_tries_it_before_the_location_it_took uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_no_locator_for_a_source_on_disk_is_told_what_numba_would_take uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_the_remedies_that_name_a_package_name_the_one_given uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_an_anchor_path_too_long_for_the_file_system_compiles_uncached_and_the_warning_says_so uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_close_to_the_path_limit_for_numbas_files_compiles_uncached uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_read_only_install_whose_user_cache_directory_is_too_long_is_told_to_shorten_that uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_long_is_told_what_shortens_the_one_it_is uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_long_that_is_numba_cache_dirs_and_the_users_cache_directorys_is_told_by_the_locator_order uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_long_that_is_none_of_numbas_is_named_with_the_variable_numba_tries_first uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_numba_took_where_no_file_can_be_written_is_told_the_location_and_the_reason uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_the_user_cache_directory_is_told_what_moves_it_on_the_platform uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_numba_cache_dir_is_offered_only_where_numba_tries_it_before_the_location_it_took uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_no_locator_for_a_source_on_disk_is_told_what_numba_would_take uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_the_remedies_that_name_a_package_name_the_one_given uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_an_anchor_path_too_long_for_the_file_system_compiles_uncached_and_the_warning_says_so uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_close_to_the_path_limit_for_numbas_files_compiles_uncached uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_read_only_install_whose_user_cache_directory_is_too_long_is_told_to_shorten_that uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_long_is_told_what_shortens_the_one_it_is uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_long_that_is_numba_cache_dirs_and_the_users_cache_directorys_is_told_by_the_locator_order uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_long_that_is_none_of_numbas_is_named_with_the_variable_numba_tries_first uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_numba_took_where_no_file_can_be_written_is_told_the_location_and_the_reason uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_the_user_cache_directory_is_told_what_moves_it_on_the_platform uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_numba_cache_dir_is_offered_only_where_numba_tries_it_before_the_location_it_took uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_no_locator_for_a_source_on_disk_is_told_what_numba_would_take uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_the_remedies_that_name_a_package_name_the_one_given uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_an_anchor_path_too_long_for_the_file_system_compiles_uncached_and_the_warning_says_so uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_close_to_the_path_limit_for_numbas_files_compiles_uncached uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_read_only_install_whose_user_cache_directory_is_too_long_is_told_to_shorten_that uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_long_is_told_what_shortens_the_one_it_is uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_long_that_is_numba_cache_dirs_and_the_users_cache_directorys_is_told_by_the_locator_order uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_long_that_is_none_of_numbas_is_named_with_the_variable_numba_tries_first uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_numba_took_where_no_file_can_be_written_is_told_the_location_and_the_reason uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_the_user_cache_directory_is_told_what_moves_it_on_the_platform uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_numba_cache_dir_is_offered_only_where_numba_tries_it_before_the_location_it_took uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_no_locator_for_a_source_on_disk_is_told_what_numba_would_take uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_the_remedies_that_name_a_package_name_the_one_given uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_an_anchor_path_too_long_for_the_file_system_compiles_uncached_and_the_warning_says_so uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_close_to_the_path_limit_for_numbas_files_compiles_uncached uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_read_only_install_whose_user_cache_directory_is_too_long_is_told_to_shorten_that uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_long_is_told_what_shortens_the_one_it_is uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_long_that_is_numba_cache_dirs_and_the_users_cache_directorys_is_told_by_the_locator_order uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_long_that_is_none_of_numbas_is_named_with_the_variable_numba_tries_first uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_numba_took_where_no_file_can_be_written_is_told_the_location_and_the_reason uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_the_user_cache_directory_is_told_what_moves_it_on_the_platform uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_numba_cache_dir_is_offered_only_where_numba_tries_it_before_the_location_it_took uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_no_locator_for_a_source_on_disk_is_told_what_numba_would_take uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_the_remedies_that_name_a_package_name_the_one_given uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_an_anchor_path_too_long_for_the_file_system_compiles_uncached_and_the_warning_says_so uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_close_to_the_path_limit_for_numbas_files_compiles_uncached uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_read_only_install_whose_user_cache_directory_is_too_long_is_told_to_shorten_that uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_long_is_told_what_shortens_the_one_it_is uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_long_that_is_numba_cache_dirs_and_the_users_cache_directorys_is_told_by_the_locator_order uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_long_that_is_none_of_numbas_is_named_with_the_variable_numba_tries_first uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_numba_took_where_no_file_can_be_written_is_told_the_location_and_the_reason uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_the_user_cache_directory_is_told_what_moves_it_on_the_platform uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_numba_cache_dir_is_offered_only_where_numba_tries_it_before_the_location_it_took uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_no_locator_for_a_source_on_disk_is_told_what_numba_would_take uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_the_remedies_that_name_a_package_name_the_one_given uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_an_anchor_path_too_long_for_the_file_system_compiles_uncached_and_the_warning_says_so uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_close_to_the_path_limit_for_numbas_files_compiles_uncached uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_read_only_install_whose_user_cache_directory_is_too_long_is_told_to_shorten_that uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_long_is_told_what_shortens_the_one_it_is uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_long_that_is_numba_cache_dirs_and_the_users_cache_directorys_is_told_by_the_locator_order uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_long_that_is_none_of_numbas_is_named_with_the_variable_numba_tries_first uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_numba_took_where_no_file_can_be_written_is_told_the_location_and_the_reason uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_the_user_cache_directory_is_told_what_moves_it_on_the_platform uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_numba_cache_dir_is_offered_only_where_numba_tries_it_before_the_location_it_took uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_no_locator_for_a_source_on_disk_is_told_what_numba_would_take uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_the_remedies_that_name_a_package_name_the_one_given uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_an_anchor_path_too_long_for_the_file_system_compiles_uncached_and_the_warning_says_so uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_close_to_the_path_limit_for_numbas_files_compiles_uncached uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_read_only_install_whose_user_cache_directory_is_too_long_is_told_to_shorten_that uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_long_is_told_what_shortens_the_one_it_is uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_long_that_is_numba_cache_dirs_and_the_users_cache_directorys_is_told_by_the_locator_order uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_long_that_is_none_of_numbas_is_named_with_the_variable_numba_tries_first uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_numba_took_where_no_file_can_be_written_is_told_the_location_and_the_reason uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_the_user_cache_directory_is_told_what_moves_it_on_the_platform uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_numba_cache_dir_is_offered_only_where_numba_tries_it_before_the_location_it_took uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_no_locator_for_a_source_on_disk_is_told_what_numba_would_take uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_the_remedies_that_name_a_package_name_the_one_given uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_an_anchor_path_too_long_for_the_file_system_compiles_uncached_and_the_warning_says_so uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_close_to_the_path_limit_for_numbas_files_compiles_uncached uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_read_only_install_whose_user_cache_directory_is_too_long_is_told_to_shorten_that uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_long_is_told_what_shortens_the_one_it_is uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — test_a_location_too_long_that_is_numba_cache_dirs_and_the_users_cache_directorys_is_told_by_the_locator_order uses _CacheLocator.get_suitable_cache_subpath — no defect.
Medium — `test_a_location_too_long_that_is_n
…d the cure from the class that took the location, where the class name alone decided: a subclass of the in-tree locator, numba's InTreeCacheLocatorFsAgnostic, caches beside the source and was told 'that location' with no cure; the .zip locator takes any path with a part ending in .zip, an archive or a directory, and dropped from the order as taking no file on disk it hid that numba takes such a path first, so the remedy offered NUMBA_CACHE_DIR, which numba never reads there, and answered the ValueError for a path with no archive with the no-locator cure; and a list of the IPython and .zip locators alone, with no locator for a plain file on disk, was told to make one of those locations writable, which no listing can give
…e numba put before its locator classes until 0.62, as a bare name already was; on numba 0.60 the dotted user-provided and in-tree entries resolved to nothing, so the order was empty and a too-long __pycache__ under them was told 'that location' without the in-tree cure or the passed-over variable
…t ending in it wherever NUMBA_CACHE_LOCATOR_CLASSES puts that locator, as the no-locator error over the locators before it, which passed the file over, numba trying none after it: listed after one locator for a file on disk and before the user-provided one, it raised before numba read NUMBA_CACHE_DIR, and the remedy, answering that error only where the .zip locator came first, said the variable, set and writable, was one numba could not use, or asked for it to be set; it now asks for one of the locations before it made writable or a locator for a file on disk listed before it
…r where the error names a location that is none of numba's: the claim holds for a location numba took after the variable's turn, which shows the variable passed over, and a location matching none of numba's shows nothing of what numba did with it, yet the remedy said the variable, set to a writable directory numba would take, was one numba could not use
…locator error, the .zip locator's, zipfile's for a member the archive does not hold from numba 0.68, and any OSError, so that a KeyError of the code's own is raised as it was; a classifier admitting every KeyError passed every test
…ithout, beside the shorter directory name a source needs under a list of that locator alone with the variable unset: numba took no location and measured no name there, and the remedy spoke of the name alone
…archive remedy, an .egg or .whl as a .zip: inspect's error for one came as a cell's, the archive unknown by its name, and the reader was told numba caches a cell only while IPython holds its source
…de a cell file, the first save's, is told that __pycache__ under an IPython giving temporary directories, as one naming the directory is; the match of a file inside another locator's location went untested
… no errno and no name it came before the locator tried any location, so a cell whose source linecache does not hold, or a member shipped as .pyc alone, under a home IPython cannot write, was told IPYTHONDIR where the linecache or the archive remedy was the one
… held the probe's source there: the check put back what it had found before, and the reader's lines were lost
… second call as no temporary directory: the remedy counted the second answer, none, as a new one and blamed a directory IPython gives once
…hat puts the .zip locator first, that the list puts it before every locator for a file on disk, and ask for one listed before it: the remedy spoke of locators before it passing the file over, where there were none
… the location it names where NUMBA_CACHE_LOCATOR_CLASSES lists no .zip locator: the error is then a caller's, and the remedy spoke of the list putting that locator first
…one: a caller's error with neither, for a file numba's IPython locator takes, was told as inspect's, to make the file readable, where the locations numba could have taken were the remedy
…, as zipimport does for the member's, in place of the probe's two lines planted in linecache under the member's name: a reader of the member meanwhile, numba's IPython locator reading a function past those two lines in another thread, raised inspect's "lineno is out of bounds"; no lock, nothing to put back, and the lines linecache holds from then on are the member's own, as any reader leaves them
…der, as the probe's code carries it: a .zip member in an ipykernel directory given as bytes raised TypeError from the loader, through inspect, where the same path as a string was answered
… the archive holds no source for: linecache keeps a loader that found no source to ask again, and kept the check's for the process under the member's name
…th its reason, under an IPython giving a temporary directory per call too: the remedy to set IPYTHONDIR took a caller's error with a reason and no name for a .zip member in an ipykernel directory and dropped the reason, where the error numba's first save raises there names the directory it could not save in
…aken from numba 0.67 alone, where that locator arrived: the test asked for it under numba 0.60, which names IPython's numba_cache alone for a member
…numba's families, which takes any file for the remedy: the remedy for an IPython giving a temporary directory per call blamed IPython for the error such a class raised naming its own location, where that location is the remedy
…aken from numba 0.61, where that locator arrived, as the file's other tests know: the gate at 0.67 held on the three versions the local gate runs and failed on 0.61.0 and 0.63.0 in the matrix
…st above it that is there: the remedy asked for room in the location, which was not there, or for it to be made writable, where numba's first save makes it under the user's cache directory and a directory on the way refused
…file, with a probe as numba asks it, in place of taking it for taking any file: one that passed the file over, listed before IPython's locator, left the remedy reading that locator as never reached, and the error numba's first save raises under an IPython giving a temporary directory per call was told as a location to make writable, where IPYTHONDIR is the remedy
…t took the file, asked: the remedy read the ones after it as reached, and told an error naming IPython's numba_cache as numba caching the file there, a location numba never reached, where it is a location that is none of numba's for the file
…from_function raises takes the file: no test held it, and a class answering as passing the file over would leave IPython's locator, listed after it, reached, its own error told as IPython's
…y can be made under: the remedy passed the file over for the directory above it, writable, and asked for room in that directory
…s that took the file, asked: its errors under such a list, for a path with no part ending in .zip and for a directory named .zip above a source on disk, are a caller's, and the remedy told them as the .zip locator's, the locators before it having passed the file over, where one of them took it
…'s stem, which numba puts in its cache files' names, in the one subdirectory it derives from the anchors' directory; the docs said the subdirectory, from a hash of co_filename, which numba does not hash
…r itself, beside its .py or not: numba 0.68 and later read the member's source by the name its code gives, of no member, and the listing let the .py beside it stand for the directory, so the module died at decoration
…module's source, apart from a module shipped as .pyc alone: the remedy read every KeyError for a member the archive does not hold as the latter, and asked for source files that were there, where the .pyc is what to recompile or leave out
…e them under its in-tree locator, which takes them in numba's own order, or a subdirectory hashed from their directory under NUMBA_CACHE_DIR or the user's cache directory; the docs named the subdirectory alone
…ok statvfs away and never made it raise, and a fallback answering 0 passed
…p and from 0.68 for the source, to be made readable: the remedy told it as a location that refused a file, to make room in or make writable
…hat gives a temporary directory per call: IPython 8 and later read the variable for their cache directory on every POSIX system, macOS included, which IPython 7 left out, and the remedy steered a macOS reader off it
cache_remedywrites the remedy at the end of the warning numbox gives, once at import, where numba cannot cache its functions, andcheck_cache_locationputs numba's question for a file. Five things did not work and do now; the rest of this change is the text of the remedy.For a source not on disk,
cache_remedyraised instead of returning a remedy:TypeErroron aFileNotFoundErrorthat named no file, or named it as bytes, apathlib.Pathor an integer, andAttributeErrororTypeErroron aFileNotFoundErrorfor a source given as apathlib.Pathor as bytes. Only an error a caller passes on can take those shapes, and a package that passed one got a traceback at import in place of the warning. The remedy now takes any path-like source, reads any name an error carries, an integer as no name, and returns a remedy for every erroris_a_cache_erroradmits.check_cache_locationcould not check a.zipmember in anipykernel_directory whose source the archive holds. numba's IPython locator takes such a file by its directory's name and reads the function's source, and the check's probe had no module to read source through, so the check raisedinspect'sOSErrorbefore any location was reached.is_a_cache_erroradmits everyOSError, so a package that put the question for such a file turned caching off with the warning for a.zip, which asked for the user's cache directory to be made writable, a directory numba had not tried. The check's probe is now a function in a module of its own, whose loader reads the member's source from the archive as zipimport does, so numba's IPython locator reads the same source it reads at decoration, and the check then makes and checksnumba_cacheunder IPython's cache directory as numba does. Where IPython can write neither its cache directory nor its own directory, it returns a new temporary directory on every call, and numba makesnumba_cachein one and saves in another; the check now raises the error numba's first save would, and the warning asks forIPYTHONDIR, orXDG_CACHE_HOMEon Linux, to be set to a writable path. Where IPython is not importable the check now raises theImportErrornumba raises at decoration, whichis_a_cache_errordoes not admit, so a package that puts the question for such a file fails at import where before it warned.The
NUMBA_CACHE_DIRcase of the test for the cache anchors numbox makes for its generated code was sized by the utils page's description of numba's location under the variable, which was wrong: the location is a directory named by the source directory's name and a hash of its path (get_suitable_cache_subpath), not the source's directory path appended to the variable. At the length the test chose, numba's own check fails on a file system that makes no unnamed temporary file, numba caches beside the source instead, and the warning the test saw came from the anchor's check rather than the package's. The test now asks numba for the location, and the page says what the location is.numba 0.68 reads a
.zipmember's source from the archive for its cache stamp, and two things in main's answer to that did not work. The listing behind the warning asked one member per directory of the archive, so a module shipped as.pycalone beside.pymembers passed the check and died at its first decorated function with numba'sKeyError; it now puts the question for such a member too. The remedy for that error told the archive's user to put source files in the archive without saying which ones it lacked. On Windows under numba 0.68.0, numba builds the member's name with the platform's separator (numba issue 10889, fixed in 0.68.1) and no archive holds a member under that name, and the remedy there named the issue alone, with no way to turn caching off. The remedy now names the member the archive holds no source for, or the numba release that reads the member, and either ends in the option that silences the warning.Everything else is what the remedy says, which is what
cache_remedyis for. Before, it assumed where numba had cached and what would move it, and in these cases its advice could not help. A cache path too long under the user's cache directory was told "a shorter NUMBA_CACHE_DIR, or none, where it is set, else numbox installed at a shorter path", with the variable unset. ANUMBA_CACHE_DIRthat was set and that numba could not use was told "Set NUMBA_CACHE_DIR to a writable directory". A full disk was told the same for a source on disk, and for a.zipmember was told to make a directory writable, with the file numba could not write quoted as the directory where the error named one, the reason dropped either way.NUMBA_CACHE_LOCATOR_CLASSESwas not read, so the warning offeredNUMBA_CACHE_DIRunder a list that leaves the user-provided locator out, where numba never reads the variable, told a reader importing from a.zipunder a list without the.ziplocator to import from a.zip, and told a frozen application under a list without the user-wide locator to make the user's cache directory writable, a directory numba had not tried. A source directory whose name makes the directory numba names after it longer than the file system takes was told a shorter path for a.zipmember and a writableNUMBA_CACHE_DIRfor a source on disk, and neither can help. A notebook cell whose file is not on disk, which numba's IPython locator could not cache, was told to unpack an archive. The remedy now answers for the location numba picked, under numba's own order or the list, names what moves that location on the platform, and gives the error's reason; where numba picked no location it names the locator the source needs, or the location numba could not use. Each case has a test, and the configurations page describes them.numbduck, a package built on numbox, will call
cache_remedyfor its own files and needs a numbox release that carries this.