diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..11ca7196 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,23 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: check-added-large-files + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.1.5 + hooks: + - id: ruff # Run the linter + args: [ --fix ] + types_or: [ python, pyi, jupyter ] + - id: ruff-format # Run the formatter + types_or: [ python, pyi, jupyter ] + +# https://pre-commit.ci/#configuration +ci: + autofix_prs: true + autoupdate_schedule: quarterly diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..d3a96c17 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,15 @@ +[tool.ruff.format] +# https://docs.astral.sh/ruff/settings/#format +line-ending = "lf" # Use UNIX `\n` line endings for all files + +[tool.ruff.lint] +# https://docs.astral.sh/ruff/rules/ +select = [ + "E", # pycodestyle errors + "F", # pyflakes + "I", # isort + "NPY", # numpy + "PL", # pylint + "UP", # pyupgrade + "W", # pycodestyle warnings +] diff --git a/trainer.py b/trainer.py index e1a875b9..0a50fc0f 100644 --- a/trainer.py +++ b/trainer.py @@ -9,7 +9,6 @@ - https://lightning.ai/docs/pytorch/2.1.0/cli/lightning_cli.html - https://pytorch-lightning.medium.com/introducing-lightningcli-v2-supercharge-your-training-c070d43c7dd6 """ -import torch from lightning.pytorch.cli import ArgsType, LightningCLI from src.datamodule import BaseDataModule @@ -34,6 +33,7 @@ def cli_main( trainer_defaults=trainer_defaults, args=args, ) + return cli # %%