diff --git a/.flake8 b/.flake8 deleted file mode 100644 index fdfc7cc..0000000 --- a/.flake8 +++ /dev/null @@ -1,29 +0,0 @@ -[flake8] -exclude = - .git - __pycache__ - build - dist - examples - autotest -ignore = - # https://flake8.pycqa.org/en/latest/user/error-codes.html - F401, - # https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes - # Indentation - E121, E122, E126, E127, E128, - # Whitespace - E203, E221, E222, E226, E231, E241, - # Import - E402, - # Line length - E501, E502, - # Statement - E722, E741, - # Whitespace warning - W291, W292, W293, - # Blank line warning - W391, - # Line break warning - W503, W504 -statistics = True \ No newline at end of file diff --git a/.github/workflows/pymake-linting-install.yml b/.github/workflows/pymake-linting-install.yml index dca94a2..ca256e9 100644 --- a/.github/workflows/pymake-linting-install.yml +++ b/.github/workflows/pymake-linting-install.yml @@ -29,34 +29,13 @@ jobs: uses: ts-graphviz/setup-graphviz@v2 - name: Install packages - run: | - pip install requests pydotplus appdirs numpy matplotlib - pip install https://github.com/modflowpy/flopy/zipball/develop - pip install pylint flake8 black + run: pip install ".[lint]" - - name: Run isort - run: | - echo "if isort check fails update isort using" - echo " pip install isort --upgrade" - echo "and run" - echo " isort ./flopy" - echo "and then commit the changes." - isort --verbose --check --diff ./pymake - - - name: Run black - run: | - echo "if black check fails update black using" - echo " pip install black --upgrade" - echo "and run" - echo " black ./flopy" - echo "and then commit the changes." - black --check --diff ./pymake - - - name: Run flake8 - run: flake8 --count --show-source --exit-zero ./pymake - - - name: Run pylint - run: pylint --jobs=2 --errors-only --exit-zero ./pymake + - name: Lint + run: ruff check . + + - name: Check format + run: ruff format . --check pymake_setup: name: standard installation diff --git a/.gitignore b/.gitignore index 437620c..79b8dbb 100644 --- a/.gitignore +++ b/.gitignore @@ -78,4 +78,7 @@ docs/source/ venv/ # mac files -**/.DS_Store \ No newline at end of file +**/.DS_Store + +# environment files +**.env \ No newline at end of file diff --git a/pymake/cmds/build.py b/pymake/cmds/build.py index 297674d..3a8a82a 100755 --- a/pymake/cmds/build.py +++ b/pymake/cmds/build.py @@ -4,6 +4,7 @@ This script originates from pymake: https://github.com/modflowpy/pymake It requires Python 3.6 or later, and has no dependencies. """ + import sys from pathlib import Path diff --git a/pymake/cmds/createjson.py b/pymake/cmds/createjson.py index 248486f..97d1343 100755 --- a/pymake/cmds/createjson.py +++ b/pymake/cmds/createjson.py @@ -4,6 +4,7 @@ This script originates from pymake: https://github.com/modflowpy/pymake It requires Python 3.6 or later, and has no dependencies. """ + import sys from pathlib import Path diff --git a/pymake/cmds/mfpymakecli.py b/pymake/cmds/mfpymakecli.py index 3ec5fd0..bd2150c 100755 --- a/pymake/cmds/mfpymakecli.py +++ b/pymake/cmds/mfpymakecli.py @@ -4,6 +4,7 @@ This script originates from pymake: https://github.com/modflowpy/pymake It requires Python 3.6 or later, and has no dependencies. """ + import sys from pathlib import Path diff --git a/pymake/utils/_Popen_wrapper.py b/pymake/utils/_Popen_wrapper.py index e9d2a15..18eb8df 100644 --- a/pymake/utils/_Popen_wrapper.py +++ b/pymake/utils/_Popen_wrapper.py @@ -1,6 +1,4 @@ -"""Private functions for running pymake commands using Popen - -""" +"""Private functions for running pymake commands using Popen""" import sys from subprocess import PIPE, STDOUT, Popen diff --git a/pymake/utils/_compiler_language_files.py b/pymake/utils/_compiler_language_files.py index bc51088..c2d3fe2 100644 --- a/pymake/utils/_compiler_language_files.py +++ b/pymake/utils/_compiler_language_files.py @@ -1,5 +1,4 @@ -"""Private functions for processing c/c++ and fortran files -""" +"""Private functions for processing c/c++ and fortran files""" import os diff --git a/pymake/utils/usgsprograms.py b/pymake/utils/usgsprograms.py index 3bce981..9e6f6ba 100644 --- a/pymake/utils/usgsprograms.py +++ b/pymake/utils/usgsprograms.py @@ -416,9 +416,9 @@ def export_json( tzinfo=datetime.timezone.utc ) datetime_str = datetime_obj_utc.strftime("%m/%d/%Y") - prog_data[target][ - "url_download_asset_date" - ] = datetime_str + prog_data[target]["url_download_asset_date"] = ( + datetime_str + ) break if partial_json: diff --git a/pyproject.toml b/pyproject.toml index 83cc097..436b4e4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,11 +41,8 @@ dependencies = [ dynamic = ["version", "readme"] [project.optional-dependencies] lint = [ - "black", "cffconvert", - "flake8", - "isort", - "pylint", + "ruff", ] test = [ "mfpymake[lint]", @@ -90,18 +87,29 @@ include = ["pymake", "pymake.*"] [tool.setuptools.package-data] "pymake.utils" = ["usgsprograms.txt"] -[tool.black] -line-length = 79 -target_version = ["py38"] +[tool.setuptools_scm] +fallback_version = "999" -[tool.flynt] +[tool.ruff] line-length = 79 -verbose = true - -[tool.isort] -profile = "black" -src_paths = ["pymake", "autotest", "examples"] -line_length = 79 +target-version = "py38" +include = [ + "pyproject.toml", + "pymake/**/*.py", + "autotest/**/*.py", + "docs/**/*.py", +] -[tool.setuptools_scm] -fallback_version = "999" +[tool.ruff.lint] +ignore = [ + "E402", # module level import not at top of file + "E712", # Avoid equality comparisons to `True` + "E722", # do not use bare `except` + "E741", # ambiguous variable name + "F401", # unused import + "F403", # unable to detect undefined names (star imports) + "F524", # `.format` missing argument(s) for placeholder(s) + "F811", # Redefinition of unused variable + "F821", # undefined name TODO FIXME + "F841", # local variable assigned but never used +]