From c64fc2b8119618d01eae9360301e517aa5533f35 Mon Sep 17 00:00:00 2001 From: Andrew Powers-Holmes Date: Mon, 12 Jun 2023 22:23:49 +1000 Subject: [PATCH] add pre-commit setup --- .pre-commit-config.yaml | 21 +++++++++++++++++++++ pyproject.toml | 11 +++++++---- setup.py | 9 ++++++++- 3 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..7f63f19 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,21 @@ +# 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.4.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files + + - repo: https://github.com/charliermarsh/ruff-pre-commit + rev: "v0.0.272" + hooks: + - id: ruff + args: [--fix, --exit-non-zero-on-fix] + + - repo: https://github.com/psf/black + rev: 23.3.0 + hooks: + - id: black diff --git a/pyproject.toml b/pyproject.toml index 70d39be..b019588 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,6 @@ [build-system] build-backend = "setuptools.build_meta" -requires = [ - "setuptools>=61.0.0", - "wheel", -] +requires = ["setuptools>=61.0.0", "wheel", "setuptools_scm[toml]>=6.2"] [tool.setuptools_scm] write_to = "muse_maskgit_pytorch/_version.py" @@ -15,7 +12,13 @@ target-version = ['py38', 'py39', 'py310'] [tool.ruff] line-length = 110 target-version = 'py38' +format = "grouped" +ignore-init-module-imports = true +select = ["E", "F", "I"] +ignore = ['F841', 'F401', 'E501'] [tool.ruff.isort] combine-as-imports = true force-wrap-aliases = true +known-local-folder = ["muse_maskgit_pytorch"] +known-first-party = ["muse_maskgit_pytorch"] diff --git a/setup.py b/setup.py index c89a3d6..826d3d9 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -from setuptools import setup, find_packages +from setuptools import find_packages, setup setup( name="muse-maskgit-pytorch", @@ -17,6 +17,13 @@ "attention mechanism", "text-to-image", ], + extras_require={ + "dev": [ + "pre-commit>=3.3.2", + "black>=23.3.0", + "ruff>=0.0.272", + ] + }, install_requires=[ "accelerate", "diffusers",