bounded_subprocess 1.5.0__tar.gz → 2.0.0__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.

Potentially problematic release.


This version of bounded_subprocess might be problematic. Click here for more details.

Files changed (32) hide show
  1. bounded_subprocess-2.0.0/.github/workflows/test.yml +19 -0
  2. bounded_subprocess-2.0.0/Makefile +10 -0
  3. {bounded_subprocess-1.5.0 → bounded_subprocess-2.0.0}/PKG-INFO +1 -1
  4. {bounded_subprocess-1.5.0 → bounded_subprocess-2.0.0}/pyproject.toml +5 -1
  5. bounded_subprocess-2.0.0/src/bounded_subprocess/__init__.py +34 -0
  6. bounded_subprocess-1.5.0/src/bounded_subprocess/__init__.py → bounded_subprocess-2.0.0/src/bounded_subprocess/bounded_subprocess.py +1 -1
  7. {bounded_subprocess-1.5.0 → bounded_subprocess-2.0.0}/test/module_test.py +2 -0
  8. bounded_subprocess-1.5.0/Makefile +0 -10
  9. {bounded_subprocess-1.5.0 → bounded_subprocess-2.0.0}/.gitignore +0 -0
  10. {bounded_subprocess-1.5.0 → bounded_subprocess-2.0.0}/LICENSE.txt +0 -0
  11. {bounded_subprocess-1.5.0 → bounded_subprocess-2.0.0}/README.md +0 -0
  12. {bounded_subprocess-1.5.0 → bounded_subprocess-2.0.0}/cspell.config.yaml +0 -0
  13. {bounded_subprocess-1.5.0 → bounded_subprocess-2.0.0}/src/bounded_subprocess/bounded_subprocess_async.py +0 -0
  14. {bounded_subprocess-1.5.0 → bounded_subprocess-2.0.0}/src/bounded_subprocess/interactive.py +0 -0
  15. {bounded_subprocess-1.5.0 → bounded_subprocess-2.0.0}/src/bounded_subprocess/interactive_async.py +0 -0
  16. {bounded_subprocess-1.5.0 → bounded_subprocess-2.0.0}/src/bounded_subprocess/util.py +0 -0
  17. {bounded_subprocess-1.5.0 → bounded_subprocess-2.0.0}/test/__init__.py +0 -0
  18. {bounded_subprocess-1.5.0 → bounded_subprocess-2.0.0}/test/evil_programs/block_on_inputs.py +0 -0
  19. {bounded_subprocess-1.5.0 → bounded_subprocess-2.0.0}/test/evil_programs/close_outputs.py +0 -0
  20. {bounded_subprocess-1.5.0 → bounded_subprocess-2.0.0}/test/evil_programs/dies_shortly_after_launch.py +0 -0
  21. {bounded_subprocess-1.5.0 → bounded_subprocess-2.0.0}/test/evil_programs/dies_while_writing.py +0 -0
  22. {bounded_subprocess-1.5.0 → bounded_subprocess-2.0.0}/test/evil_programs/does_not_read.py +0 -0
  23. {bounded_subprocess-1.5.0 → bounded_subprocess-2.0.0}/test/evil_programs/fork_bomb.py +0 -0
  24. {bounded_subprocess-1.5.0 → bounded_subprocess-2.0.0}/test/evil_programs/fork_once.py +0 -0
  25. {bounded_subprocess-1.5.0 → bounded_subprocess-2.0.0}/test/evil_programs/long_stdout.py +0 -0
  26. {bounded_subprocess-1.5.0 → bounded_subprocess-2.0.0}/test/evil_programs/sleep_forever.py +0 -0
  27. {bounded_subprocess-1.5.0 → bounded_subprocess-2.0.0}/test/evil_programs/unbounded_output.py +0 -0
  28. {bounded_subprocess-1.5.0 → bounded_subprocess-2.0.0}/test/evil_programs/write_forever_but_no_newline.py +0 -0
  29. {bounded_subprocess-1.5.0 → bounded_subprocess-2.0.0}/test/test_async.py +0 -0
  30. {bounded_subprocess-1.5.0 → bounded_subprocess-2.0.0}/test/test_interactive.py +0 -0
  31. {bounded_subprocess-1.5.0 → bounded_subprocess-2.0.0}/test/test_interactive_async.py +0 -0
  32. {bounded_subprocess-1.5.0 → bounded_subprocess-2.0.0}/uv.lock +0 -0
@@ -0,0 +1,19 @@
1
+ name: Test
2
+ on:
3
+ push:
4
+ branches: [ "main" ]
5
+ pull_request:
6
+ branches: [ "main" ]
7
+ permissions:
8
+ contents: read
9
+ jobs:
10
+ build:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ - name: Install uv
15
+ uses: astral-sh/setup-uv@v5
16
+ - name: Install the project
17
+ run: uv sync --locked --all-extras --dev
18
+ - name: Run tests
19
+ run: uv run python -m pytest -m "not unsafe"
@@ -0,0 +1,10 @@
1
+ .PHONY: test build publish
2
+
3
+ build:
4
+ uv build
5
+
6
+ publish:
7
+ uv publish
8
+
9
+ test:
10
+ uv run python -m pytest -m "not unsafe"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bounded_subprocess
3
- Version: 1.5.0
3
+ Version: 2.0.0
4
4
  Summary: A library to facilitate running subprocesses that may misbehave.
5
5
  Project-URL: Homepage, https://github.com/arjunguha/bounded_subprocess
6
6
  Project-URL: Bug Tracker, https://github.com/arjunguha/bounded_subprocess
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "bounded_subprocess"
3
- version = "1.5.0"
3
+ version = "2.0.0"
4
4
  authors = [
5
5
  { name="Arjun Guha" },
6
6
  { name="Ming-Ho Yee" },
@@ -25,6 +25,10 @@ build-backend = "hatchling.build"
25
25
 
26
26
  [tool.pytest.ini_options]
27
27
  pythonpath = ["src"]
28
+ markers = [
29
+ "unsafe: Tests that may crash the machine on failure",
30
+ ]
31
+ asyncio_default_fixture_loop_scope = "function"
28
32
 
29
33
  [project.urls]
30
34
  "Homepage" = "https://github.com/arjunguha/bounded_subprocess"
@@ -0,0 +1,34 @@
1
+ """
2
+ Bounded subprocess execution with timeout and output limits.
3
+
4
+ This package provides convenient functions for running subprocesses with bounded
5
+ execution time and output size, with support for both synchronous and asynchronous
6
+ execution patterns.
7
+ """
8
+
9
+ __version__ = "1.0.0"
10
+
11
+ # Lazy imports for better startup performance
12
+ def __getattr__(name):
13
+ if name == "run":
14
+ from .bounded_subprocess import run
15
+ return run
16
+ elif name == "Result":
17
+ from .util import Result
18
+ return Result
19
+ elif name == "BoundedSubprocessState":
20
+ from .util import BoundedSubprocessState
21
+ return BoundedSubprocessState
22
+ elif name == "SLEEP_BETWEEN_READS":
23
+ from .util import SLEEP_BETWEEN_READS
24
+ return SLEEP_BETWEEN_READS
25
+ else:
26
+ raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
27
+
28
+ # Expose key classes and constants for convenience
29
+ __all__ = [
30
+ "run",
31
+ "Result",
32
+ "BoundedSubprocessState",
33
+ "SLEEP_BETWEEN_READS"
34
+ ]
@@ -27,4 +27,4 @@ def run(
27
27
  else:
28
28
  break
29
29
 
30
- return state.terminate()
30
+ return state.terminate()
@@ -1,6 +1,7 @@
1
1
  from bounded_subprocess import run
2
2
  import time
3
3
  from pathlib import Path
4
+ import pytest
4
5
 
5
6
  ROOT = Path(__file__).resolve().parent / "evil_programs"
6
7
 
@@ -70,6 +71,7 @@ def test_sleep_forever():
70
71
  assert_no_running_evil()
71
72
 
72
73
 
74
+ @pytest.mark.unsafe
73
75
  def test_fork_bomb():
74
76
  result = run(
75
77
  ["python3", ROOT / "fork_bomb.py"],
@@ -1,10 +0,0 @@
1
- .PHONY: test
2
-
3
- build:
4
- uv build
5
-
6
- publish:
7
- python3 -m twine upload dist/*
8
-
9
- test:
10
- uv run python -m pytest