Skip to content

Commit

Permalink
Moves from black and flake8 to ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
MalcolmMielle committed Nov 20, 2024
1 parent 235dc99 commit 3d1c9f1
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 16 deletions.
3 changes: 0 additions & 3 deletions .flake8

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
pip install ruff
- name: Clone Flir extractor
run: |
git clone https://github.com/ITVRoC/FlirImageExtractor.git --depth 1
sudo apt install exiftool python-setuptools
- name: Lint with flake8
- name: Lint with ruff
run: |
flake8 . --count --show-source --statistics --exclude FlirImageExtractor/
ruff check
- run: pip install -e .
- name: Test with unittest
run: |
Expand Down
7 changes: 2 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
"python.testing.unittestEnabled": true,
"[python]": {
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.organizeImports": "explicit"
},
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.rulers": [
88
],
Expand All @@ -22,10 +23,6 @@
"reportUndefinedVariable": "warning"
},
"editor.formatOnSave": true,
"isort.args": [
"--profile",
"black"
],
"python.analysis.diagnosticMode": "openFilesOnly",
"errorLens.enabledDiagnosticLevels": [
"error",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ python thermo_nerf/scripts/render_video_script.py --dataset_path DATA_PATH --mod

We welcome contributions! Feel free to fork and submit PRs.

We format code using [black](https://pypi.org/project/black/) and follow PEP8.
We format code using [ruff](https://docs.astral.sh/ruff) and follow PEP8.
The code needs to be type annotated and following our documentation style.

## How to cite
Expand Down
48 changes: 44 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,57 @@ description = 'thermo-nerf'
readme = "README.md"
requires-python = ">=3.10"
keywords = ["pytorch", "thermal", "nerf", "mlflow", "flir"]
dependencies = ["nerfstudio >= 0.1.19", "mlflow >= 2.11.1"]
dependencies = ["nerfstudio >= 0.1.19", "mlflow >= 2.11.1", "ruff >= 0.7.4"]

[project.optional-dependencies]
flir = ["flirimageextractor >= 1.5.3"]

[tool.hatch.build.targets.wheel]
packages = ["thermo_nerf", "thermo_scenes"]

[tool.isort]
profile = "black"
known_third_party = ["nerfstudio", "FlirImageExtractor"]
# RUFF

[tool.ruff]
line-length = 88
indent-width = 4

[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 = ["E", "F"]
ignore = ["F722", "F821"]

# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []

[tool.ruff.lint.isort]
known-third-party = ["FlirImageExtractor"]

[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"
# Enable auto-formatting of code examples in docstrings. Markdown,
# reStructuredText code/literal blocks and doctests are all supported.
#
# This is currently disabled by default, but it is planned for this
# to be opt-out in the future.
docstring-code-format = true
# Set the line length limit used when formatting code snippets in
# docstrings.
#
# This only has an effect when the `docstring-code-format` setting is
# enabled.
docstring-code-line-length = "dynamic"

# CLI

[project.scripts]
thermoscenes_images_to_nerf_dataset = "thermo_scenes.scripts.images_to_nerf_dataset:main"
Expand Down

0 comments on commit 3d1c9f1

Please sign in to comment.