diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..160d197 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,9 @@ +{ + "recommendations": [ + "editorconfig.editorconfig", + "eamodio.gitlens", + "ms-python.python", + "ms-python.black-formatter", + "charliermarsh.ruff", + ] +} diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..dc72489 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,17 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Python: Current File", + "type": "python", + "request": "launch", + "program": "${file}", + "console": "integratedTerminal", + "justMyCode": false, + "env": { + "OMP_NUM_THREADS": "1", + "CUDA_VISIBLE_DEVICES": "1", + } + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..fa89e7a --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,67 @@ +{ + // nice editor settings + "editor.formatOnSave": true, + "editor.formatOnPaste": true, + "editor.codeActionsOnSave": { + "source.organizeImports": true, + "source.fixAll": false, + }, + "editor.rulers": [ + 120 + ], + // editorconfig redundancy + "files.insertFinalNewline": true, + "files.trimTrailingWhitespace": true, + // hidde unimportant files/folders + "files.exclude": { + // defaults + "**/.git": true, + "**/.svn": true, + "**/.hg": true, + "**/CVS": true, + "**/.DS_Store": true, + "**/Thumbs.db": true, + // annoying + "**/__pycache__": true, + "**/.mypy_cache": true, + "**/.ruff_cache": true, + "**/*.tmp": true, + }, + // cpp /clang / cmake settings + "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools", + "C_Cpp.intelliSenseEngine": "disabled", + "C_Cpp.intelliSenseEngineFallback": "enabled", + "C_Cpp.clang_format_path": "/softs/compiler/llvm/latest/bin/clang-format", + "C_Cpp.codeAnalysis.clangTidy.enabled": true, + "C_Cpp.codeAnalysis.clangTidy.path": "/softs/compiler/llvm/latest/bin/clang-tidy", + "clangd.path": "/softs/compiler/llvm/latest/bin/clangd", + "cmake.cmakePath": "/softs/cmake/latest/bin/cmake", + "cmake.preferredGenerators": [ + "Ninja", + "Unix Makefiles" + ], + "cmakeFormat.exePath": "/softs/conda/auto/envs/cmake-format/bin/cmake-format", + "cmake.languageSupport.dotnetPath": "/softs/conda/auto/envs/dotnet/lib/dotnet/dotnet", + // python settings + "python.analysis.typeCheckingMode": "basic", // get ready to be annoyed + "python.defaultInterpreterPath": "/local_scratch/lfainsin/.conda/envs/pointmlp/bin/python", + "python.linting.enabled": true, + "python.linting.lintOnSave": true, + "python.linting.mypyEnabled": true, + // fixes for broken auto-activation on rosetta + "python.terminal.activateEnvironment": false, + "terminal.integrated.profiles.linux": { + "python": { + "path": "bash", + "icon": "rocket", + "args": [ + "--init-file", + ".vscode/setup.sh" + ], + } + }, + "terminal.integrated.env.linux": { + "PYTHONPATH": "${workspaceFolder}/src/", + "SLURM_JOB_ID": null, // unset or else lightning_logs v_num uses it + }, +} diff --git a/.vscode/setup.sh b/.vscode/setup.sh new file mode 100755 index 0000000..e091a48 --- /dev/null +++ b/.vscode/setup.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +source ~/.bashrc + +conda_init +conda activate pointmlp + +export PS1="(pointmlp)[\\u@\\h \\W]\\$ " + +module load compilers +module load mpfr diff --git a/environment.yml b/environment.yml index a5b6415..6f31279 100644 --- a/environment.yml +++ b/environment.yml @@ -1,23 +1,33 @@ -name: pointmlp +name: pointmlp channels: - pytorch - nvidia - - conda-forge + - conda-forge dependencies: +#---# basic python + - pytorch + - tqdm + - numpy + - scipy + - scikit-learn +#---# file readers + - h5py + - pyyaml +#---# tooling (linting, typing...) + - ruff + - mypy + - black + - isort +#---# visu + - matplotlib +#---# pytorch - cudatoolkit - cycler - einops - - h5py - - matplotlib - - numpy - - pytorch - - pyyaml - - scikit-learn - - scipy - torchvision - - tqdm + - pip - pip: - pointnet2_ops_lib/. diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..a83150e --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,64 @@ +[tool.ruff] +line-length = 120 +ignore-init-module-imports = true +ignore = [ + "G004", # Logging statement uses f-string + "EM102", # Exception must not use an f-string literal, assign to variable first + "D100", # Missing docstring in public module + "D104", # Missing docstring in public package + "N812", # Lowercase imported as non lowercase +] +select = [ + "A", # flake8-builtins + "B", # flake8-bugbear + "C90", # mccabe + "COM", # flake8-commas + "D", # pydocstyle + "EM", # flake8-errmsg + "E", # pycodestyle errors + "F", # Pyflakes + "G", # flake8-logging-format + "I", # isort + "N", # pep8-naming + "PIE", # flake8-pie + "PTH", # flake8-use-pathlib + "TD", # flake8-todo + "FIX", # flake8-fixme + "RET", # flake8-return + "RUF", # ruff + "S", # flake8-bandit + "TCH", # flake8-type-checking + "TID", # flake8-tidy-imports + "UP", # pyupgrade + "W", # pycodestyle warnings +] + +[tool.ruff.pydocstyle] +convention = "google" + +[tool.ruff.isort] +known-first-party = ["pointnet2_ops"] + +[tool.ruff.per-file-ignores] +"__init__.py" = ["F401"] +"src/aube/main.py" = ["E402", "F401"] + +[tool.black] +exclude = ''' +/( + \.git + \.venv +)/ +''' +include = '\.pyi?$' +line-length = 120 +target-version = ["py310"] + +[tool.isort] +multi_line_output = 3 +profile = "black" + +[tool.mypy] +python_version = "3.10" +warn_return_any = true +warn_unused_configs = true