gwc-pybundle 2.1.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of gwc-pybundle might be problematic. Click here for more details.
- gwc_pybundle-2.1.2.dist-info/METADATA +903 -0
- gwc_pybundle-2.1.2.dist-info/RECORD +82 -0
- gwc_pybundle-2.1.2.dist-info/WHEEL +5 -0
- gwc_pybundle-2.1.2.dist-info/entry_points.txt +2 -0
- gwc_pybundle-2.1.2.dist-info/licenses/LICENSE.md +25 -0
- gwc_pybundle-2.1.2.dist-info/top_level.txt +1 -0
- pybundle/__init__.py +0 -0
- pybundle/__main__.py +4 -0
- pybundle/cli.py +546 -0
- pybundle/context.py +404 -0
- pybundle/doctor.py +148 -0
- pybundle/filters.py +228 -0
- pybundle/manifest.py +77 -0
- pybundle/packaging.py +45 -0
- pybundle/policy.py +132 -0
- pybundle/profiles.py +454 -0
- pybundle/roadmap_model.py +42 -0
- pybundle/roadmap_scan.py +328 -0
- pybundle/root_detect.py +14 -0
- pybundle/runner.py +180 -0
- pybundle/steps/__init__.py +26 -0
- pybundle/steps/ai_context.py +791 -0
- pybundle/steps/api_docs.py +219 -0
- pybundle/steps/asyncio_analysis.py +358 -0
- pybundle/steps/bandit.py +72 -0
- pybundle/steps/base.py +20 -0
- pybundle/steps/blocking_call_detection.py +291 -0
- pybundle/steps/call_graph.py +219 -0
- pybundle/steps/compileall.py +76 -0
- pybundle/steps/config_docs.py +319 -0
- pybundle/steps/config_validation.py +302 -0
- pybundle/steps/container_image.py +294 -0
- pybundle/steps/context_expand.py +272 -0
- pybundle/steps/copy_pack.py +293 -0
- pybundle/steps/coverage.py +101 -0
- pybundle/steps/cprofile_step.py +166 -0
- pybundle/steps/dependency_sizes.py +136 -0
- pybundle/steps/django_checks.py +214 -0
- pybundle/steps/dockerfile_lint.py +282 -0
- pybundle/steps/dockerignore.py +311 -0
- pybundle/steps/duplication.py +103 -0
- pybundle/steps/env_completeness.py +269 -0
- pybundle/steps/env_var_usage.py +253 -0
- pybundle/steps/error_refs.py +204 -0
- pybundle/steps/event_loop_patterns.py +280 -0
- pybundle/steps/exception_patterns.py +190 -0
- pybundle/steps/fastapi_integration.py +250 -0
- pybundle/steps/flask_debugging.py +312 -0
- pybundle/steps/git_analytics.py +315 -0
- pybundle/steps/handoff_md.py +176 -0
- pybundle/steps/import_time.py +175 -0
- pybundle/steps/interrogate.py +106 -0
- pybundle/steps/license_scan.py +96 -0
- pybundle/steps/line_profiler.py +117 -0
- pybundle/steps/link_validation.py +287 -0
- pybundle/steps/logging_analysis.py +233 -0
- pybundle/steps/memory_profile.py +176 -0
- pybundle/steps/migration_history.py +336 -0
- pybundle/steps/mutation_testing.py +141 -0
- pybundle/steps/mypy.py +103 -0
- pybundle/steps/orm_optimization.py +316 -0
- pybundle/steps/pip_audit.py +45 -0
- pybundle/steps/pipdeptree.py +62 -0
- pybundle/steps/pylance.py +562 -0
- pybundle/steps/pytest.py +66 -0
- pybundle/steps/query_pattern_analysis.py +334 -0
- pybundle/steps/radon.py +161 -0
- pybundle/steps/repro_md.py +161 -0
- pybundle/steps/rg_scans.py +78 -0
- pybundle/steps/roadmap.py +153 -0
- pybundle/steps/ruff.py +117 -0
- pybundle/steps/secrets_detection.py +235 -0
- pybundle/steps/security_headers.py +309 -0
- pybundle/steps/shell.py +74 -0
- pybundle/steps/slow_tests.py +178 -0
- pybundle/steps/sqlalchemy_validation.py +269 -0
- pybundle/steps/test_flakiness.py +184 -0
- pybundle/steps/tree.py +116 -0
- pybundle/steps/type_coverage.py +277 -0
- pybundle/steps/unused_deps.py +211 -0
- pybundle/steps/vulture.py +167 -0
- pybundle/tools.py +63 -0
pybundle/tools.py
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import shutil
|
|
4
|
+
import os
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def get_trusted_path_prefixes() -> list[str]:
|
|
8
|
+
"""Return list of trusted directory prefixes for tool validation.
|
|
9
|
+
|
|
10
|
+
These are common system directories where legitimate tools are installed.
|
|
11
|
+
Can be extended via environment variable PYBUNDLE_TRUSTED_PATHS (colon-separated).
|
|
12
|
+
"""
|
|
13
|
+
default_prefixes = [
|
|
14
|
+
"/usr/bin/",
|
|
15
|
+
"/usr/local/bin/",
|
|
16
|
+
"/bin/",
|
|
17
|
+
"/opt/homebrew/bin/", # macOS Homebrew (Apple Silicon)
|
|
18
|
+
"/opt/homebrew/opt/", # Homebrew linked tools
|
|
19
|
+
"/home/linuxbrew/.linuxbrew/bin/", # Linux Homebrew
|
|
20
|
+
"/snap/bin/", # Ubuntu snaps
|
|
21
|
+
"/usr/sbin/",
|
|
22
|
+
"/sbin/",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
# Allow user-specified trusted paths via environment
|
|
26
|
+
extra_paths = os.environ.get("PYBUNDLE_TRUSTED_PATHS", "")
|
|
27
|
+
if extra_paths:
|
|
28
|
+
default_prefixes.extend(p.strip() for p in extra_paths.split(":") if p.strip())
|
|
29
|
+
|
|
30
|
+
return default_prefixes
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def is_path_trusted(tool_path: str | None) -> bool:
|
|
34
|
+
"""Check if a tool path is in a trusted directory."""
|
|
35
|
+
if not tool_path:
|
|
36
|
+
return False
|
|
37
|
+
|
|
38
|
+
# Virtual environment paths are implicitly trusted
|
|
39
|
+
# (they're part of the project context)
|
|
40
|
+
if ".venv" in tool_path or "venv" in tool_path or ".pybundle-venv" in tool_path:
|
|
41
|
+
return True
|
|
42
|
+
|
|
43
|
+
trusted_prefixes = get_trusted_path_prefixes()
|
|
44
|
+
return any(tool_path.startswith(prefix) for prefix in trusted_prefixes)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def which(cmd: str, strict: bool = False) -> str | None:
|
|
48
|
+
"""Resolve tool path with optional strict mode validation.
|
|
49
|
+
|
|
50
|
+
Args:
|
|
51
|
+
cmd: Command name to resolve
|
|
52
|
+
strict: If True, only return paths in trusted directories
|
|
53
|
+
|
|
54
|
+
Returns:
|
|
55
|
+
Full path to command, or None if not found (or not trusted in strict mode)
|
|
56
|
+
"""
|
|
57
|
+
path = shutil.which(cmd)
|
|
58
|
+
|
|
59
|
+
if strict and path:
|
|
60
|
+
if not is_path_trusted(path):
|
|
61
|
+
return None
|
|
62
|
+
|
|
63
|
+
return path
|