pyddock 0.3.6__tar.gz → 0.3.7__tar.gz

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.
Files changed (103) hide show
  1. pyddock-0.3.7/.hypothesis/constants/0527dc28646c9360 +4 -0
  2. pyddock-0.3.7/.hypothesis/constants/30ee1be194c33a1d +4 -0
  3. pyddock-0.3.7/.hypothesis/constants/453881856851f311 +4 -0
  4. pyddock-0.3.7/.hypothesis/constants/5f020be48d90847d +4 -0
  5. pyddock-0.3.7/.hypothesis/constants/6627988645b1286c +4 -0
  6. pyddock-0.3.7/.hypothesis/constants/671fefe2f5d9935c +4 -0
  7. pyddock-0.3.7/.hypothesis/constants/805cbcbb07e3332d +4 -0
  8. pyddock-0.3.7/.hypothesis/constants/93108f7a5abfd484 +4 -0
  9. pyddock-0.3.7/.hypothesis/constants/d115f833e13f93f9 +4 -0
  10. pyddock-0.3.7/.hypothesis/constants/df249c25d70870dc +4 -0
  11. pyddock-0.3.7/.hypothesis/constants/e2c54b7949469c07 +4 -0
  12. pyddock-0.3.7/.hypothesis/constants/e78de40070f52f91 +4 -0
  13. pyddock-0.3.7/.hypothesis/constants/e8cd7befaa4dd723 +4 -0
  14. pyddock-0.3.7/.hypothesis/unicode_data/16.0.0/charmap.json.gz +0 -0
  15. pyddock-0.3.7/.hypothesis/unicode_data/16.0.0/codec-utf-8.json.gz +0 -0
  16. {pyddock-0.3.6 → pyddock-0.3.7}/PKG-INFO +3 -5
  17. {pyddock-0.3.6 → pyddock-0.3.7}/pyproject.toml +3 -5
  18. {pyddock-0.3.6 → pyddock-0.3.7}/src/pyddock/config.py +32 -34
  19. {pyddock-0.3.6 → pyddock-0.3.7}/src/pyddock/default_config.toml +1 -1
  20. {pyddock-0.3.6 → pyddock-0.3.7}/src/pyddock/executor.py +1 -0
  21. {pyddock-0.3.6 → pyddock-0.3.7}/src/pyddock/shell_executor.py +1 -0
  22. {pyddock-0.3.6 → pyddock-0.3.7}/src/pyddock/venv_manager.py +129 -3
  23. {pyddock-0.3.6 → pyddock-0.3.7}/tests/test_config.py +95 -0
  24. {pyddock-0.3.6 → pyddock-0.3.7}/tests/test_jailbreak_regression.py +1 -0
  25. {pyddock-0.3.6 → pyddock-0.3.7}/tests/test_shell_arg_paths.py +4 -0
  26. {pyddock-0.3.6 → pyddock-0.3.7}/tests/test_shell_executor.py +3 -1
  27. {pyddock-0.3.6 → pyddock-0.3.7}/tests/test_subst_trusted_path.py +2 -0
  28. pyddock-0.3.7/tests/test_venv_recreation.py +278 -0
  29. {pyddock-0.3.6 → pyddock-0.3.7}/uv.lock +582 -769
  30. {pyddock-0.3.6 → pyddock-0.3.7}/.gitignore +0 -0
  31. {pyddock-0.3.6 → pyddock-0.3.7}/.hypothesis/.gitignore +0 -0
  32. {pyddock-0.3.6 → pyddock-0.3.7}/.hypothesis/constants/106d94c8123c0256 +0 -0
  33. {pyddock-0.3.6 → pyddock-0.3.7}/.hypothesis/constants/1685e03b3aa38c02 +0 -0
  34. {pyddock-0.3.6 → pyddock-0.3.7}/.hypothesis/constants/1deca112ec6f2f3c +0 -0
  35. {pyddock-0.3.6 → pyddock-0.3.7}/.hypothesis/constants/2488a3a95c48acfb +0 -0
  36. {pyddock-0.3.6 → pyddock-0.3.7}/.hypothesis/constants/2a94d83a13979745 +0 -0
  37. {pyddock-0.3.6 → pyddock-0.3.7}/.hypothesis/constants/499f1d5a639a382a +0 -0
  38. {pyddock-0.3.6 → pyddock-0.3.7}/.hypothesis/constants/4ee6f24fa151b65d +0 -0
  39. {pyddock-0.3.6 → pyddock-0.3.7}/.hypothesis/constants/5b1b2189b70f5ef2 +0 -0
  40. {pyddock-0.3.6 → pyddock-0.3.7}/.hypothesis/constants/5d6f8b26b2137fe1 +0 -0
  41. {pyddock-0.3.6 → pyddock-0.3.7}/.hypothesis/constants/61f9b905d7da14e0 +0 -0
  42. {pyddock-0.3.6 → pyddock-0.3.7}/.hypothesis/constants/67a7f4ab2d372f23 +0 -0
  43. {pyddock-0.3.6 → pyddock-0.3.7}/.hypothesis/constants/6c6f5083ece3f86b +0 -0
  44. {pyddock-0.3.6 → pyddock-0.3.7}/.hypothesis/constants/827e18b40f235443 +0 -0
  45. {pyddock-0.3.6 → pyddock-0.3.7}/.hypothesis/constants/8401e4039d635fbc +0 -0
  46. {pyddock-0.3.6 → pyddock-0.3.7}/.hypothesis/constants/8490e7baefc8c8c3 +0 -0
  47. {pyddock-0.3.6 → pyddock-0.3.7}/.hypothesis/constants/a7c132b836381d0d +0 -0
  48. {pyddock-0.3.6 → pyddock-0.3.7}/.hypothesis/constants/b395547bc71e5c52 +0 -0
  49. {pyddock-0.3.6 → pyddock-0.3.7}/.hypothesis/constants/ca50661510a40488 +0 -0
  50. {pyddock-0.3.6 → pyddock-0.3.7}/.hypothesis/tmp/tmpl8oe65gb +0 -0
  51. {pyddock-0.3.6 → pyddock-0.3.7}/.hypothesis/tmp/tmpqwper0dp +0 -0
  52. {pyddock-0.3.6 → pyddock-0.3.7}/.hypothesis/unicode_data/15.1.0/charmap.json.gz +0 -0
  53. {pyddock-0.3.6 → pyddock-0.3.7}/.hypothesis/unicode_data/15.1.0/codec-utf-8.json.gz +0 -0
  54. {pyddock-0.3.6 → pyddock-0.3.7}/LICENSE +0 -0
  55. {pyddock-0.3.6 → pyddock-0.3.7}/README.md +0 -0
  56. {pyddock-0.3.6 → pyddock-0.3.7}/publish-to-pypi.ps1 +0 -0
  57. {pyddock-0.3.6 → pyddock-0.3.7}/src/pyddock/__init__.py +0 -0
  58. {pyddock-0.3.6 → pyddock-0.3.7}/src/pyddock/_audit_enforcement.py +0 -0
  59. {pyddock-0.3.6 → pyddock-0.3.7}/src/pyddock/_base.py +0 -0
  60. {pyddock-0.3.6 → pyddock-0.3.7}/src/pyddock/_enforcement.py +0 -0
  61. {pyddock-0.3.6 → pyddock-0.3.7}/src/pyddock/_fs_enforcement.py +0 -0
  62. {pyddock-0.3.6 → pyddock-0.3.7}/src/pyddock/_import_hook.py +0 -0
  63. {pyddock-0.3.6 → pyddock-0.3.7}/src/pyddock/_prewarm.py +0 -0
  64. {pyddock-0.3.6 → pyddock-0.3.7}/src/pyddock/_process_utils.py +0 -0
  65. {pyddock-0.3.6 → pyddock-0.3.7}/src/pyddock/_proxies.py +0 -0
  66. {pyddock-0.3.6 → pyddock-0.3.7}/src/pyddock/_runtime.py +0 -0
  67. {pyddock-0.3.6 → pyddock-0.3.7}/src/pyddock/_subprocess_patch.py +0 -0
  68. {pyddock-0.3.6 → pyddock-0.3.7}/src/pyddock/ast_validator.py +0 -0
  69. {pyddock-0.3.6 → pyddock-0.3.7}/src/pyddock/cli.py +0 -0
  70. {pyddock-0.3.6 → pyddock-0.3.7}/src/pyddock/script_registry.py +0 -0
  71. {pyddock-0.3.6 → pyddock-0.3.7}/src/pyddock/server.py +0 -0
  72. {pyddock-0.3.6 → pyddock-0.3.7}/src/pyddock/tools/__init__.py +0 -0
  73. {pyddock-0.3.6 → pyddock-0.3.7}/src/pyddock/tools/fs_append.py +0 -0
  74. {pyddock-0.3.6 → pyddock-0.3.7}/src/pyddock/tools/fs_delete.py +0 -0
  75. {pyddock-0.3.6 → pyddock-0.3.7}/src/pyddock/tools/fs_find.py +0 -0
  76. {pyddock-0.3.6 → pyddock-0.3.7}/src/pyddock/tools/fs_grep.py +0 -0
  77. {pyddock-0.3.6 → pyddock-0.3.7}/src/pyddock/tools/read_file.py +0 -0
  78. {pyddock-0.3.6 → pyddock-0.3.7}/src/pyddock/tools/stat_file.py +0 -0
  79. {pyddock-0.3.6 → pyddock-0.3.7}/src/pyddock/tools/str_replace.py +0 -0
  80. {pyddock-0.3.6 → pyddock-0.3.7}/tests/__init__.py +0 -0
  81. {pyddock-0.3.6 → pyddock-0.3.7}/tests/_config_helpers.py +0 -0
  82. {pyddock-0.3.6 → pyddock-0.3.7}/tests/test_ast_properties.py +0 -0
  83. {pyddock-0.3.6 → pyddock-0.3.7}/tests/test_attr_reflection_hardening.py +0 -0
  84. {pyddock-0.3.6 → pyddock-0.3.7}/tests/test_audit_hook_backstop.py +0 -0
  85. {pyddock-0.3.6 → pyddock-0.3.7}/tests/test_chmod_integration.py +0 -0
  86. {pyddock-0.3.6 → pyddock-0.3.7}/tests/test_deny_always_wins.py +0 -0
  87. {pyddock-0.3.6 → pyddock-0.3.7}/tests/test_deny_messages.py +0 -0
  88. {pyddock-0.3.6 → pyddock-0.3.7}/tests/test_env_policy.py +0 -0
  89. {pyddock-0.3.6 → pyddock-0.3.7}/tests/test_executor.py +0 -0
  90. {pyddock-0.3.6 → pyddock-0.3.7}/tests/test_file_tools.py +0 -0
  91. {pyddock-0.3.6 → pyddock-0.3.7}/tests/test_filesystem_guards.py +0 -0
  92. {pyddock-0.3.6 → pyddock-0.3.7}/tests/test_proxy_properties.py +0 -0
  93. {pyddock-0.3.6 → pyddock-0.3.7}/tests/test_realistic.py +0 -0
  94. {pyddock-0.3.6 → pyddock-0.3.7}/tests/test_runtime.py +0 -0
  95. {pyddock-0.3.6 → pyddock-0.3.7}/tests/test_sandbox_escape_hardening.py +0 -0
  96. {pyddock-0.3.6 → pyddock-0.3.7}/tests/test_security_guards.py +0 -0
  97. {pyddock-0.3.6 → pyddock-0.3.7}/tests/test_server.py +0 -0
  98. {pyddock-0.3.6 → pyddock-0.3.7}/tests/test_shell_properties.py +0 -0
  99. {pyddock-0.3.6 → pyddock-0.3.7}/tests/test_subprocess_enforcement.py +0 -0
  100. {pyddock-0.3.6 → pyddock-0.3.7}/tests/test_subprocess_properties.py +0 -0
  101. {pyddock-0.3.6 → pyddock-0.3.7}/tests/test_trusted_prefixes_uv_cache.py +0 -0
  102. {pyddock-0.3.6 → pyddock-0.3.7}/tests/test_venv_stamp.py +0 -0
  103. {pyddock-0.3.6 → pyddock-0.3.7}/tests/test_workspace_imports.py +0 -0
@@ -0,0 +1,4 @@
1
+ # file: C:\Dev\github\pyddock\src\pyddock\ast_validator.py
2
+ # hypothesis_version: 6.152.7
3
+
4
+ [', ', '.', '__getattr__', '__getattribute__', 'blocked_attribute', 'blocked_call', 'blocked_import', 'blocked_reflection', 'blocked_subscript', 'getattr', 'syntax_error']
@@ -0,0 +1,4 @@
1
+ # file: C:\Dev\github\pyddock\src\pyddock\config.py
2
+ # hypothesis_version: 6.152.7
3
+
4
+ [30.0, 3600.0, ', ', '.', '.pyddock', '/', '[env]', '\\', 'agent-deny', 'allow', 'arg_paths', 'ast', 'audit', 'block_attributes', 'block_calls', 'class_allow', 'class_deny', 'command', 'default', 'default_config.toml', 'deny', 'deny-agent', 'deny-all', 'deny_messages', 'env', 'execution', 'filesystem', 'fs', 'fs-write', 'fs-write-pair', 'guards', 'imports', 'inert', 'max_timeout', 'mode', 'module_allow', 'module_deny', 'network', 'none', 'observe', 'protected', 'pyddock', 'pyddock.toml', 'read-only', 'readable_paths', 'restrictions', 'shell', 'snapshot', 'timeout', 'utf-8', 'workspace', 'writable_paths']
@@ -0,0 +1,4 @@
1
+ # file: C:\Dev\github\pyddock\src\pyddock\_audit_enforcement.py
2
+ # hypothesis_version: 6.152.7
3
+
4
+ [200, 300, 384, ' | ', '"', '*', '/', '<frozen', '<frozen importlib', '<unsummarizable>', 'AGENT', 'IMPORT', 'OTHER', 'O_APPEND', 'O_CREAT', 'O_RDWR', 'O_TRUNC', 'O_WRONLY', 'TRUSTED', '\\', 'agent-deny', 'allow', 'arg_paths', 'caller', 'command', 'decision', 'deny', 'detail', 'errors', 'event', 'fs', 'fs-write', 'fs-write-pair', 'fspath', 'import-exempt', 'mode', 'network', 'observe', 'open', 'os.system', 'pid', 'reentry', 'replace', 'shell', 'socket.', 'subprocess.Popen', 'surrogateescape', 't', 'utf-8', 'workspace']
@@ -0,0 +1,4 @@
1
+ # file: C:\Dev\github\pyddock\src\pyddock\server.py
2
+ # hypothesis_version: 6.152.7
3
+
4
+ [', ', '--debug', '--workspace', '.py', '.pyddock', 'Configured commands:', 'Restrictions:', '_', '__main__', 'allow', 'content', 'context_lines', 'deny', 'end', 'end_line', 'exclude_regex', 'file_glob', 'file_regex', 'fs_append', 'fs_delete', 'fs_find', 'fs_grep', 'fs_readfile', 'fs_stat', 'fs_str_replace', 'grep_regex', 'max_results', 'max_results_per_file', 'newStr', 'oldStr', 'path', 'pyddock', 'pyddock serve', 'read_file', 'run_python', 'run_shell', 'start', 'start_line', 'stat_file', 'stdio', 'store_true', 'str_replace', 'tmp', 'utf-8', 'venv']
@@ -0,0 +1,4 @@
1
+ # file: C:\Dev\github\pyddock\src\pyddock\shell_executor.py
2
+ # hypothesis_version: 6.152.7
3
+
4
+ ['$', ', ', '-', '-ExecutionPolicy', '-File', '-NoProfile', '.', '.bat', '.ps1', '.py', '.pyddock', '.sh', '.~', '/', '//', '/c', ':', '=', 'Bypass', '\\', '\\.', '\\/', '\\\\', '^', 'bash', 'cmd', 'command', 'default', 'deny', 'deny pattern', 'env', 'inert', 'items', 'no argument patterns', 'none', 'nt', 'output', 'powershell', 'pwsh', 'python', 'replace', 'snapshot', 'stderr', 'surrogateescape', 'tmp', 'utf-8', 'workspace']
@@ -0,0 +1,4 @@
1
+ # file: C:\Dev\github\pyddock\src\pyddock\_enforcement.py
2
+ # hypothesis_version: 6.152.7
3
+
4
+ ['*', ', ', '.', '.pyddock', '<frozen', 'PathLike', '_', '__doc__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '_current_frames', '_getframe', '_pyddock_format_tb', 'allow', 'allowed', 'altsep', 'argv', 'ast', 'attrgetter', 'block_attributes', 'byteorder', 'class_allow', 'class_deny', 'cpu_count', 'curdir', 'deny', 'deny_messages', 'devnull', 'exc_info', 'exec_prefix', 'executable', 'exit', 'extsep', 'float_info', 'fromlist', 'fspath', 'fstat', 'getattr', 'getcwd', 'getdefaultencoding', 'getenv', 'getlogin', 'getpid', 'getrecursionlimit', 'hash_info', 'import', 'imports', 'int_info', 'level', 'linesep', 'listdir', 'lstat', 'maxsize', 'message', 'meta_path', 'mode', 'module_allow', 'module_deny', 'name', 'os', 'os.path', 'pardir', 'path', 'path_hooks', 'path_importer_cache', 'pathsep', 'pattern', 'platform', 'prefix', 'restrictions', 'scandir', 'sep', 'stat', 'stderr', 'stdin', 'stdout', 'sys', 'threading', 'urandom', 'venv', 'version', 'version_info', 'walk', 'workspace']
@@ -0,0 +1,4 @@
1
+ # file: C:\Dev\github\pyddock\src\pyddock\_subprocess_patch.py
2
+ # hypothesis_version: 6.152.7
3
+
4
+ ['$', '(none configured)', ', ', 'Popen', '^', '_SafePopen', 'allow', 'arg_paths', 'command', 'cwd', 'deny', 'deny pattern', 'env', 'imports', 'mode', 'no argument patterns', 'os', 'shell', 'subprocess', 'subprocess.Popen', 'subprocess.run', 'surrogateescape', 'utf-8', 'workspace']
@@ -0,0 +1,4 @@
1
+ # file: C:\Dev\github\pyddock\src\pyddock\_proxies.py
2
+ # hypothesis_version: 6.152.7
3
+
4
+ [', ', '.', 'Lib', '_', '__', '__all__', '__dict__', '__doc__', '__file__', '__getattr__', '__getattribute__', '__loader__', '__module__', '__name__', '__package__', '__path__', '__reduce__', '__reduce_ex__', '__spec__', '_initializing', 'builtins', 'lib', 'os', 'site-packages', 'venv site-packages', 'venv symlink target']
@@ -0,0 +1,4 @@
1
+ # file: C:\Dev\github\pyddock\src\pyddock\executor.py
2
+ # hypothesis_version: 6.152.7
3
+
4
+ ['#', '.py', '__PYDDOCK_RESULT__', '_last_expr = None', '_pyddock_bootstrap_', 'allow', 'allowed', 'arg_paths', 'ast', 'audit', 'block_attributes', 'block_calls', 'class_allow', 'class_deny', 'command', 'default', 'deny', 'deny_messages', 'disposition', 'env', 'exec(_code, _ns)', 'execution', 'filesystem', 'guards', 'import ast as _ast', 'import sys', 'imports', 'message', 'mode', 'module_allow', 'module_deny', 'nt', 'output', 'pattern', 'readable_paths', 'replace', 'restrictions', 'shell', 'stderr', 'timeout', 'utf-8', 'w', 'workspace', 'writable_paths']
@@ -0,0 +1,4 @@
1
+ # file: C:\Dev\github\pyddock\src\pyddock\_process_utils.py
2
+ # hypothesis_version: 6.152.7
3
+
4
+ [65536, '/F', '/PID', '/T', ';', 'C:\\Windows', 'Environment', 'PATH', 'PYTHONIOENCODING', 'PYTHONPATH', 'Path', 'SYSTEMROOT', 'SystemRoot', 'VIRTUAL_ENV', 'VIRTUAL_ENV_PROMPT', 'absent', 'nt', 'output', 'present', 'replace', 'stderr', 'taskkill', 'utf-8', 'windir']
@@ -0,0 +1,4 @@
1
+ # file: C:\Dev\github\pyddock\src\pyddock\_fs_enforcement.py
2
+ # hypothesis_version: 6.152.7
3
+
4
+ [511, 3584, '$', '*', ', ', '.', '.pyddock', '/', '<frozen', 'Lib', 'Path.chmod', 'Path.chmod()', 'Path.lchmod', 'Path.lchmod()', 'Path.mkdir', 'Path.open', 'Path.read_bytes', 'Path.read_text', 'Path.rename', 'Path.replace', 'Path.rmdir', 'Path.touch', 'Path.unlink', 'Path.write_bytes', 'Path.write_text', '\\', '\\.', '\\/', '\\\\', '^', '_io.FileIO', '_io.open', 'a', 'a+', 'a+b', 'a+t', 'ab', 'ab+', 'allow', 'at', 'at+', 'audit', 'audit.jsonl', 'builtins.open', 'command', 'deny', 'deny-agent', 'deny-all', 'disposition', 'env', 'filesystem', 'guards', 'imports', 'io.FileIO', 'io.open', 'lchmod', 'lib', 'link_to', 'mkdtemp', 'mkstemp', 'nt', 'nul', 'nul.', 'os', 'os.chmod()', 'pattern', 'r', 'r+', 'r+b', 'r+t', 'rb+', 'read', 'read-only', 'readable_paths', 'rt+', 'shell', 'tempdir', 'tempfile', 'tmp', 'w', 'w+', 'w+b', 'w+t', 'wax+', 'wb', 'wb+', 'workspace', 'writable_paths', 'write', 'wt', 'wt+', 'x', 'x+', 'x+b', 'x+t', 'xb', 'xb+', 'xt', 'xt+']
@@ -0,0 +1,4 @@
1
+ # file: C:\Dev\github\pyddock\src\pyddock\venv_manager.py
2
+ # hypothesis_version: 6.152.7
3
+
4
+ [300, '-c', '-e', '-m', '.pyddock', 'Scripts', '_is_gil_enabled', '_workspace_hashes', 'allowlist_hash', 'bin', 'freethreaded', 'gil', 'install', 'installed.json', 'interpreter_id', 'pip', 'pyproject.toml', 'python', 'python.exe', 'pyvenv.cfg', 'setup.cfg', 'setup.py', 'utf-8', 'venv', 'venv_created', 'win32', 'workspace', '||']
@@ -0,0 +1,4 @@
1
+ # file: C:\Dev\github\pyddock\src\pyddock\_base.py
2
+ # hypothesis_version: 6.152.7
3
+
4
+ ['/', ':', '<snippet>', '\\', '__doc__', '__module__', '__name__', '__self__', 'nt', 'wrapped']
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyddock
3
- Version: 0.3.6
3
+ Version: 0.3.7
4
4
  Summary: MCP server that gives AI agents pre-approved Python, shell, and file I/O tools with declarative policy controls
5
5
  Project-URL: Homepage, https://github.com/portablestew/pyddock
6
6
  Project-URL: Repository, https://github.com/portablestew/pyddock
@@ -13,12 +13,10 @@ Classifier: Development Status :: 3 - Alpha
13
13
  Classifier: Intended Audience :: Developers
14
14
  Classifier: License :: OSI Approved :: MIT License
15
15
  Classifier: Programming Language :: Python :: 3
16
- Classifier: Programming Language :: Python :: 3.11
17
- Classifier: Programming Language :: Python :: 3.12
18
- Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
19
17
  Classifier: Topic :: Security
20
18
  Classifier: Topic :: Software Development :: Libraries
21
- Requires-Python: >=3.11
19
+ Requires-Python: >=3.14
22
20
  Requires-Dist: mcp>=1.0
23
21
  Description-Content-Type: text/markdown
24
22
 
@@ -1,8 +1,8 @@
1
1
  [project]
2
2
  name = "pyddock"
3
- version = "0.3.6"
3
+ version = "0.3.7"
4
4
  description = "MCP server that gives AI agents pre-approved Python, shell, and file I/O tools with declarative policy controls"
5
- requires-python = ">=3.11"
5
+ requires-python = ">=3.14"
6
6
  license = "MIT"
7
7
  readme = "README.md"
8
8
  authors = [
@@ -14,9 +14,7 @@ classifiers = [
14
14
  "Intended Audience :: Developers",
15
15
  "License :: OSI Approved :: MIT License",
16
16
  "Programming Language :: Python :: 3",
17
- "Programming Language :: Python :: 3.11",
18
- "Programming Language :: Python :: 3.12",
19
- "Programming Language :: Python :: 3.13",
17
+ "Programming Language :: Python :: 3.14",
20
18
  "Topic :: Software Development :: Libraries",
21
19
  "Topic :: Security",
22
20
  ]
@@ -2,7 +2,8 @@
2
2
 
3
3
  Resolution order:
4
4
  1. Base config: .pyddock/pyddock.toml in the workspace (CWD), or default_config.toml bundled with the package
5
- 2. Overlay (optional): .pyddock/pyddock.override.toml — deep-merged on top of the base
5
+ 2. Global overlay (optional): ~/.pyddock/pyddock.override.toml — deep-merged on top of the base
6
+ 3. Workspace overlay (optional): .pyddock/pyddock.override.toml — deep-merged on top (wins last)
6
7
  """
7
8
 
8
9
  from __future__ import annotations
@@ -492,6 +493,18 @@ def _parse_audit(data: dict) -> AuditConfig:
492
493
  return AuditConfig(rules=rules)
493
494
 
494
495
 
496
+ def _load_toml(path: Path) -> dict:
497
+ """Read and parse a TOML file, raising ConfigError on failure."""
498
+ try:
499
+ raw_bytes = path.read_bytes()
500
+ except OSError as e:
501
+ raise ConfigError(f"Cannot read config file {path}: {e}") from e
502
+ try:
503
+ return tomllib.loads(raw_bytes.decode("utf-8"))
504
+ except tomllib.TOMLDecodeError as e:
505
+ raise ConfigError(f"Invalid TOML in {path}: {e}") from e
506
+
507
+
495
508
  def _deep_merge(base: dict, overlay: dict) -> dict:
496
509
  """Recursively merge *overlay* on top of *base* (neither is mutated).
497
510
 
@@ -596,8 +609,11 @@ def load_config(workspace: Path | None = None) -> PyddockConfig:
596
609
  """Load and parse the pyddock configuration.
597
610
 
598
611
  Resolves the base config (workspace pyddock.toml or bundled default), then
599
- checks for an optional overlay file (.pyddock/pyddock.override.toml). If the
600
- overlay exists it is deep-merged on top of the base before parsing.
612
+ applies optional overlay files in order:
613
+ 1. ~/.pyddock/pyddock.override.toml (global user override)
614
+ 2. .pyddock/pyddock.override.toml (workspace override, wins last)
615
+
616
+ Each overlay is deep-merged on top of the accumulated config before parsing.
601
617
 
602
618
  Args:
603
619
  workspace: The workspace root directory. Defaults to CWD.
@@ -612,42 +628,24 @@ def load_config(workspace: Path | None = None) -> PyddockConfig:
612
628
  workspace = Path.cwd()
613
629
 
614
630
  config_path = resolve_config_path(workspace)
615
-
616
- try:
617
- raw_bytes = config_path.read_bytes()
618
- except OSError as e:
619
- raise ConfigError(f"Cannot read config file {config_path}: {e}") from e
620
-
621
- try:
622
- data = tomllib.loads(raw_bytes.decode("utf-8"))
623
- except tomllib.TOMLDecodeError as e:
624
- raise ConfigError(
625
- f"Invalid TOML in {config_path}: {e}"
626
- ) from e
627
-
631
+ data = _load_toml(config_path)
628
632
  logger.debug("Loaded base config from %s", config_path)
629
633
 
630
- # Check for optional overlay
634
+ # Global user override
635
+ global_override = Path.home() / ".pyddock" / "pyddock.override.toml"
636
+ if global_override.is_file():
637
+ data = _deep_merge(data, _load_toml(global_override))
638
+ logger.debug("Applied global override from %s", global_override)
639
+ else:
640
+ logger.debug("No global override found (checked %s)", global_override)
641
+
642
+ # Workspace override (wins last)
631
643
  override_path = workspace / ".pyddock" / "pyddock.override.toml"
632
644
  if override_path.is_file():
633
- try:
634
- override_bytes = override_path.read_bytes()
635
- except OSError as e:
636
- raise ConfigError(
637
- f"Cannot read override config file {override_path}: {e}"
638
- ) from e
639
-
640
- try:
641
- override_data = tomllib.loads(override_bytes.decode("utf-8"))
642
- except tomllib.TOMLDecodeError as e:
643
- raise ConfigError(
644
- f"Invalid TOML in {override_path}: {e}"
645
- ) from e
646
-
647
- data = _deep_merge(data, override_data)
648
- logger.debug("Applied overlay from %s", override_path)
645
+ data = _deep_merge(data, _load_toml(override_path))
646
+ logger.debug("Applied workspace override from %s", override_path)
649
647
  else:
650
- logger.debug("No overlay found (checked %s)", override_path)
648
+ logger.debug("No workspace override found (checked %s)", override_path)
651
649
 
652
650
  try:
653
651
  return _parse_config(data)
@@ -64,7 +64,7 @@ tempfile = true
64
64
  cryptography = true # No I/O of its own; all file access goes through Python builtins
65
65
  git = "GitPython" # [shell.git] policy enforced at the git.cmd.Git.execute chokepoint
66
66
  polars = true
67
- P4 = "p4python" # Restricted to non-submit operations
67
+ #P4 = "p4python" # Restricted to non-submit operations
68
68
 
69
69
  # Filesystem scoping for run_python.
70
70
  # Paths are relative to the workspace root (the --workspace directory or CWD).
@@ -106,6 +106,7 @@ class SubprocessExecutor:
106
106
  creationflags=subprocess.CREATE_NEW_PROCESS_GROUP
107
107
  if os.name == "nt"
108
108
  else 0,
109
+ start_new_session=(os.name != "nt"),
109
110
  startupinfo=get_startupinfo() if os.name == "nt" else None,
110
111
  )
111
112
  try:
@@ -759,6 +759,7 @@ class ShellExecutor:
759
759
  )
760
760
  if _os.name == "nt"
761
761
  else 0,
762
+ start_new_session=(_os.name != "nt"),
762
763
  startupinfo=get_startupinfo() if _os.name == "nt" else None,
763
764
  )
764
765
  try:
@@ -6,11 +6,15 @@ third-party packages, and exposes the venv Python path for subprocess use.
6
6
  Uses a stamp file (.pyddock/venv/installed.json) to skip redundant install
7
7
  checks on subsequent boots. The stamp records:
8
8
  - venv_created: creation timestamp of pyvenv.cfg (detects venv recreation)
9
+ - interpreter_id: "{impl}-{major}.{minor}-{gil}" fingerprint of the child venv
9
10
  - allowlist_hash: hash of sorted allowlist + pip_packages (detects config changes)
10
11
  - workspace: {module_name: hash_of_pyproject_toml} (detects metadata changes)
11
12
 
12
13
  If the stamp is missing, corrupt, or stale, a full install pass runs (same as
13
14
  the previous always-install behavior) and a fresh stamp is written.
15
+
16
+ The venv is automatically recreated when the parent interpreter's major.minor
17
+ version, implementation, or GIL/free-threaded ABI variant changes.
14
18
  """
15
19
 
16
20
  from __future__ import annotations
@@ -43,6 +47,24 @@ def _hash_file(path: Path) -> str:
43
47
  return hashlib.sha256(path.read_bytes()).hexdigest()[:16]
44
48
 
45
49
 
50
+ def _get_interpreter_id() -> str:
51
+ """Build an identifier for the running interpreter: impl-major.minor-gil.
52
+
53
+ This captures the three dimensions that make a venv incompatible:
54
+ - Implementation (cpython vs pypy)
55
+ - Major.minor version (3.12 vs 3.14)
56
+ - GIL variant (gil vs freethreaded) — relevant for 3.13+ ABI tags
57
+ """
58
+ impl = sys.implementation.name
59
+ version = f"{sys.version_info.major}.{sys.version_info.minor}"
60
+ # sys._is_gil_enabled() exists on 3.13+ free-threaded builds
61
+ if hasattr(sys, "_is_gil_enabled"):
62
+ gil = "gil" if sys._is_gil_enabled() else "freethreaded"
63
+ else:
64
+ gil = "gil"
65
+ return f"{impl}-{version}-{gil}"
66
+
67
+
46
68
  def _get_venv_created(venv_path: Path) -> str | None:
47
69
  """Return the creation/mtime timestamp of pyvenv.cfg as an ISO string.
48
70
 
@@ -147,6 +169,7 @@ class VenvManager:
147
169
  venv_created = _get_venv_created(self._venv_path)
148
170
  data = {
149
171
  "venv_created": venv_created,
172
+ "interpreter_id": _get_interpreter_id(),
150
173
  "allowlist_hash": allowlist_hash,
151
174
  "workspace": workspace_hashes,
152
175
  }
@@ -172,13 +195,116 @@ class VenvManager:
172
195
  # Venv lifecycle
173
196
  # ------------------------------------------------------------------
174
197
 
198
+ def _probe_child_interpreter(self) -> str | None:
199
+ """Probe the child venv interpreter for its identity string.
200
+
201
+ Returns an identifier like "cpython-3.14-gil" or None if the
202
+ interpreter cannot be launched (broken venv, missing base install).
203
+ """
204
+ python = self.get_python_path()
205
+ if not python.exists():
206
+ return None
207
+ try:
208
+ result = subprocess.run(
209
+ [
210
+ str(python), "-c",
211
+ "import sys;"
212
+ "gil='gil' if not hasattr(sys,'_is_gil_enabled') else "
213
+ "('gil' if sys._is_gil_enabled() else 'freethreaded');"
214
+ "print(f'{sys.implementation.name}-"
215
+ "{sys.version_info.major}.{sys.version_info.minor}-{gil}')",
216
+ ],
217
+ capture_output=True,
218
+ text=True,
219
+ timeout=10,
220
+ )
221
+ except (subprocess.TimeoutExpired, OSError):
222
+ return None
223
+ if result.returncode != 0:
224
+ return None
225
+ return result.stdout.strip()
226
+
227
+ def _needs_recreation(self) -> bool:
228
+ """Determine whether the child venv needs to be recreated.
229
+
230
+ Returns True if:
231
+ - The child interpreter cannot be launched (broken/missing base)
232
+ - The child's version/impl/GIL doesn't match the running server
233
+ - pyvenv.cfg is missing (not a valid venv)
234
+
235
+ Uses the stamp's cached interpreter_id to skip the subprocess probe
236
+ when possible.
237
+ """
238
+ if not self._venv_path.exists():
239
+ return False # Nothing to recreate; ensure_venv will create fresh.
240
+
241
+ cfg = self._venv_path / "pyvenv.cfg"
242
+ if not cfg.exists():
243
+ return False # Not a venv dir; don't touch it.
244
+
245
+ expected_id = _get_interpreter_id()
246
+
247
+ # Fast path: check stamp cache to avoid subprocess probe
248
+ stamp = self._load_stamp()
249
+ cached_id = stamp.get("interpreter_id")
250
+ if cached_id is not None:
251
+ if cached_id == expected_id:
252
+ return False
253
+ logger.info(
254
+ "Interpreter mismatch detected from stamp "
255
+ "(cached=%s, expected=%s)",
256
+ cached_id, expected_id,
257
+ )
258
+ return True
259
+
260
+ # No cached id — probe the child interpreter
261
+ child_id = self._probe_child_interpreter()
262
+ if child_id is None:
263
+ logger.info(
264
+ "Child interpreter at %s is broken or missing, will recreate",
265
+ self.get_python_path(),
266
+ )
267
+ return True
268
+
269
+ if child_id != expected_id:
270
+ logger.info(
271
+ "Interpreter version mismatch (child=%s, server=%s), "
272
+ "will recreate venv",
273
+ child_id, expected_id,
274
+ )
275
+ return True
276
+
277
+ return False
278
+
175
279
  def ensure_venv(self) -> None:
176
- """Create the virtual environment if it doesn't already exist."""
280
+ """Create or recreate the virtual environment as needed.
281
+
282
+ Recreates the venv (with clear=True) if the child interpreter's
283
+ version, implementation, or GIL variant no longer matches the
284
+ running server's Python. This handles upgrades like 3.12→3.14
285
+ transparently.
286
+ """
177
287
  if self._venv_path.exists() and self.get_python_path().exists():
178
- return
288
+ if not self._needs_recreation():
289
+ return
290
+ # Guard: only clear directories that are actually a venv
291
+ cfg = self._venv_path / "pyvenv.cfg"
292
+ if not cfg.exists():
293
+ raise VenvError(
294
+ f"Refusing to clear {self._venv_path}: no pyvenv.cfg found. "
295
+ f"This does not appear to be a virtual environment."
296
+ )
297
+ logger.warning(
298
+ "Recreating venv at %s (interpreter changed to %s). "
299
+ "All packages will be reinstalled.",
300
+ self._venv_path,
301
+ _get_interpreter_id(),
302
+ )
303
+ # Invalidate the stamp so install_missing does a full pass
304
+ self._stamp = {}
179
305
 
180
306
  try:
181
- venv.create(str(self._venv_path), with_pip=True)
307
+ venv.create(str(self._venv_path), clear=True, with_pip=True)
182
308
  except Exception as e:
183
309
  raise VenvError(f"Failed to create venv at {self._venv_path}: {e}") from e
184
310
 
@@ -16,6 +16,18 @@ from pyddock.config import (
16
16
  from tests._config_helpers import make_config_toml, write_workspace_config
17
17
 
18
18
 
19
+ @pytest.fixture(autouse=True)
20
+ def _isolate_home(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
21
+ """Prevent the real ~/.pyddock/ from leaking into tests.
22
+
23
+ Points Path.home() at a per-test empty directory so that a global
24
+ pyddock.override.toml on the developer's machine doesn't affect results.
25
+ """
26
+ fake_home = tmp_path / "fakehome"
27
+ fake_home.mkdir()
28
+ monkeypatch.setattr(Path, "home", staticmethod(lambda: fake_home))
29
+
30
+
19
31
  class TestConfigResolution:
20
32
  """Tests for config file resolution order."""
21
33
 
@@ -250,3 +262,86 @@ class TestConfigOverride:
250
262
  self._write_override(tmp_path, "[execution]\ntimeout = 99\n")
251
263
  config = load_config(tmp_path)
252
264
  assert config.execution.timeout == 99
265
+
266
+
267
+ class TestGlobalOverride:
268
+ """Tests for ~/.pyddock/pyddock.override.toml global overlay merging.
269
+
270
+ The autouse _isolate_home fixture already points Path.home() at
271
+ tmp_path/fakehome, so these tests just write into that directory.
272
+ """
273
+
274
+ def _get_fake_home(self, tmp_path: Path) -> Path:
275
+ return tmp_path / "fakehome"
276
+
277
+ def _write_global_override(self, tmp_path: Path, content: str) -> None:
278
+ override = self._get_fake_home(tmp_path) / ".pyddock" / "pyddock.override.toml"
279
+ override.parent.mkdir(parents=True, exist_ok=True)
280
+ override.write_text(content)
281
+
282
+ def _write_workspace_override(self, workspace: Path, content: str) -> None:
283
+ override = workspace / ".pyddock" / "pyddock.override.toml"
284
+ override.parent.mkdir(parents=True, exist_ok=True)
285
+ override.write_text(content)
286
+
287
+ def test_global_override_applied(self, tmp_path: Path) -> None:
288
+ """Global override merges on top of base config."""
289
+ workspace = tmp_path / "ws"
290
+ write_workspace_config(workspace)
291
+ self._write_global_override(tmp_path, "[execution]\ntimeout = 60\n")
292
+
293
+ config = load_config(workspace)
294
+ assert config.execution.timeout == 60
295
+
296
+ def test_workspace_override_wins_over_global(self, tmp_path: Path) -> None:
297
+ """Workspace override takes precedence over global override."""
298
+ workspace = tmp_path / "ws"
299
+ write_workspace_config(workspace)
300
+ self._write_global_override(tmp_path, "[execution]\ntimeout = 60\n")
301
+ self._write_workspace_override(workspace, "[execution]\ntimeout = 120\n")
302
+
303
+ config = load_config(workspace)
304
+ assert config.execution.timeout == 120
305
+
306
+ def test_global_override_adds_import(self, tmp_path: Path) -> None:
307
+ """Global override can add imports that the workspace config doesn't have."""
308
+ workspace = tmp_path / "ws"
309
+ write_workspace_config(workspace, imports="[imports]\njson = true\n")
310
+ self._write_global_override(tmp_path, "[imports]\nrequests = true\n")
311
+
312
+ config = load_config(workspace)
313
+ assert "json" in config.imports.allowed
314
+ assert "requests" in config.imports.allowed
315
+
316
+ def test_no_global_override(self, tmp_path: Path) -> None:
317
+ """Missing global override is silently skipped."""
318
+ workspace = tmp_path / "ws"
319
+ write_workspace_config(workspace)
320
+
321
+ config = load_config(workspace)
322
+ assert isinstance(config, PyddockConfig)
323
+ assert config.execution.timeout == 30
324
+
325
+ def test_global_override_invalid_toml(self, tmp_path: Path) -> None:
326
+ """Invalid TOML in global override raises ConfigError."""
327
+ workspace = tmp_path / "ws"
328
+ write_workspace_config(workspace)
329
+ self._write_global_override(tmp_path, "not valid [[[ toml")
330
+
331
+ with pytest.raises(ConfigError, match="Invalid TOML"):
332
+ load_config(workspace)
333
+
334
+ def test_global_and_workspace_overrides_merge_different_sections(
335
+ self, tmp_path: Path
336
+ ) -> None:
337
+ """Global and workspace overrides can each contribute different sections."""
338
+ workspace = tmp_path / "ws"
339
+ write_workspace_config(workspace)
340
+ # Global adds a shell policy
341
+ self._write_global_override(tmp_path, '[shell.git]\nmode = "deny"\nallow = ["status.*"]\n')
342
+ # Workspace override changes timeout
343
+ self._write_workspace_override(workspace, "[execution]\ntimeout = 45\n")
344
+
345
+ config = load_config(workspace)
346
+ assert "git" in config.shell
347
+ assert config.execution.timeout == 45
@@ -502,6 +502,7 @@ class TestAdsArgPathScanBlocked:
502
502
  assert reason is not None
503
503
  assert "alternate data stream" in reason
504
504
 
505
+ @pytest.mark.skipif(sys.platform != "win32", reason="C:\\ is not absolute on POSIX")
505
506
  def test_switch_value_is_parsed_not_raw_token(self, tmp_path: Path) -> None:
506
507
  """The path is parsed from the switch VALUE, so a drive colon in the
507
508
  value (C:/...) is judged on its own merits (outside-workspace), and the
@@ -4,6 +4,8 @@ from __future__ import annotations
4
4
 
5
5
  from pathlib import Path
6
6
 
7
+ import sys
8
+
7
9
  import pytest
8
10
 
9
11
  from pyddock.config import (
@@ -134,6 +136,7 @@ class TestArgPathsBlocksScriptDirs:
134
136
  class TestArgPathsWorkspaceMode:
135
137
  """'workspace' mode blocks paths resolving outside the workspace."""
136
138
 
139
+ @pytest.mark.skipif(sys.platform != "win32", reason="C:\\ is not absolute on POSIX")
137
140
  def test_blocks_absolute_path_outside_workspace(self, tmp_path: Path) -> None:
138
141
  policy = ShellPolicyConfig(
139
142
  command="^p4$", mode="deny", allow=["print.*"], arg_paths="workspace"
@@ -273,6 +276,7 @@ class TestArgPathsEmbeddedFlagValues:
273
276
  assert result is not None
274
277
  assert ".pyddock/" in result
275
278
 
279
+ @pytest.mark.skipif(sys.platform != "win32", reason="C:\\ is not absolute on POSIX")
276
280
  def test_blocks_flag_equals_outside_workspace(self, tmp_path: Path) -> None:
277
281
  """--output=C:/Windows/evil.txt is blocked in workspace mode."""
278
282
  policy = ShellPolicyConfig(
@@ -251,7 +251,9 @@ class TestExecute:
251
251
 
252
252
  with patch("pyddock.shell_executor.subprocess.Popen", return_value=mock_proc):
253
253
  with patch("pyddock._process_utils.subprocess.run"): # for taskkill
254
- result = executor.execute("python", ["-c", "import time; time.sleep(99)"], 1.0)
254
+ with patch("pyddock._process_utils.os.getpgid", return_value=12345):
255
+ with patch("pyddock._process_utils.os.killpg"):
256
+ result = executor.execute("python", ["-c", "import time; time.sleep(99)"], 1.0)
255
257
 
256
258
  assert result.exit_code == 1
257
259
  assert "TimeoutError" in result.stderr
@@ -98,6 +98,7 @@ class TestSubstDrivePathMismatch:
98
98
  "canonical path after normcase(realpath(...)) normalization."
99
99
  )
100
100
 
101
+ @pytest.mark.skipif(sys.platform != "win32", reason="case-insensitive path matching is Windows-only")
101
102
  def test_case_mismatch_blocks_trusted_import(self) -> None:
102
103
  """Case mismatch: trusted prefix lowercase vs co_filename mixed case.
103
104
 
@@ -151,6 +152,7 @@ class TestSubstDrivePathMismatch:
151
152
  "co_filename is under a trusted prefix on a normal drive."
152
153
  )
153
154
 
155
+ @pytest.mark.skipif(sys.platform != "win32", reason="subst drive resolution is Windows-only")
154
156
  def test_realpath_resolves_subst_for_co_filename(self) -> None:
155
157
  """Verify that realpath resolves the subst drive in co_filename.
156
158