diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 39fe509c6cd29..092515f1e450a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -46,6 +46,14 @@ repos: files: ^(environment.yml|requirements-dev.txt)$ pass_filenames: false additional_dependencies: [pyyaml] + - id: flake8-rst + name: flake8-rst + description: Run flake8 on code snippets in docstrings or RST files + language: python + entry: flake8-rst + types: [rst] + args: [--filename=*.rst] + additional_dependencies: [flake8-rst==0.7.0, flake8==3.7.9] - repo: https://github.com/asottile/yesqa rev: v1.2.2 hooks: diff --git a/ci/code_checks.sh b/ci/code_checks.sh index b8f6bd53d4a59..784d2c9a411ab 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -73,13 +73,6 @@ if [[ -z "$CHECK" || "$CHECK" == "lint" ]]; then flake8 --format="$FLAKE8_FORMAT" pandas/_libs --append-config=flake8/cython-template.cfg RET=$(($RET + $?)) ; echo $MSG "DONE" - echo "flake8-rst --version" - flake8-rst --version - - MSG='Linting code-blocks in .rst documentation' ; echo $MSG - flake8-rst doc/source --filename=*.rst --format="$FLAKE8_FORMAT" - RET=$(($RET + $?)) ; echo $MSG "DONE" - # Check that cython casting is of the form `obj` as opposed to ` obj`; # it doesn't make a difference, but we want to be internally consistent. # Note: this grep pattern is (intended to be) equivalent to the python diff --git a/environment.yml b/environment.yml index 6e9b417beb0af..77a9c5fd4822d 100644 --- a/environment.yml +++ b/environment.yml @@ -17,9 +17,8 @@ dependencies: # code checks - black=20.8b1 - cpplint - - flake8<3.8.0 # temporary pin, GH#34150 + - flake8 - flake8-comprehensions>=3.1.0 # used by flake8, linting of unnecessary comprehensions - - flake8-rst>=0.6.0,<=0.7.0 # linting of code blocks in rst files - isort>=5.2.1 # check that imports are in the right order - mypy=0.782 - pre-commit @@ -113,4 +112,3 @@ dependencies: - pip: - git+https://github.com/pandas-dev/pydata-sphinx-theme.git@master - git+https://github.com/numpy/numpydoc - - pyflakes>=2.2.0 diff --git a/requirements-dev.txt b/requirements-dev.txt index e6346e6c38694..17ca6b8401501 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -8,9 +8,8 @@ asv cython>=0.29.21 black==20.8b1 cpplint -flake8<3.8.0 +flake8 flake8-comprehensions>=3.1.0 -flake8-rst>=0.6.0,<=0.7.0 isort>=5.2.1 mypy==0.782 pre-commit @@ -79,4 +78,3 @@ tabulate>=0.8.3 natsort git+https://github.com/pandas-dev/pydata-sphinx-theme.git@master git+https://github.com/numpy/numpydoc -pyflakes>=2.2.0