Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 120
tab_width = 4
ij_continuation_indent_size = 8
ij_formatter_off_tag = @formatter:off
ij_formatter_on_tag = @formatter:on
ij_formatter_tags_enabled = true
ij_smart_tabs = false
ij_visual_guides = none
ij_wrap_on_typing = false

[*.bat]
end_of_line = crlf
25 changes: 25 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-merge-conflict
- id: check-case-conflict
- id: check-illegal-windows-names
- id: destroyed-symlinks
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-executables-have-shebangs
- id: check-yaml

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.14
hooks:
# Run the Ruff linter, but not the formatter.
- id: ruff
args: ["--fix"]
types_or: [ python, pyi, jupyter ]

ci:
autofix_prs: false
36 changes: 36 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,39 @@ Homepage = "https://github.com/Nerogar/mgds"
Issues = "https://github.com/Nerogar/mgds/issues"

[tool.setuptools_scm]

[tool.ruff]
extend-exclude = [
# Exclude all third-party dependencies and environments.
# NOTE: Conda installs mgds+diffusers into "src/" in the project directory.
".venv*",
"venv*",
"conda_env*",
]
line-length = 120

[tool.ruff.lint]
select = ["F", "E", "W", "I", "B", "UP", "YTT", "BLE", "C4", "T10", "ISC", "ICN", "PIE", "PYI", "RSE", "RET", "SIM", "PGH", "FLY", "NPY", "PERF"]
ignore = ["BLE001", "E402", "E501", "B024", "PGH003", "RET504", "RET505", "SIM102", "UP015", "PYI041"]

[tool.ruff.lint.isort.sections]
hf = ["diffusers*", "transformers*"]
mgds = ["mgds"]
torch = ["torch*"]

[tool.ruff.format]
quote-style = "double"
docstring-code-format = true

[tool.ruff.lint.isort]
known-first-party = ["modules"]
section-order = [
"future",
"standard-library",
"first-party",
"mgds",
"torch",
"hf",
"third-party",
"local-folder",
]
4 changes: 4 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Git commit hook handler.
# NOTE: It's a user-wide tool installed outside venv. Don't pin exact versions.
# SEE: https://pre-commit.com/
pre-commit>=4.0.1