Skip to content
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
194 commits
Select commit Hold shift + click to select a range
ddeacbb
Take the package's name in cache_remedy, so a package built on numbox…
nelson2005 Oct 4, 2026
102bd8b
Say that a package built on numbox asks check_cache_location with a b…
nelson2005 Oct 4, 2026
aaade19
Size the path-limit test's cache directory by numba's own location un…
nelson2005 Oct 4, 2026
0ccf016
Tell a location too long for the file system what shortens the one it…
nelson2005 Oct 5, 2026
f2f7d47
Say in the utils docs that the package's location under NUMBA_CACHE_D…
nelson2005 Oct 5, 2026
5a3d874
Size the anchor test's NUMBA_CACHE_DIR by numba's own location for th…
nelson2005 Oct 5, 2026
dcfe8da
Say in uncached_where_no_cache_can_be_written's docstring that a loca…
nelson2005 Oct 5, 2026
91825c4
Tell numba's three locations apart by the whole path numba builds for…
nelson2005 Oct 5, 2026
aaa3e06
Say in the utils docs that a NUMBA_CACHE_DIR within about 230 bytes o…
nelson2005 Oct 5, 2026
bedf595
Tell a NUMBA_CACHE_DIR too long to be shorter, without "or none": wit…
nelson2005 Oct 5, 2026
36b3035
Name NUMBA_CACHE_DIR where numba passed it over for a location too lo…
nelson2005 Oct 5, 2026
f0faca9
Fit the remedy for a location too long to the platform and to numba's…
nelson2005 Oct 5, 2026
1839955
Tell a source on disk with no locator what numba would take: a set NU…
nelson2005 Oct 5, 2026
ba25454
Offer NUMBA_CACHE_DIR where numba tries it before the locator that to…
nelson2005 Oct 6, 2026
d825181
Match the location the error names against numba's locations in the o…
nelson2005 Oct 6, 2026
93b4523
Tell a location numba took where no file can be written, a full disk …
nelson2005 Oct 6, 2026
6f73698
Take numba's locator classes as numba resolves them, in its order, an…
nelson2005 Oct 6, 2026
73734ba
Resolve a dotted NUMBA_CACHE_LOCATOR_CLASSES entry with the underscor…
nelson2005 Oct 6, 2026
5c20156
Answer the .zip locator's error for a path with .zip in it and no par…
nelson2005 Oct 6, 2026
7f902fe
Name a set NUMBA_CACHE_DIR without the claim that numba passed it ove…
nelson2005 Oct 6, 2026
1e39fc6
Say of numba's .zip locator what it does: it takes any path with .zip…
nelson2005 Oct 6, 2026
847d9f2
Merge remote-tracking branch 'origin/main' into feat/cache-remedy-pac…
nelson2005 Oct 6, 2026
bdbe0b5
Ask for the user-provided locator with NUMBA_CACHE_DIR set where the …
nelson2005 Oct 7, 2026
5ae768d
Tell an error too long for the file system that names no file the loc…
nelson2005 Oct 7, 2026
0bc0a1d
Name a location that is none of numba's as the error names it where n…
nelson2005 Oct 7, 2026
4cc1869
Tell a source in a .zip under a NUMBA_CACHE_LOCATOR_CLASSES that leav…
nelson2005 Oct 7, 2026
b82236d
Tell a frozen application under a NUMBA_CACHE_LOCATOR_CLASSES that le…
nelson2005 Oct 7, 2026
5ffa2e8
Name each location once where an error too long for the file system n…
nelson2005 Oct 7, 2026
bc36287
Answer a FileNotFoundError that names no file, for a source not on di…
nelson2005 Oct 7, 2026
316d6d9
Take each of numba's locator classes for its family, a subclass liste…
nelson2005 Oct 7, 2026
35f5ef5
Take an empty filename on an error too long for the file system for n…
nelson2005 Oct 7, 2026
a532369
Tell an error that names no file and refuses one for a reason other t…
nelson2005 Oct 7, 2026
eb0cd22
Take the source's path as any path-like, as check_cache_location does…
nelson2005 Oct 7, 2026
afccb4b
Give an error's own message as the reason where it has no strerror: a…
nelson2005 Oct 7, 2026
ebacb18
Hold, for a location too long that is none of numba's, that NUMBA_CAC…
nelson2005 Oct 7, 2026
e3c571f
Know numba's IPython locator's location, numba_cache under IPython's …
nelson2005 Oct 7, 2026
5f80dae
Take a bytes path in cache_remedy as check_cache_location does: os.fs…
nelson2005 Oct 7, 2026
f4b065e
Tell an OSError a caller passes on under a locator list with no locat…
nelson2005 Oct 7, 2026
f050f3e
Offer the archive remedy's two ways, the source files on disk or a .z…
nelson2005 Oct 7, 2026
933cf91
Cover the IPython.utils.path import the IPython location falls back t…
nelson2005 Oct 7, 2026
dbb08e1
Say what numba does where IPython is not importable and its IPython l…
nelson2005 Oct 7, 2026
ee1db78
Ask for NUMBA_CACHE_DIR with the archive remedy's install on disk whe…
nelson2005 Oct 7, 2026
cdf46a2
Cover the path an error names made absolute before it is matched agai…
nelson2005 Oct 7, 2026
bad97e5
Cover the in-tree and the user-wide locator each counting as the one …
nelson2005 Oct 7, 2026
c5097af
Cover the frozen-application remedy, which asks for the user-wide loc…
nelson2005 Oct 7, 2026
f0983b3
Tell a .zip's error that names a file numba writes in its location, a…
nelson2005 Oct 7, 2026
cd48c6a
Read the file an error names as str, for a name carried as bytes, fro…
nelson2005 Oct 7, 2026
928361f
Give the probe check_cache_location compiles its source under the fil…
nelson2005 Oct 7, 2026
9b4ebf5
Hold an OSError a caller passes on to a listed locator with a place f…
nelson2005 Oct 7, 2026
54da79e
Give the reason with a .zip's location that refuses a file for one ot…
nelson2005 Oct 7, 2026
ffa2bd8
Tell an error naming numba_cache under IPython's cache directory, or …
nelson2005 Oct 7, 2026
4b6f8e0
Give the probe's source to linecache for a file not on disk alone, un…
nelson2005 Oct 7, 2026
f41a324
Name the one location numba could have taken for an error that names …
nelson2005 Oct 7, 2026
93b7926
Ask IPython for its cache directory only where numba's IPython locato…
nelson2005 Oct 8, 2026
234fa96
Answer an error for a source not on disk for the locator numba reache…
nelson2005 Oct 8, 2026
e2f8d4c
Give the probe's source to the linecache only for a file not on disk …
nelson2005 Oct 8, 2026
2a22692
Test that the check puts back the lines the linecache held for a file…
nelson2005 Oct 8, 2026
3876b31
Test the reason an error with no strerror is told in every remedy tha…
nelson2005 Oct 8, 2026
8f532ed
Hold the .zip location tests to numba 0.61 and later, where numba's .…
nelson2005 Oct 8, 2026
81a174b
Match an error's path against the locations of the locators numba rea…
nelson2005 Oct 8, 2026
ed9a694
Say that a path object has no empty name: pathlib reads an empty stri…
nelson2005 Oct 8, 2026
1a8b473
Leave a NUMBA_CACHE_LOCATOR_CLASSES entry that names no class to numb…
nelson2005 Oct 8, 2026
a7ce606
Resolve a dotted locator entry with the underscore numba put before i…
nelson2005 Oct 8, 2026
6098a11
Try the underscore numba put before its locators' names under numba 0…
nelson2005 Oct 8, 2026
c44fba9
Leave a locator entry with an empty module path out, as the remedy le…
nelson2005 Oct 8, 2026
f17a47f
Say which errors name no file: a caller's, numba's first save's where…
nelson2005 Oct 8, 2026
234dabb
Say in the docstring and the docs which errors name no file and what …
nelson2005 Oct 8, 2026
d89adca
Reword the docstring and the docs on an error that names no file: the…
nelson2005 Oct 8, 2026
5fc1d67
Pass over an OSError from IPython for its cache directory as numba's …
nelson2005 Oct 8, 2026
391db66
Tell the list for an error about a source not on disk under a list wi…
nelson2005 Oct 8, 2026
d8dd04c
Tell an error that names no file for a source not on disk the locatio…
nelson2005 Oct 8, 2026
490bd0c
Say nothing of where numba caches the file for a location that is non…
nelson2005 Oct 8, 2026
bf1f076
Hold the remedy to numba's user-wide locator taking a frozen applicat…
nelson2005 Oct 8, 2026
376204a
Hold the check and the remedy to a cell numba's IPython locator takes…
nelson2005 Oct 8, 2026
aaa14b5
Tell a frozen application's no-locator error the user's cache directo…
nelson2005 Oct 8, 2026
4104e6b
Answer the .zip locator's error for a frozen application's path with …
nelson2005 Oct 8, 2026
00dc46f
Say in the check's docstring that inspect's OSError names no file: fo…
nelson2005 Oct 8, 2026
c84623a
Hold the remedy to finding a .zip by a part of the path that ends in …
nelson2005 Oct 8, 2026
34bba7e
Drop "as for a source on disk" from the sentence on a frozen applicat…
nelson2005 Oct 8, 2026
7e1e502
Leave a locator entry with a relative module path out, as the remedy …
nelson2005 Oct 8, 2026
50a3aab
Leave a listed class with no from_function out, as the remedy leaves …
nelson2005 Oct 8, 2026
800b3c6
Say nothing of the user's cache directory as where numba caches a mem…
nelson2005 Oct 8, 2026
c237684
Hold the docstring's promise for an error naming IPython's location, …
nelson2005 Oct 8, 2026
3d6bf6a
Summarise a .zip's remedy in the options' docstring as cache_remedy g…
nelson2005 Oct 8, 2026
3935afe
Take a listed class of none of numba's families as taking any file an…
nelson2005 Oct 8, 2026
5c98f5f
Tell a frozen application's no-locator error to list the user-wide lo…
nelson2005 Oct 8, 2026
76d93b8
List a class of none of numba's families as the class's own place for…
nelson2005 Oct 8, 2026
ccf39a7
Read a file name of another kind than str, bytes or a path object as …
nelson2005 Oct 8, 2026
887b804
Tell numba's no-locator error for a file its IPython locator alone ta…
nelson2005 Oct 8, 2026
72059db
Say in the docstring and the docs that an error naming a location a l…
nelson2005 Oct 8, 2026
b52dc1c
Say in check_cache_location's docstring that the stamp's error, FileN…
nelson2005 Oct 8, 2026
c108a46
Tell inspect's error, which names no file and has no errno, no call o…
nelson2005 Oct 8, 2026
65191b3
Tell numba's no-locator error for a cell under a list of its IPython …
nelson2005 Oct 8, 2026
b47b90b
Tell a source directory whose name makes the directory numba names af…
nelson2005 Oct 8, 2026
68a83c6
Check the name numba gives its cache directory over the locators it t…
nelson2005 Oct 8, 2026
536e29f
Say that inspect's error comes before numba's IPython locator tries i…
nelson2005 Oct 8, 2026
141455c
Count the name numba gives its cache directory as the file system cou…
nelson2005 Oct 8, 2026
93ee118
Say that inspect raises for a cell file on disk it cannot read and, b…
nelson2005 Oct 8, 2026
ed54284
Count the name numba gives its cache directory in UTF-16 units on mac…
nelson2005 Oct 8, 2026
3a99521
Build the expected IPython location with the platform's separator, sk…
nelson2005 Oct 8, 2026
a3bd492
Wrap the line that picks the refused error's errno within the line limit
nelson2005 Oct 8, 2026
baf878b
Name no location under NUMBA_CACHE_DIR or the user's cache directory …
nelson2005 Oct 8, 2026
e6cbe7f
Give the probe's source to a .zip member in an ipykernel directory al…
nelson2005 Oct 8, 2026
1e2554f
Give the probe's source to a .zip member whose source the archive hol…
nelson2005 Oct 8, 2026
ae2e3fb
Merge remote-tracking branch 'origin/main' into feat/cache-remedy-pac…
nelson2005 Oct 10, 2026
94cf5fa
Answer what numba 0.68 and later raise reading a .zip member's source…
nelson2005 Oct 10, 2026
f50b4b3
Ask a .pyc member alone beside .py members in a .zip for itself: numb…
nelson2005 Oct 10, 2026
232d293
Hold the test of a directory named .zip above the archive to numba 0.…
nelson2005 Oct 10, 2026
b90a218
Find the archive a .zip member's source is read from as zipimport doe…
nelson2005 Oct 10, 2026
76d7c76
Promise numba 0.68.1 for a member named with Windows's separator only…
nelson2005 Oct 10, 2026
125cb59
Raise, as numba's first save does, where the location numba picked is…
nelson2005 Oct 10, 2026
c92b371
Say in the proxy page that the mixed-tuple limit on .as_func runs fro…
nelson2005 Oct 10, 2026
4d2cf94
Test the check's answer for a location that is not there once made wi…
nelson2005 Oct 10, 2026
cb14a3a
Tell a cell file on disk in an ipykernel directory, too, that IPython…
nelson2005 Oct 10, 2026
e7c4857
Say that numba 0.68.1 reads a member named with Windows's separator a…
nelson2005 Oct 10, 2026
78ec24d
Offer the install on disk, which no separator touches, beside numba 0…
nelson2005 Oct 10, 2026
98f6839
Test that an error naming the __pycache__ beside a cell file on disk …
nelson2005 Oct 10, 2026
df7d140
Ask IPython for its cache directory three times in the check and twic…
nelson2005 Oct 10, 2026
e9cad7c
Tell a notebook cell under a NUMBA_CACHE_LOCATOR_CLASSES without IPyt…
nelson2005 Oct 10, 2026
c344763
Tell a source on disk that numba cannot read to be made readable: num…
nelson2005 Oct 10, 2026
9173894
Wrap a line of cache_remedy's docstring within the width the fork's l…
nelson2005 Oct 10, 2026
b1259dc
Assign numba_version once, at the top of the module: upstream moved i…
nelson2005 Oct 10, 2026
74538ce
Tell a source on disk under a directory named .zip, which numba's .zi…
nelson2005 Oct 10, 2026
6ed88ee
Say in check_cache_location's docstring which errors name no location…
nelson2005 Oct 10, 2026
331507c
Take any error IPython raises for its cache directory as no directory…
nelson2005 Oct 10, 2026
1b009ae
Hide IPython.paths and IPython.utils.path too where a test stands in …
nelson2005 Oct 10, 2026
7debb57
Count the source itself, which numba reads, as no location of IPython…
nelson2005 Oct 10, 2026
ffd2382
Blame IPython's temporary directory for a file on disk only where the…
nelson2005 Oct 10, 2026
ef862fc
Offer the __pycache__ beside the source for a name too long only wher…
nelson2005 Oct 10, 2026
e93dc83
Offer the user's cache directory at a shorter path, beside a shorter …
nelson2005 Oct 10, 2026
8e90d7a
Offer NUMBA_CACHE_DIR for a path too long that the user-wide and .zip…
nelson2005 Oct 10, 2026
ce8e082
Take back the user's cache directory at a shorter path as a cure for …
nelson2005 Oct 10, 2026
9917d78
Tell a name too long behind the .zip locator's error too: for a sourc…
nelson2005 Oct 10, 2026
a135ff3
Find the archive a member's source is read from as zipimport does, by…
nelson2005 Oct 10, 2026
ab1f01c
Name the fix, not a release to install, for a member named with Windo…
nelson2005 Oct 10, 2026
fa3a86d
Test that the file system's name limit is asked of the nearest direct…
nelson2005 Oct 10, 2026
4a877ab
Say in uncached_where_no_cache_can_be_written's docstring what the Wi…
nelson2005 Oct 10, 2026
8721508
Test which errors is_a_cache_error admits, by their text: numba's no-…
nelson2005 Oct 10, 2026
7644c3b
Name NUMBA_CACHE_DIR, which the user-provided locator takes nothing w…
nelson2005 Oct 10, 2026
78aee7a
Tell a .pyc-only member of any archive in an ipykernel directory the …
nelson2005 Oct 10, 2026
772c498
Test that an error naming a file numba writes in the __pycache__ besi…
nelson2005 Oct 11, 2026
d837bc3
Tell inspect's error apart before IPython's temporary directory: with…
nelson2005 Oct 11, 2026
ea05f0f
Leave the lines a reader stored under a member's name while the check…
nelson2005 Oct 11, 2026
af057d9
Read an IPython that gives its cache directory once and raises on the…
nelson2005 Oct 11, 2026
474ebc7
Say, for a source on disk under a directory named .zip under a list t…
nelson2005 Oct 11, 2026
3a03a27
Tell an error naming a directory named .zip above a source on disk as…
nelson2005 Oct 11, 2026
2d60f77
Know inspect's error by its words, not by its empty errno and name al…
nelson2005 Oct 11, 2026
e1819a3
Read a .zip member's source for the probe through a module of its own…
nelson2005 Oct 11, 2026
1e0367a
Read a path given as bytes as a string for the probe's module and loa…
nelson2005 Oct 11, 2026
0e6203e
Take the probe's loader out of linecache after the check for a member…
nelson2005 Oct 11, 2026
38e141e
Tell an error naming no file the locations numba could have taken, wi…
nelson2005 Oct 11, 2026
e6f07eb
Ask for the .zip locator's location among the ones numba could have t…
nelson2005 Oct 11, 2026
3d609e8
Reach no locator of IPython's family listed after a class of none of …
nelson2005 Oct 11, 2026
d10f3b8
Ask for the .zip locator's location among the ones numba could have t…
nelson2005 Oct 11, 2026
85ef6b0
Name the directory refusing to make a .zip member's location, the fir…
nelson2005 Oct 11, 2026
a340eb2
Ask a locator class of none of numba's families whether it takes the …
nelson2005 Oct 11, 2026
a41adab
Reach no locator listed after a class of none of numba's families tha…
nelson2005 Oct 11, 2026
b0ce89b
Hold the rule that a locator class of none of numba's families whose …
nelson2005 Oct 11, 2026
81bfc09
Name a file in the way of a .zip member's location, which no director…
nelson2005 Oct 11, 2026
19d8ad3
Reach no .zip locator listed after a class of none of numba's familie…
nelson2005 Oct 11, 2026
6cf7836
Say what keeps per-content anchors apart in numba's cache: the anchor…
nelson2005 Oct 11, 2026
e7d857a
Ask for a .pyc member compiled to name another path in the archive fo…
nelson2005 Oct 11, 2026
070414e
Tell a .pyc compiled to name another path in the archive, beside the …
nelson2005 Oct 11, 2026
edc233d
Say where numba keeps the anchors' cache files: the __pycache__ besid…
nelson2005 Oct 11, 2026
aab7ba9
Hold the name limit's fallback for a statvfs that raises: the test to…
nelson2005 Oct 11, 2026
f86ab7f
Tell an archive numba cannot read, which it reads for a member's stam…
nelson2005 Oct 11, 2026
c47a72f
Say XDG_CACHE_HOME on a POSIX system, not on Linux, for the IPython t…
nelson2005 Oct 11, 2026
48f0692
Say XDG_CACHE_HOME on a POSIX system in the docs too, as the warning …
nelson2005 Oct 11, 2026
1041ae6
Say in the docs that a .pyc compiled to name another path in the arch…
nelson2005 Oct 11, 2026
f00c79a
Keep an error naming a path above a member, the archive its code name…
nelson2005 Oct 11, 2026
99e4b6a
Tell an archive numba's .zip locator never takes, APP.ZIP or an .egg,…
nelson2005 Oct 11, 2026
6200019
Find the archive above a file by the platform's separator, not throug…
nelson2005 Oct 11, 2026
4e5e2f9
Expect the rename of an .egg from numba 0.61 alone, where numba has a…
nelson2005 Oct 11, 2026
e3d58f4
Read the file absolute too where an error naming a path above it is k…
nelson2005 Oct 11, 2026
9d50bf3
Offer the rename to end in .zip by the archive's own name, not by ".z…
nelson2005 Oct 11, 2026
8f50db6
Read an error's name and the file absolute wherever the remedy asks w…
nelson2005 Oct 12, 2026
5b5fb7f
Name the locator that took the file where a name too long is told to …
nelson2005 Oct 12, 2026
45a61bb
Hold the count of a cache directory's name in UTF-16 units on Windows…
nelson2005 Oct 12, 2026
051ca22
Skip the relative member's moved-archive test before numba 0.61, wher…
nelson2005 Oct 12, 2026
c2a0087
Count the name as the platform counts it in the test naming the locat…
nelson2005 Oct 12, 2026
e24193d
Offer NUMBA_CACHE_DIR for no source under a directory numba cannot ha…
nelson2005 Oct 12, 2026
55f448f
Tell a .zip member in an ipykernel directory that is not UTF-8 as ins…
nelson2005 Oct 12, 2026
fcc28c0
Leave out a listed locator whose module raises anything on import, no…
nelson2005 Oct 12, 2026
4fbc2a1
Read the working directory as no path above the file: a path object b…
nelson2005 Oct 12, 2026
3c00cba
Give the remedy for an IPython giving a temporary directory per call …
nelson2005 Oct 12, 2026
28cab6d
Skip for numba issue 10889 on Windows alone: the end-to-end .zip test…
nelson2005 Oct 12, 2026
30c173c
Tell a cache file whose name is too long for the file system by its n…
nelson2005 Oct 12, 2026
b7076c4
Reach no locator of IPython's family listed after a locator of numba'…
nelson2005 Oct 12, 2026
1561d2e
Admit numba's UnicodeEncodeError for a source directory path that is …
nelson2005 Oct 12, 2026
0b8e346
Name the cure for a cache file whose name is too long for the file sy…
nelson2005 Oct 12, 2026
d15f963
Say which temporary directory the check names where IPython gives one…
nelson2005 Oct 12, 2026
7d1a397
Count a surrogate in a name as one UTF-16 unit, as Windows takes one …
nelson2005 Oct 12, 2026
50ad95e
Tell a .zip under a directory whose path is not UTF-8 the archive und…
nelson2005 Oct 12, 2026
8d2e2de
Ask for NUMBA_CACHE_DIR at a UTF-8 path in the anchor's warning where…
nelson2005 Oct 12, 2026
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
27 changes: 23 additions & 4 deletions docs/numbox.core.configurations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,21 @@ the check here makes a file named as long as the longest numba writes for the pa
which a test holds every function of the package under), so that location turns caching off with the
warning instead.

- For a source file on disk the remedy is ``NUMBA_CACHE_DIR`` pointed at a writable directory; where its
location is too long for the file system, a shorter ``NUMBA_CACHE_DIR`` or none, since each location numba
picks for a source on disk but the one beside it appends the source's directory path, else the package
installed at a shorter path.
- For a source file on disk the remedy is ``NUMBA_CACHE_DIR`` pointed at a writable directory; where it is
set and numba passed it over, the warning names it and asks for a writable directory at a short path, since
numba passes over one too deep to make its directory in as it does an unwritable one; and where
``NUMBA_CACHE_LOCATOR_CLASSES``, from numba 0.62, puts another locator first, it is the locations that
names made writable. Where the
location is too long for the file system, the remedy is for the location the error names: numba takes a
directory under ``NUMBA_CACHE_DIR`` where that is set, else the ``__pycache__`` beside the source, else a
directory under the user's cache directory, each of the two under a cache directory named for the source's
directory, by its name and a hash of its path. So a shorter ``NUMBA_CACHE_DIR`` for the first; the
package installed at a shorter path for the second; the user's cache directory at a shorter path, through
``XDG_CACHE_HOME`` or ``HOME``, ``HOME`` alone on macOS and nothing on Windows, where numba asks the system,
for the third; and for either of the last two ``NUMBA_CACHE_DIR`` set to a short path, which numba takes
first, or, where it is set and numba passed it over, unwritable or too deep, the warning names it and the
remedy is a writable directory at a short path. Where ``NUMBA_CACHE_LOCATOR_CLASSES`` puts
another locator first, ``NUMBA_CACHE_DIR`` is not offered.
- For a ``.zip``, or a frozen application, it is the user's cache directory made writable: a ``.zip`` is the
one archive numba caches, from 0.61 on, and it caches it there, taking the directory without checking that
it can be written; a frozen application (``sys.frozen``) is cached there too, its sources not being on disk.
Expand All @@ -71,6 +82,14 @@ warning instead.
A function numba cannot cache is compiled in every process that uses it, never wrong; that is the cost the
warning reports. An error at decoration that is not the cache's is raised as it was.

A package built on numbox can put the same question for its own files: ``check_cache_location`` asks it for
one file, ``is_a_cache_error`` tells numba's cache errors from the rest, and ``cache_remedy`` words the
remedy, given the package's name for the two remedies that tell the reader to install it again, at a shorter
path or with its source files on disk. The bound on file names is the package's own:
``LONGEST_CACHE_FILE_NAME`` holds numbox's functions only, so a package passes ``check_cache_location`` the
longest name numba writes for its own, as ``longest_file_name``, or a location that fits numbox's names and not
the package's passes the check and the first save overflows it.

The code numbox generates at run time, ``make_structref``'s, ``compile_kernel``'s, the work builder's derives
and the sqlite registrations', is anchored to a file under ``NUMBA_CACHE_DIR`` or the user's cache directory
so that numba can cache it. That directory can be unwritable where the package's own functions cache, since
Expand Down
17 changes: 9 additions & 8 deletions docs/numbox.utils.rst
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,15 @@ the directory is the only part that can make it so, ``NUMBA_CACHE_DIR``
or the user's cache directory, and ``NUMBA_CACHE_DIR`` at a shorter
path moves the anchor out of either. The anchor's check writes names
shorter than the longest numba writes for a struct, which carry its name
and its methods', so a user cache directory within about 230 bytes of
the path limit, 4096 on Linux, passes it and overflows at numba's first
save instead, where numba's own error names the length; the remedy is
the same. A ``NUMBA_CACHE_DIR`` that deep is too deep for the package's
own files first, whose location under it appends their directory's path
and whose check reserves the length of numba's files, so the package
answers, with its remedy, and the generated code compiles under its
answer.
and its methods', so a user cache directory or a ``NUMBA_CACHE_DIR``
within about 230 bytes of the path limit, 4096 on Linux, passes it and
overflows at numba's first save instead, where numba's own error names
the length; the remedy is the same. The package's own check answers
first only nearer the limit, within about 175 bytes of it: the package's
location under ``NUMBA_CACHE_DIR`` is a directory named for its own, by
its name and a hash of its path, and its check reserves the length of
numba's files for the package's functions, so it fails only where those
no longer fit; the generated code then compiles under its answer.

The anchor's name carries the struct's or the function's, and numba
names its cache files after the anchor and the qualified name of the
Expand Down
110 changes: 93 additions & 17 deletions numbox/core/configurations.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,31 +217,107 @@ def _compiled_from(zip_path, directory, stem):
return None


def cache_remedy(py_file, failure, silence):
def _moved_through():
"""What moves numba's user cache directory on this platform, as a clause for a remedy; nothing on Windows.

numba's ``appdirs`` asks the system for it on Windows, which no variable changes, puts it under ``HOME`` on
macOS, and takes ``XDG_CACHE_HOME``, else a directory under ``HOME``, elsewhere.
"""
if sys.platform == "win32":
return ""
if sys.platform == "darwin":
return ", through HOME"
return ", through XDG_CACHE_HOME or HOME"


def cache_remedy(py_file, failure, silence, package="numbox"):
"""The remedy for ``failure``, numba's for a function whose file is ``py_file``, ending in ``silence``.

``NUMBA_CACHE_DIR`` for a source file on disk, which is the only kind numba reads the variable for; where its
location is too long for the file system, a shorter ``NUMBA_CACHE_DIR`` or none, since each location numba
picks for a source on disk but the one beside it appends the source's directory path, else the package at a
shorter path. For a ``.zip`` or a frozen application, both cached under the user's cache directory, the
location made writable:
``NUMBA_CACHE_DIR`` for a source file on disk, which is the only kind numba reads the variable for; where it is
set and numba passed it over, the variable named and a writable directory at a short path asked for, since
numba passes over one too deep to make its directory in as it does an unwritable one; and where
``NUMBA_CACHE_LOCATOR_CLASSES``, from numba 0.62, puts another locator first, the locations it names made
writable. Where the
location is too long for the file system, the error names it, and the remedy is for the one it is: numba takes
a directory under ``NUMBA_CACHE_DIR`` where that is set, else the ``__pycache__`` beside the source, else a
directory under the user's cache directory, each of the two under a cache directory named for the source's
directory, by its name and a hash of its path. So a shorter ``NUMBA_CACHE_DIR`` for the first; the
package at a shorter path for the second; the user's cache directory at a shorter path, through
``XDG_CACHE_HOME`` or ``HOME``, ``HOME`` alone on macOS and nothing on Windows, for the third; and for either
of the last two ``NUMBA_CACHE_DIR`` set to a short path, which numba takes first, or, where it is set and numba
passed it over, named and made a writable directory at a short path. Where ``NUMBA_CACHE_LOCATOR_CLASSES``
puts another locator first, ``NUMBA_CACHE_DIR`` is not offered. The error can name the
location or a file numba writes in it. For a ``.zip`` or a frozen application, both cached under the user's cache
directory, the location made writable:
the ``.zip``'s error names it, a directory of numba's under the user's cache directory; the frozen
application's is the no-locator one, numba having passed the location over on its error, so the user's
cache directory is named. For any other archive, or a module without its source, the source files on disk
or a ``.zip`` holding them. A ``.zip``'s location too long for the file system is the user's cache
directory's doing, with the names numba makes bounded, and the remedy is that directory at a shorter
path, through ``XDG_CACHE_HOME`` or ``HOME``.
path, through what moves it on the platform.

``package`` is the one the remedy tells the reader to install again, at a shorter path or with its source
files on disk: a package built on numbox that puts the question for its own files with
``check_cache_location`` and ``is_a_cache_error`` passes its own name, as it passes ``check_cache_location`` a
``longest_file_name`` for its own functions, ``LONGEST_CACHE_FILE_NAME`` being numbox's.
"""
if os.path.exists(py_file):
from numba import config
# numba takes NUMBA_CACHE_DIR first unless NUMBA_CACHE_LOCATOR_CLASSES,
# from numba 0.62, orders its locators otherwise; an entry is a class
# of numba's caching module, by its name or its dotted path.
locators = getattr(config, "CACHE_LOCATOR_CLASSES", "")
first = locators.split(",")[0].strip().rsplit(".", 1)[-1] if locators else "UserProvidedCacheLocator"
cache_dir_first = first.lstrip("_") == "UserProvidedCacheLocator"
if isinstance(failure, OSError) and failure.errno == errno.ENAMETOOLONG:
# numba's own check passes the location, its temporary file
# fitting where its cache files would not; the error names it.
return (
"the path is too long for the file system: a shorter NUMBA_CACHE_DIR, or none, where it is set, "
f"else numbox installed at a shorter path; or {silence}"
)
# fitting where its cache files would not; the error names it,
# and which of numba's three it is decides what shortens it. Each
# is a path numba builds from the file, matched whole, since the
# three can nest: an install under either cache directory, or
# NUMBA_CACHE_DIR above the user's.
from numba.core.caching import _CacheLocator
# The error names the location, or a file numba writes in it.
named = os.path.abspath(failure.filename or "")
named = {named, os.path.dirname(named)}
subpath = _CacheLocator.get_suitable_cache_subpath(py_file)
user_cache_dir = AppDirs(appname="numba", appauthor=False).user_cache_dir
if not cache_dir_first:
instead = ""
elif config.CACHE_DIR:
# Taken first and set, so a location elsewhere means numba
# passed the variable over: unwritable, or too deep.
instead = (
f", or NUMBA_CACHE_DIR, which is set to {config.CACHE_DIR} and numba could not use, made a "
"writable directory at a short path"
)
else:
instead = ", or NUMBA_CACHE_DIR set to a short path"
if os.path.abspath(os.path.join(os.path.dirname(py_file), "__pycache__")) in named:
cure = f"{package} installed at a shorter path{instead}"
elif config.CACHE_DIR and os.path.abspath(os.path.join(config.CACHE_DIR, subpath)) in named:
cure = "a shorter NUMBA_CACHE_DIR"
elif os.path.abspath(os.path.join(user_cache_dir, subpath)) in named:
cure = f"the user's cache directory, {user_cache_dir}, at a shorter path{_moved_through()}{instead}"
elif instead:
cure = f"{instead[len(', or '):]}, which numba takes first"
else:
cure = f"that location, {failure.filename}, at a shorter path"
return f"the path is too long for the file system: {cure}; or {silence}"
# numba itself passes a location it cannot make or write over, for a
# source on disk, so the error here is the no-locator one.
if not cache_dir_first:
return (
f"numba looks only where NUMBA_CACHE_LOCATOR_CLASSES, {locators}, says: make one of those locations "
f"writable, or {silence}"
)
if config.CACHE_DIR:
# Set and passed over: unwritable, or too deep for numba to make
# its directory there, which a writable one as deep would not cure.
return (
f"NUMBA_CACHE_DIR is set to {config.CACHE_DIR}, which numba could not use: set it to a writable "
f"directory at a short path, or {silence}"
)
return f"Set NUMBA_CACHE_DIR to a writable directory, or {silence}"
if isinstance(failure, OSError) or getattr(sys, "frozen", False):
# The .zip's error names the location numba picked, which is under
Expand All @@ -261,8 +337,7 @@ def cache_remedy(py_file, failure, silence):
return (
"numba caches a .zip, or a frozen application, in the user's cache directory, and NUMBA_CACHE_DIR "
f"has no effect here, because the source is not a file on disk: the path is too long for the file "
f"system, so put that directory, {location}, at a shorter path, through XDG_CACHE_HOME or HOME, or "
f"{silence}"
f"system, so put that directory, {location}, at a shorter path{_moved_through()}, or {silence}"
)
return (
"numba caches a .zip, or a frozen application, in the user's cache directory, and NUMBA_CACHE_DIR "
Expand All @@ -271,7 +346,7 @@ def cache_remedy(py_file, failure, silence):
)
return (
"NUMBA_CACHE_DIR has no effect here, because the source is not a file on disk: to cache, "
"install numbox with its source files on disk, unpacked from any archive, or import it from a "
f"install {package} with its source files on disk, unpacked from any archive, or import it from a "
f".zip holding its source files, which numba 0.61 and later cache in the user's cache directory; or "
f"{silence}"
)
Expand All @@ -289,8 +364,9 @@ def uncached_where_no_cache_can_be_written(options):
Every function numbox caches decorates under the one ``jit_options``, so the question is put here, once, for
a source file in each directory of the package that holds a module, and answered for the package. Where
numba can cache no function of one of those files the options come back with ``cache`` off and one warning
names the remedy: ``NUMBA_CACHE_DIR`` for a source file on disk, or a shorter one, or none, where the
location is too long for the file system; for a ``.zip``, the user's cache directory made writable, since
names the remedy: ``NUMBA_CACHE_DIR`` for a source file on disk, and where the location is too long for the
file system what shortens the one it is, as ``cache_remedy`` sets out; for a ``.zip``, the user's cache
directory made writable, since
numba reads ``NUMBA_CACHE_DIR`` only for a source file on disk; for any other archive,
or a ``.pyc``-only install, or a ``.pyc`` in a ``.zip``, the source files on disk or a ``.zip`` holding them,
which numba 0.61 and later cache in the user's cache directory. ``NUMBOX_JIT_OPTIONS='{"cache": false}'``
Expand Down
Loading
Loading