diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 26e931c658a..6a8511891d7 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -8,7 +8,9 @@ "service": "app", "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", // Prep some host side things for the container build - "initializeCommand": [".devcontainer/scripts/prep-container-build"], + "initializeCommand": [ + ".devcontainer/scripts/prep-container-build" + ], // Make sure the container user can read/write to the package caches. "onCreateCommand": "sudo -n mkdir -p /opt/conda/pkgs/cache /var/cache/pip && sudo -n chown -R vscode /opt/conda/pkgs/cache /var/cache/pip", // Make sure the conda env is up to date with the source tree expectations. @@ -43,40 +45,45 @@ "python.defaultInterpreterPath": "/opt/conda/envs/mlos/bin/python", "python.testing.pytestPath": "/opt/conda/envs/mlos/bin/pytest", "python.linting.pylintPath": "/opt/conda/envs/mlos/bin/pylint", - "pylint.path": ["/opt/conda/envs/mlos/bin/pylint"], + "pylint.path": [ + "/opt/conda/envs/mlos/bin/pylint" + ], + "python.linting.flake8Path": "/opt/conda/envs/mlos/bin/flake8", "python.linting.mypyPath": "/opt/conda/envs/mlos/bin/mypy", "mypy.dmypyExecutable": "/opt/conda/envs/mlos/bin/dmypy", "mypy.runUsingActiveInterpreter": false }, // Add the IDs of extensions you want installed when the container is created. "extensions": [ - "EditorConfig.EditorConfig", - "streetsidesoftware.code-spell-checker", - "ms-python.vscode-pylance", - "ms-python.python", - "ms-python.pylint", - "matangover.mypy", + "davidanson.vscode-markdownlint", + "donjayamanne.githistory", "donjayamanne.python-environment-manager", - "njpwerner.autodocstring", - "ms-toolsai.jupyter", + "eamodio.gitlens", + "editorconfig.editorconfig", + "esbenp.prettier-vscode", + "github.copilot", + "github.vscode-github-actions", + "github.vscode-pull-request-github", + "gruntfuggly.todo-tree", + "hashicorp.terraform", + "huntertran.auto-markdown-toc", + "ibm.output-colorizer", "lextudio.restructuredtext", - "trond-snekvik.simple-rst", - "DavidAnson.vscode-markdownlint", // Linter for markdown files - "huntertran.auto-markdown-toc", // Auto-generated Markdown Table of Contents - "github.vscode-github-actions", // GitHub Actions integration + "matangover.mypy", "ms-azuretools.vscode-docker", - "waderyan.gitblame", // Enhances git blame experience - "donjayamanne.githistory", // Enhanced git history experience - "eamodio.gitlens", - "ms-vsliveshare.vsliveshare", // Allows easy code share - "Gruntfuggly.todo-tree", // Highlights TODO comments in code - "github.copilot", // Copilot integration - "IBM.output-colorizer", // Colorize your output/test logs - "hashicorp.terraform", // Terraform syntax highlighting - "redhat.vscode-yaml", // Kubernetes manifest syntax highlighting - "stkb.rewrap", // "Alt + Q" -> rewrap comments after n characters on one line - "tyriar.sort-lines", // "Ctrl + Shift + P -> Sort lines" -> sort lines alphabetically - "esbenp.prettier-vscode" // A pretty good formatter for many languages + "ms-python.autopep8", + "ms-python.flake8", + "ms-python.pylint", + "ms-python.python", + "ms-python.vscode-pylance", + "ms-vsliveshare.vsliveshare", + "njpwerner.autodocstring", + "redhat.vscode-yaml", + "stkb.rewrap", + "streetsidesoftware.code-spell-checker", + "trond-snekvik.simple-rst", + "tyriar.sort-lines", + "waderyan.gitblame" ] } } diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000000..cf0454734c8 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,4 @@ +{ + "editorconfig": true, + "trailingComma": "es5" +} diff --git a/.pylintrc b/.pylintrc index bb0ab42cd0d..d373c159b58 100644 --- a/.pylintrc +++ b/.pylintrc @@ -8,7 +8,7 @@ fail-under=9.8 # See Also: https://github.com/PyCQA/pydocstyle/issues/309#issuecomment-1426642147 # Also fail on unused imports. fail-on= - C0116, + missing-function-docstring, unused-import # Ignore pylint complaints about an upstream dependency. diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 76055ecaddc..7c520200b82 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,30 +1,33 @@ { "recommendations": [ - "EditorConfig.EditorConfig", - "streetsidesoftware.code-spell-checker", - "ms-python.vscode-pylance", - "ms-python.python", - "ms-python.pylint", - "matangover.mypy", + "davidanson.vscode-markdownlint", + "donjayamanne.githistory", "donjayamanne.python-environment-manager", - "njpwerner.autodocstring", + "eamodio.gitlens", + "editorconfig.editorconfig", + "esbenp.prettier-vscode", + "github.copilot", + "github.vscode-github-actions", + "github.vscode-pull-request-github", + "gruntfuggly.todo-tree", + "hashicorp.terraform", + "huntertran.auto-markdown-toc", + "ibm.output-colorizer", "lextudio.restructuredtext", - "trond-snekvik.simple-rst", - "DavidAnson.vscode-markdownlint", // Linter for markdown files - "huntertran.auto-markdown-toc", // Auto-generated Markdown Table of Contents - "github.vscode-github-actions", // GitHub Actions integration + "matangover.mypy", "ms-azuretools.vscode-docker", - "waderyan.gitblame", // Enhances git blame experience - "donjayamanne.githistory", // Enhanced git history experience - "eamodio.gitlens", - "ms-vsliveshare.vsliveshare", // Allows easy code share - "Gruntfuggly.todo-tree", // Highlights TODO comments in code - "github.copilot", // Copilot integration - "IBM.output-colorizer", // Colorize your output/test logs - "hashicorp.terraform", // Terraform syntax highlighting - "redhat.vscode-yaml", // Kubernetes manifest syntax highlighting - "stkb.rewrap", // "Alt + Q" -> rewrap comments after n characters on one line - "tyriar.sort-lines", // "Ctrl + Shift + P -> Sort lines" -> sort lines alphabetically - "esbenp.prettier-vscode" // A pretty good formatter for many languages + "ms-python.autopep8", + "ms-python.flake8", + "ms-python.pylint", + "ms-python.python", + "ms-python.vscode-pylance", + "ms-vsliveshare.vsliveshare", + "njpwerner.autodocstring", + "redhat.vscode-yaml", + "stkb.rewrap", + "streetsidesoftware.code-spell-checker", + "trond-snekvik.simple-rst", + "tyriar.sort-lines", + "waderyan.gitblame" ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index d39722b35f8..052dab3f342 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -10,7 +10,8 @@ "python.linting.pylintEnabled": true, "python.linting.pycodestyleEnabled": true, "python.linting.pydocstyleEnabled": true, - "python.linting.mypyEnabled": false, // use the dmypy daemon extension instead - it's faster + "python.linting.flake8Enabled": true, + "python.linting.mypyEnabled": false, // use the dmypy daemon extension instead - it's faster // "mypy.runUsingActiveInterpreter": true, // in the devcontainer we override this to use an explicit path "autoDocstring.docstringFormat": "numpy", "json.validate.enable": true, @@ -50,5 +51,14 @@ "--ignore D001" ], "esbonio.sphinx.confDir": "${workspaceFolder}/doc/source", - "esbonio.sphinx.buildDir": "${workspaceFolder}/doc/build/" + "esbonio.sphinx.buildDir": "${workspaceFolder}/doc/build/", + "editor.formatOnSave": true, + "editor.formatOnSaveMode": "modifications", + "editor.defaultFormatter": "esbenp.prettier-vscode", + "python.formatting.provider": "none", + "[python]": { + "editor.defaultFormatter": "ms-python.autopep8", + "editor.formatOnSave": true, + "editor.formatOnSaveMode": "modifications" + } } diff --git a/Makefile b/Makefile index a42cfb8573f..8d0945fcdd8 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ MKDIR_BUILD := $(shell test -d build || mkdir build) # Run make in parallel by default. MAKEFLAGS += -j$(shell nproc) -MAKEFLAGS += -Oline +#MAKEFLAGS += -Oline .PHONY: all all: check test dist dist-test doc licenseheaders diff --git a/conda-envs/mlos-3.10.yml b/conda-envs/mlos-3.10.yml index f3b223a824f..66be1b85db2 100644 --- a/conda-envs/mlos-3.10.yml +++ b/conda-envs/mlos-3.10.yml @@ -9,6 +9,7 @@ dependencies: - pycodestyle - autopep8 - pydocstyle + - flake8 - setuptools - setuptools-scm - jupyter diff --git a/conda-envs/mlos-3.11.yml b/conda-envs/mlos-3.11.yml index 79aa904fbcd..583ce8ea3c7 100644 --- a/conda-envs/mlos-3.11.yml +++ b/conda-envs/mlos-3.11.yml @@ -9,6 +9,7 @@ dependencies: - pycodestyle - autopep8 - pydocstyle + - flake8 - setuptools - setuptools-scm - jupyter diff --git a/conda-envs/mlos-3.8.yml b/conda-envs/mlos-3.8.yml index 050fedfc71c..a095da8b2d4 100644 --- a/conda-envs/mlos-3.8.yml +++ b/conda-envs/mlos-3.8.yml @@ -9,6 +9,7 @@ dependencies: - pycodestyle - autopep8 - pydocstyle + - flake8 - setuptools - setuptools-scm - jupyter diff --git a/conda-envs/mlos-3.9.yml b/conda-envs/mlos-3.9.yml index 844d2883dfd..e5a1d4abb68 100644 --- a/conda-envs/mlos-3.9.yml +++ b/conda-envs/mlos-3.9.yml @@ -9,6 +9,7 @@ dependencies: - pycodestyle - autopep8 - pydocstyle + - flake8 - setuptools - setuptools-scm - jupyter diff --git a/conda-envs/mlos-windows.yml b/conda-envs/mlos-windows.yml index ebb94da4f87..6c4b1360bac 100644 --- a/conda-envs/mlos-windows.yml +++ b/conda-envs/mlos-windows.yml @@ -9,6 +9,7 @@ dependencies: - pycodestyle - autopep8 - pydocstyle + - flake8 - setuptools - setuptools-scm - jupyter diff --git a/conda-envs/mlos.yml b/conda-envs/mlos.yml index 080f9d8dc35..66a5c28f4df 100644 --- a/conda-envs/mlos.yml +++ b/conda-envs/mlos.yml @@ -9,6 +9,7 @@ dependencies: - pycodestyle - autopep8 - pydocstyle + - flake8 - setuptools - setuptools-scm - jupyter diff --git a/mlos_bench/setup.py b/mlos_bench/setup.py index b159495609f..421c1a8dd63 100644 --- a/mlos_bench/setup.py +++ b/mlos_bench/setup.py @@ -18,14 +18,14 @@ from setuptools_scm import get_version version = get_version(root='..', relative_to=__file__) if version is not None: - _VERSION = version + _VERSION = version # noqa: F811 except ImportError: warning("setuptools_scm not found, using version from _version.py") except LookupError as e: warning(f"setuptools_scm failed to find git version, using version from _version.py: {e}") -extra_requires: Dict[str, List[str]] = { +extra_requires: Dict[str, List[str]] = { # pylint: disable=consider-using-namedtuple-or-dataclass # Additional tools for extra functionality. 'azure': ['azure-storage-file-share'], 'storage-sql-duckdb': ['sqlalchemy', 'duckdb_engine'], diff --git a/mlos_core/setup.py b/mlos_core/setup.py index 51d0e357d39..7ec91e2679f 100644 --- a/mlos_core/setup.py +++ b/mlos_core/setup.py @@ -18,14 +18,14 @@ from setuptools_scm import get_version version = get_version(root='..', relative_to=__file__) if version is not None: - _VERSION = version + _VERSION = version # noqa: F811 except ImportError: warning("setuptools_scm not found, using version from _version.py") except LookupError as e: warning(f"setuptools_scm failed to find git version, using version from _version.py: {e}") -extra_requires: Dict[str, List[str]] = { +extra_requires: Dict[str, List[str]] = { # pylint: disable=consider-using-namedtuple-or-dataclass 'emukit': ['emukit'], 'skopt': ['scikit-optimize<=0.9.0'], # FIXME: temporarily work around some version mismatch issues (PR 850) } @@ -52,10 +52,10 @@ '': ['py.typed', '**/*.pyi'], }, install_requires=[ - 'scikit-learn<1.2', # FIXME: temporarily work around some version mismatch issues (PR 850) - 'joblib>=1.1.1', # CVE-2022-21797: scikit-learn dependency, addressed in 1.2.0dev0, which isn't currently released + 'scikit-learn<1.2', # FIXME: temporarily work around some version mismatch issues (PR 850) + 'joblib>=1.1.1', # CVE-2022-21797: scikit-learn dependency, addressed in 1.2.0dev0, which isn't currently released 'scipy>=1.3.2', - 'numpy<1.24', # FIXME: temporarily work around some version mismatch issues (PR 850) + 'numpy<1.24', # FIXME: temporarily work around some version mismatch issues (PR 850) 'pandas>=1.0.3', 'ConfigSpace>=0.6.1', ], diff --git a/setup.cfg b/setup.cfg index f6eb77d54aa..78b87728ed5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -4,12 +4,9 @@ universal = 1 [pycodestyle] count = True -# E124: Closing bracket does not match indentation of opening bracket's line -# E261: At least two spaces before inline comment -# E502: The backslash is redundant between brackets # W503: Line break occurred before a binary operator # W504: Line break occurred after a binary operator -ignore = E124,E261,E502,W503,W504 +ignore = W503,W504 format = pylint # See Also: .editorconfig, .pylintrc max-line-length = 132