diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..72513dd3 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,20 @@ +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files + +- repo: https://github.com/psf/black + rev: 24.1.1 + hooks: + - id: black + language_version: python3.12 + +- repo: https://github.com/pycqa/isort + rev: 5.13.2 + hooks: + - id: isort + name: isort (python) diff --git a/pyproject.toml b/pyproject.toml index df9d717d..6966c146 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,3 +20,13 @@ classifiers = [ [project.urls] "Homepage" = "https://github.com/open-thought/reasoning-gym" "Bug Tracker" = "https://github.com/open-thought/reasoning-gym/issues" + +[tool.black] +line-length = 120 +target-version = ['py312'] +include = '\.pyi?$' + +[tool.isort] +profile = "black" +multi_line_output = 3 +line_length = 120 diff --git a/requirements-dev.txt b/requirements-dev.txt index f3a92e7f..5db97aaf 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -3,3 +3,4 @@ black>=23.7.0 isort>=5.12.0 flake8>=6.1.0 mypy>=1.5.1 +pre-commit>=3.5.0