diff --git a/.github/workflows/check-format.yml b/.github/workflows/check-format.yml index cbd77d2..87bcb05 100644 --- a/.github/workflows/check-format.yml +++ b/.github/workflows/check-format.yml @@ -20,9 +20,7 @@ jobs: python-version: '3.x' - name: Install dependencies run: | - pip install --upgrade pip - pip install -e .[test] + pip install tox - name: Run code format checks run: | - black --check . - flake8 + tox -e linters_check diff --git a/pyproject.toml b/pyproject.toml index aa4949a..d74c909 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,2 +1,9 @@ -[tool.black] +[tool.ruff] +target-version = "py39" line-length = 100 +lint.isort = { known-first-party = [ + "braket", +] } +lint.extend-select = ["I"] +lint.preview = true + diff --git a/setup.cfg b/setup.cfg index f63b67f..7497459 100644 --- a/setup.cfg +++ b/setup.cfg @@ -7,30 +7,3 @@ addopts = --verbose -n auto testpaths = test/unit_tests -[isort] -line_length = 100 -multi_line_output = 3 -include_trailing_comma = true - -[flake8] -ignore = - # not pep8, black adds whitespace before ':' - E203, - # not pep8, black adds line break before binary operator - W503, - # needed for model regexes - F722, - # needed for model regexes - F821, - # Google Python style is not RST until after processed by Napoleon - # See https://github.com/peterjc/flake8-rst-docstrings/issues/17 - RST201,RST203,RST301, -max_line_length = 100 -max-complexity = 10 -exclude = - __pycache__ - .tox - .git - bin - build - venv diff --git a/setup.py b/setup.py index da01e75..57bf5fc 100644 --- a/setup.py +++ b/setup.py @@ -29,23 +29,24 @@ install_requires=["pydantic>2"], extras_require={ "test": [ - "black", - "flake8", - "flake8-rst-docstrings", - "isort", "jsonschema", "numpy", "pre-commit", - "pylint", "pytest", "pytest-cov", "pytest-rerunfailures", "pytest-xdist", + "tox", + ], + "linters": [ + "ruff", + "tox", + ], + "docs": [ "sphinx", "sphinx-rtd-theme", "sphinxcontrib-apidoc", - "tox", - ] + ], }, url="https://github.com/amazon-braket/amazon-braket-schemas-python", author="Amazon Web Services", diff --git a/src/braket/_schemas/_version.py b/src/braket/_schemas/_version.py index a4193c6..2385f4d 100644 --- a/src/braket/_schemas/_version.py +++ b/src/braket/_schemas/_version.py @@ -12,7 +12,7 @@ # language governing permissions and limitations under the License. """Version information. - Version number (major.minor.patch[-label]) +Version number (major.minor.patch[-label]) """ __version__ = "1.22.2.dev0" diff --git a/tox.ini b/tox.ini index a763b1f..38b19d1 100644 --- a/tox.ini +++ b/tox.ini @@ -10,50 +10,41 @@ extras = test [testenv:linters] basepython = python3 -skip_install = true +# Remove this to check what versions are installed for the env. This stops running pip freeze. +list_dependencies_command = echo deps = - {[testenv:isort]deps} - {[testenv:black]deps} - {[testenv:flake8]deps} + {[testenv:ruff-format]deps} + {[testenv:ruff-check]deps} commands = - # isort MUST come before black as it will revert any changes made by black - {[testenv:isort]commands} - {[testenv:black]commands} - {[testenv:flake8]commands} + {[testenv:ruff-format]commands} + {[testenv:ruff-check]commands} -[testenv:flake8] +# Read only linter env +[testenv:linters_check] basepython = python3 -skip_install = true -deps = - flake8 - flake8-rst-docstrings +extras = linters commands = - flake8 {posargs} + {[testenv:ruff-check]commands} -[testenv:isort] +[testenv:ruff-check] basepython = python3 -skip_install = true -deps = - isort +extras = linters +deps = ruff commands = - isort -rc . {posargs} + ruff check src {posargs} -[testenv:black] +[testenv:ruff-format] basepython = python3 -skip_install = true -deps = - black +extras = linters +deps = ruff commands = - black ./ {posargs} + ruff format . {posargs} [testenv:docs] basepython = python3 -deps = - sphinx - sphinx-rtd-theme - sphinxcontrib-apidoc commands = sphinx-build -E -T -b html doc build/documentation/html +extras = docs [testenv:serve-docs] basepython = python3