Skip to content

Commit

Permalink
prepare ruff setup with pre-commit hook #102
Browse files Browse the repository at this point in the history
  • Loading branch information
bensteUEM committed Oct 4, 2024
1 parent 8cd66cb commit e4089d6
Show file tree
Hide file tree
Showing 4 changed files with 139 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.6.7 # Use the latest stable version of Ruff
hooks:
- id: ruff
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"python.testing.pytestEnabled": true,
"python.testing.unittestEnabled": false,
"[python]": {
"editor.defaultFormatter": "ms-python.autopep8",
"editor.formatOnSave": true
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.formatOnSave": false
},
"python.formatting.provider": "none"
}
82 changes: 74 additions & 8 deletions generate_pyproj.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
"version": version,
"description": "A python wrapper for use with ChurchToolsAPI",
"authors": ["bensteUEM", "kolibri52", "fschrempf"],
"homepage": 'https://github.com/bensteUEM/ChurchToolsAPI',
"homepage": "https://github.com/bensteUEM/ChurchToolsAPI",
"license": "CC-BY-SA",
"readme": "README.md",
"dependencies": {
"python": "^3.8",
"python": "^3.9",
"python-docx": "^0.8.11",
"requests": "^2.31.0"
"requests": "^2.31.0",
},
"group": {
"dev": {
Expand All @@ -31,16 +31,82 @@
"wheel": "^0.41.2",
"setuptools": "^66.1.1",
"autopep8": "^2.0.4",
"pytest" : "^8.3.3",
"pytest": "^8.3.3",
"pre-commit": "^3.8.0",
}
}
}
}
},
},
"ruff": {
# Exclude a variety of commonly ignored directories.
"exclude": [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
],
# Same as Black.
"line-length": 88,
"indent-width": 4,
# Assume Python 3.9
"target-version": "py39",
# Group violations by containing file.
"output-format": "grouped",
"lint": {
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
"select": ["ALL"],
"ignore": [],
# Allow fix for all enabled rules (when `--fix`) is provided.
"fixable": ["ALL"],
"unfixable": [],
# Allow unused variables when underscore-prefixed.
"dummy-variable-rgx": "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$",
"pydocstyle": {
"convention": "google",
},
},
"format": {
# Like Black, use double quotes for strings.
"quote-style": "double",
# Like Black, indent with spaces, rather than tabs.
"indent-style": "space",
# Like Black, respect magic trailing commas.
"skip-magic-trailing-comma": False,
# Like Black, automatically detect the appropriate line ending.
"line-ending": "auto",
# Enable auto-formatting of code examples in docstrings.
"docstring-code-format": False,
# Set the line length limit used when formatting code snippets in docstrings.
"docstring-code-line-length": "dynamic",
},
},
},
"build-system": {
"requires": ["poetry-core"],
"build-backend": "poetry.core.masonry.api"
}
"build-backend": "poetry.core.masonry.api",
},
}

with open("pyproject.toml", "wb") as toml_file:
Expand Down
59 changes: 58 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ license = "CC-BY-SA"
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.8"
python = "^3.9"
python-docx = "^0.8.11"
requests = "^2.31.0"

Expand All @@ -23,6 +23,63 @@ wheel = "^0.41.2"
setuptools = "^66.1.1"
autopep8 = "^2.0.4"
pytest = "^8.3.3"
pre-commit = "^3.8.0"

[tool.ruff]
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
]
line-length = 88
indent-width = 4
target-version = "py39"
output-format = "grouped"

[tool.ruff.lint]
select = [
"ALL",
]
ignore = []
fixable = [
"ALL",
]
unfixable = []
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

[tool.ruff.lint.pydocstyle]
convention = "google"

[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"
docstring-code-format = false
docstring-code-line-length = "dynamic"

[build-system]
requires = [
Expand Down

0 comments on commit e4089d6

Please sign in to comment.