Skip to content

Commit

Permalink
ruff for linting and formatting and CI with linting step
Browse files Browse the repository at this point in the history
  • Loading branch information
ltsaprounis committed Dec 20, 2023
1 parent 3bc5fa0 commit 7537c7e
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 7 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/python_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Python CI

on:
push:
branches: [Python]
pull_request:
branches: [Python]

jobs:
linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1
with:
src: "./python"
76 changes: 69 additions & 7 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,8 @@ readme = "README.md"
requires-python = ">=3.8,<3.11"
dependencies = ["pybind11[global]>=2.6.0", "numpy>=1.14"]

# [tool.setuptools.packages]
# find = {}

[project.optional-dependencies]
dev = ["flake8", "black", "pytest", "pydocstyle", "pre-commit", "ipykernel"]

# [tool.pytest.ini_options]
# addopts = "--ignore=../src/carma"
dev = ["pytest", "ruff", "pre-commit", "ipykernel"]

[tool.scikit-build]
# wheel.expand-macos-universal-tags = true
Expand All @@ -28,3 +22,71 @@ ninja.make-fallback = true
cmake.verbose = true
ninja.minimum-version = "1.5"
cmake.minimum-version = "3.25"

[tool.ruff]
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
"tools/cookiecutter_templates",
]

# Same as Black.
line-length = 88
indent-width = 4

# Assume Python 3.8
target-version = "py38"

[tool.ruff.lint]
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
# McCabe complexity (`C901`) by default.
select = [
"E4",
"E7",
"E9",
"F",
"I", # isort rules
"E501",
]
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]+?))$"

[tool.ruff.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"

0 comments on commit 7537c7e

Please sign in to comment.