pandas-dev / pandas

Flexible and powerful data analysis / manipulation library for Python, providing labeled data structures similar to R data.frame objects, statistical functions, and much more
https://pandas.pydata.org
BSD 3-Clause "New" or "Revised" License
43.1k stars 17.74k forks source link

BUG: ./ci/code_checks.sh fails in local dev environment #58612

Closed tuhinsharma121 closed 3 weeks ago

tuhinsharma121 commented 3 months ago

Pandas version checks

Reproducible Example

$ ./ci/code_checks.sh code          # checks on imported code
$ ./ci/code_checks.sh doctests      # run doctests
$ ./ci/code_checks.sh docstrings    # validate docstring errors
$ ./ci/code_checks.sh single-docs   # check single-page docs build warning-free
$ ./ci/code_checks.sh notebooks     # check execution of documentation notebooks

Issue Description

results in the following error

./ci/code_checks.sh: line 19: conditional binary operator expected
./ci/code_checks.sh: line 19: syntax error near `1'
./ci/code_checks.sh: line 19: `if [[ -v 1 ]]; then'

Expected Behavior

It should run all the checks.

Installed Versions

INSTALLED VERSIONS ------------------ commit : 02708ed7c104d0e42395b383ef23c0e6ed7981aa python : 3.10.14.final.0 python-bits : 64 OS : Darwin OS-release : 23.4.0 Version : Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:25 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6030 machine : arm64 processor : arm byteorder : little LC_ALL : None LANG : None LOCALE : None.UTF-8 pandas : 3.0.0.dev0+868.g02708ed7c1 numpy : 1.26.4 pytz : 2024.1 dateutil : 2.9.0 setuptools : 69.5.1 pip : 24.0 Cython : 3.0.10 pytest : 8.2.0 hypothesis : 6.100.2 sphinx : 7.3.7 blosc : None feather : None xlsxwriter : 3.1.9 lxml.etree : 5.2.1 html5lib : 1.1 pymysql : 1.4.6 psycopg2 : 2.9.9 jinja2 : 3.1.3 IPython : 8.22.2 pandas_datareader : None adbc-driver-postgresql: None adbc-driver-sqlite : None bs4 : 4.12.3 bottleneck : 1.3.8 fastparquet : 2024.2.0 fsspec : 2024.3.1 gcsfs : 2024.3.1 matplotlib : 3.8.4 numba : 0.59.1 numexpr : 2.9.0 odfpy : None openpyxl : 3.1.2 pyarrow : 15.0.2 pyreadstat : 1.2.7 python-calamine : None pyxlsb : 1.0.10 s3fs : 2024.3.1 scipy : 1.13.0 sqlalchemy : 2.0.29 tables : 3.9.2 tabulate : 0.9.0 xarray : 2024.3.0 xlrd : 2.0.1 zstandard : 0.22.0 tzdata : 2024.1 qtpy : None pyqt5 : None
tuhinsharma121 commented 3 months ago

I see the problem is here

if [[ -v 1 ]]; then
    CHECK=$1
else
    # script will fail if it uses an unset variable (i.e. $1 is not provided)
    CHECK=""
fi

If I change the above to the following then it works fine

if [ -v "$1" ]; then
    CHECK="$1"
else
    # script will fail if it uses an unset variable (i.e. $1 is not provided)
    CHECK=""
fi

Let me know if I should create a PR for this.

sukriti1 commented 1 month ago

take

tuhinsharma121 commented 3 weeks ago

alright. Apparently upgrading bash to the latest version resolved the issue.

brew install bash