pydistcheck
pydistcheck copied to clipboard
[new check] file path too long
What should be checked?
pydistcheck should warn about the presence of files with paths longer than n characters.
That check should be enforced based on the length of complete paths, e.g.
lightgbm/basic.py
Should be treated as 17 characters.
What should n be?
Up to whoever implements this feature.
The chosen default value should have some basis in the published limitations on file paths in different systems.
For example:
- https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry
- https://serverfault.com/questions/9546/filename-length-limits-on-linux
- https://en.wikipedia.org/wiki/Comparison_of_file_systems#Limits
- https://stat.ethz.ch/pipermail/r-package-devel/2015q4/000511.html
- https://github.com/wch/r-source/blob/29559f9bf4df2c55ef5eace203cbe335bbd03f2f/src/library/tools/R/check.R#L839-LL841
It should also consider the fact that the files in a Python distribution are highly likely to be installed in paths that themselves might be fairly nested.
So, for example, on a filesystem with a maximum filepath length of 255 characters, if users install into
C:/Users/david.ortiz/Program Files/python3.9/site-packages/
, then that's already 59 characters gone.
What should the name of this check be?
contains-long-filepaths
Will this check introduce any additional configuration?
yes
Details on additional configuration required.
--max-filepath-length should be added, which controls the maximum filepath length allowed in distributions.
Distribution type
- [X] source (e.g.
.tar.gz) - [X] built (e.g.
.whl)
Notes
Everything in R CMD check's check_file_names() could be useful: https://github.com/wch/r-source/blob/29559f9bf4df2c55ef5eace203cbe335bbd03f2f/src/library/tools/R/check.R#L700
I just ran into this in LightGBM's CI!
error: [Errno 63] File name too long: '/Users/runner/miniforge3/conda-bld/python-split_1686419725558/work/Modules/_blake2/impl/blake2-config.h /Users/runner/miniforge3/conda-bld/python-split_1686419725558/work/Modules/_blake2/impl/blake2-impl.h /Users/runner/miniforge3/conda-bld/python-split_1686419725558/work/Modules/_blake2/impl/blake2.h /Users/runner/miniforge3/conda-bld/python-split_1686419725558/work/Modules/_blake2/impl/blake2b-load-sse2.h /Users/runner/miniforge3/conda-bld/python-split_1686419725558/work/Modules/_blake2/impl/blake2b-load-sse41.h /Users/runner/miniforge3/conda-bld/python-split_1686419725558/work/Modules/_blake2/impl/blake2b-ref.c /Users/runner/miniforge3/conda-bld/python-split_1686419725558/work/Modules/_blake2/impl/blake2b-round.h /Users/runner/miniforge3/conda-bld/python-split_1686419725558/work/Modules/_blake2/impl/blake2b.c /Users/runner/miniforge3/conda-bld/python-split_1686419725558/work/Modules/_blake2/impl/blake2s-load-sse2.h /Users/runner/miniforge3/conda-bld/python-split_1686419725558/work/Modules/_blake2/impl/blake2s-load-sse41.h '
here's another good reference: https://blog.r-project.org/2023/03/07/path-length-limit-on-windows/index.html