From 0d5edff4c671844a664e4c5669effcaadd4123dc Mon Sep 17 00:00:00 2001 From: Avasam Date: Fri, 21 Jul 2023 13:56:04 -0400 Subject: [PATCH] Promote usage of .venv --- .gitignore | 1 + .vscode/settings.json | 1 + .vscode/tasks.json | 4 ++-- docs/build instructions.md | 8 ++++++++ pyproject.toml | 4 +++- 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 40e3ff25..0a6ae97f 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ __pycache__/ # Distribution / packaging +.venv/ env/ build/ dist/ diff --git a/.vscode/settings.json b/.vscode/settings.json index 04318f23..ba2b269f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -74,6 +74,7 @@ // https://github.com/microsoft/vscode-mypy/issues/37#issuecomment-1602702174 "--config-file=mypy.ini", ], + "python.terminal.activateEnvironment": true, // Important to follow the config in pyrightconfig.json "python.analysis.useLibraryCodeForTypes": false, "python.analysis.diagnosticMode": "workspace", diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 39a29147..65ac2dc5 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -17,12 +17,12 @@ { "label": "Compile resources", "type": "shell", - "command": "scripts/compile_resources.ps1" + "command": ".venv/Scripts/Activate.ps1; scripts/compile_resources.ps1" }, { "label": "Build AutoSplit", "type": "shell", - "command": "scripts/build.ps1", + "command": ".venv/Scripts/Activate.ps1; scripts/build.ps1", "group": { "kind": "build", "isDefault": true diff --git a/docs/build instructions.md b/docs/build instructions.md index dc85df98..49bc2004 100644 --- a/docs/build instructions.md +++ b/docs/build instructions.md @@ -11,12 +11,20 @@ - [Python](https://www.python.org/downloads/) 3.9+. - [Node](https://nodejs.org) is optional, but required for complete linting. - Alternatively you can install the [pyright python wrapper](https://pypi.org/project/pyright/) which has a bit of an overhead delay. +- [PowerShell](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell) - [VSCode](https://code.visualstudio.com/Download) is not required, but highly recommended. - Everything already configured in the workspace, including Run (F5) and Build (Ctrl+Shift+B) commands, default shell, and recommended extensions. - [PyCharm](https://www.jetbrains.com/pycharm/) is also a good Python IDE, but nothing is configured. If you are a PyCharm user, feel free to open a PR with all necessary workspace configurations! ## Install and Build steps +- Create and activate a virtual environment: + - Windows / PowerShell: + - `python -m venv .venv` + - `& ./.venv/Scripts/Activate.ps1` + - Unix / Bash: + - `python3 -m venv .venv` + - `source .venv/bin/activate` - Run `./scripts/install.ps1` to install all dependencies. - If you're having issues with the PySide generated code, you might want to first run `pip uninstall -y shiboken6 PySide PySide-Essentials` - Run the app directly with `./scripts/start.ps1 [--auto-controlled]`. diff --git a/pyproject.toml b/pyproject.toml index f1ca3b33..42d13f08 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -122,7 +122,7 @@ max-branches = 15 [tool.autopep8] max_line_length = 120 aggressive = 3 -exclude = "src/gen/*" +exclude = [".venv/*", "src/gen/*"] ignore = [ "E124", # Closing bracket may not match multi-line method invocation style (enforced by add-trailing-comma) "E70", # Allow ... on same line as def @@ -150,7 +150,9 @@ reportUninitializedInstanceVariable = "error" reportUnnecessaryTypeIgnoreComment = "error" # Exclude from scanning when running pyright exclude = [ + ".venv/", # Auto generated, fails some strict pyright checks + "build/", "src/gen/", ] # Ignore must be specified for Pylance to stop displaying errors