Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moves from black and flake8 to ruff #24

Merged
merged 1 commit into from
Nov 20, 2024
Merged
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
3 changes: 0 additions & 3 deletions .flake8

This file was deleted.

9 changes: 5 additions & 4 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,20 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.11"
cache: "pip"
- 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-get update
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