From d887d7485231484f67721a5ec31aee0c7b5286a6 Mon Sep 17 00:00:00 2001 From: Laurent FAINSIN Date: Tue, 11 Apr 2023 11:12:47 +0200 Subject: [PATCH] feat: add some toolings --- .editorconfig | 15 +++++++++++++++ .vscode/settings.json | 29 +++++++++++++++++++++++++++++ environment.yml | 5 +++++ pyproject.toml | 23 +++++++++++++++++++++++ 4 files changed, 72 insertions(+) create mode 100644 .editorconfig create mode 100644 .vscode/settings.json create mode 100644 pyproject.toml diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..8c28df6 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.{json,toml,yaml,yml}] +indent_size = 2 diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..ed64833 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,29 @@ +{ + "python.defaultInterpreterPath": "/local_scratch/lfainsin/.conda/envs/pyg/bin/python", // required for python ide tools + "python.terminal.activateEnvironment": false, // or else terminal gets bugged + "python.analysis.typeCheckingMode": "basic", // get ready to be annoyed + "python.formatting.provider": "black", // opinionated, fuck off + "editor.formatOnSave": true, // not based if set to false + "python.linting.enabled": true, // not based if set to false + "python.linting.lintOnSave": true, // not based if set to false + "python.linting.flake8Enabled": false, // in case you want to use flake8 instead of ruff + "python.linting.mypyEnabled": true, // who though dynamic typing was a good idea ? + "python.linting.banditEnabled": true, // just in case + "jupyter.debugJustMyCode": false, // may be useful to set to true ! + "[python]": { + "editor.codeActionsOnSave": { + "source.organizeImports": true // isort + } + }, + "files.insertFinalNewline": true, + "files.exclude": { + "**/.git": true, // defaults + "**/.svn": true, // defaults + "**/.hg": true, // defaults + "**/CVS": true, // defaults + "**/.DS_Store": true, // defaults + "**/Thumbs.db": true, // defaults + "**/__pycache__": true, // annoying + "**/.mypy_cache": true, // annoying + } +} diff --git a/environment.yml b/environment.yml index f2b1da3..49ea1b5 100644 --- a/environment.yml +++ b/environment.yml @@ -18,3 +18,8 @@ dependencies: - trimesh - scipy - scikit-learn +#---# tooling (linting, typing...) + - ruff + - mypy + - black + - isort diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..6e3bd94 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,23 @@ +[tool.ruff] +select = ["E", "F", "I"] +line-length = 120 + +[tool.black] +exclude = ''' +/( + \.git + \.venv +)/ +''' +include = '\.pyi?$' +line-length = 120 +target-version = ["py39"] + +[tool.isort] +multi_line_output = 3 +profile = "black" + +[tool.mypy] +python_version = "3.9" +warn_return_any = true +warn_unused_configs = true