Skip to content

Commit 0a3d05a

Browse files
feat: add Windows venv wrappers support (#768)
Windows lacks built-in shell aliases like Unix's bashrc, so Safety uses .bat wrappers in a scripts directory prepended to PATH. However, when users activate a virtual environment, the venv's Scripts directory gets prepended to PATH, causing commands like 'pip' to bypass our Safety wrappers entirely. This implementation solves the issue by adding doskey aliases for CMD (via AutoRun registry) and PowerShell functions (via profile scripts), ensuring Safety's command interception works regardless of PATH order changes during venv activation.
1 parent bd1fade commit 0a3d05a

File tree

6 files changed

+886
-76
lines changed

6 files changed

+886
-76
lines changed

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ os_type = [
237237
dependencies = [
238238
"ruff",
239239
"pyright",
240+
"pytest==8.3.4",
240241
]
241242
[tool.hatch.envs.lint.scripts]
242243
typing = "pyright {args:.}"
@@ -266,6 +267,7 @@ reportMissingTypeStubs = false
266267
[tool.pytest.ini_options]
267268
addopts = "--strict-markers"
268269
markers = [
270+
"unit: mark test to run only on unit tests",
269271
"basic: requires no extras",
270272
"windows_only: mark test to run only on Windows platforms",
271273
"unix_only: mark test to run only on Unix platforms"

0 commit comments

Comments
 (0)