resourcera 0.1.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.
Files changed (133) hide show
  1. resourcera-0.1.0/.github/workflows/ci.yml +136 -0
  2. resourcera-0.1.0/.gitignore +17 -0
  3. resourcera-0.1.0/.pre-commit-config.yaml +7 -0
  4. resourcera-0.1.0/.readthedocs.yaml +18 -0
  5. resourcera-0.1.0/CHANGELOG.md +17 -0
  6. resourcera-0.1.0/CODE_OF_CONDUCT.md +8 -0
  7. resourcera-0.1.0/CONTRIBUTING.md +27 -0
  8. resourcera-0.1.0/LICENSE +201 -0
  9. resourcera-0.1.0/PKG-INFO +148 -0
  10. resourcera-0.1.0/README.md +115 -0
  11. resourcera-0.1.0/SECURITY.md +11 -0
  12. resourcera-0.1.0/diagrams/accelerator-discovery.mmd +13 -0
  13. resourcera-0.1.0/diagrams/admission-decisions.mmd +11 -0
  14. resourcera-0.1.0/diagrams/capacity-estimation.mmd +9 -0
  15. resourcera-0.1.0/diagrams/ci-puppeteer.json +3 -0
  16. resourcera-0.1.0/diagrams/coordination.mmd +7 -0
  17. resourcera-0.1.0/diagrams/hybrid-sampling.mmd +11 -0
  18. resourcera-0.1.0/diagrams/mermaid-config.json +9 -0
  19. resourcera-0.1.0/diagrams/overall-architecture.mmd +13 -0
  20. resourcera-0.1.0/diagrams/overhead-feedback.mmd +11 -0
  21. resourcera-0.1.0/diagrams/provider-failure-recovery.mmd +10 -0
  22. resourcera-0.1.0/diagrams/reservation-lifecycle.mmd +10 -0
  23. resourcera-0.1.0/diagrams/resource-discovery.mmd +13 -0
  24. resourcera-0.1.0/docs/agent-skills/index.md +34 -0
  25. resourcera-0.1.0/docs/agent-skills/install.md +62 -0
  26. resourcera-0.1.0/docs/agent-skills/resourcera-provider.md +36 -0
  27. resourcera-0.1.0/docs/agent-skills/resourcera.md +38 -0
  28. resourcera-0.1.0/docs/api/index.md +38 -0
  29. resourcera-0.1.0/docs/architecture/diagrams.md +45 -0
  30. resourcera-0.1.0/docs/assets/diagrams/accelerator-discovery.png +0 -0
  31. resourcera-0.1.0/docs/assets/diagrams/admission-decisions.png +0 -0
  32. resourcera-0.1.0/docs/assets/diagrams/capacity-estimation.png +0 -0
  33. resourcera-0.1.0/docs/assets/diagrams/coordination.png +0 -0
  34. resourcera-0.1.0/docs/assets/diagrams/hybrid-sampling.png +0 -0
  35. resourcera-0.1.0/docs/assets/diagrams/manifest.json +32 -0
  36. resourcera-0.1.0/docs/assets/diagrams/overall-architecture.png +0 -0
  37. resourcera-0.1.0/docs/assets/diagrams/overhead-feedback.png +0 -0
  38. resourcera-0.1.0/docs/assets/diagrams/provider-failure-recovery.png +0 -0
  39. resourcera-0.1.0/docs/assets/diagrams/reservation-lifecycle.png +0 -0
  40. resourcera-0.1.0/docs/assets/diagrams/resource-discovery.png +0 -0
  41. resourcera-0.1.0/docs/assets/logo.svg +19 -0
  42. resourcera-0.1.0/docs/development/package-name-verification.md +12 -0
  43. resourcera-0.1.0/docs/development/release.md +14 -0
  44. resourcera-0.1.0/docs/development/testing.md +60 -0
  45. resourcera-0.1.0/docs/examples/index.md +27 -0
  46. resourcera-0.1.0/docs/getting-started/configuration.md +29 -0
  47. resourcera-0.1.0/docs/getting-started/index.md +29 -0
  48. resourcera-0.1.0/docs/getting-started/installation.md +23 -0
  49. resourcera-0.1.0/docs/getting-started/quickstart.md +32 -0
  50. resourcera-0.1.0/docs/guide/accelerators.md +24 -0
  51. resourcera-0.1.0/docs/guide/admission.md +31 -0
  52. resourcera-0.1.0/docs/guide/architecture.md +22 -0
  53. resourcera-0.1.0/docs/guide/capacity.md +24 -0
  54. resourcera-0.1.0/docs/guide/coordination.md +28 -0
  55. resourcera-0.1.0/docs/guide/cpu-memory.md +27 -0
  56. resourcera-0.1.0/docs/guide/custom-providers.md +14 -0
  57. resourcera-0.1.0/docs/guide/disk-network.md +26 -0
  58. resourcera-0.1.0/docs/guide/index.md +30 -0
  59. resourcera-0.1.0/docs/guide/metrics.md +23 -0
  60. resourcera-0.1.0/docs/guide/sampling-overhead.md +27 -0
  61. resourcera-0.1.0/docs/guide/troubleshooting.md +20 -0
  62. resourcera-0.1.0/docs/index.md +136 -0
  63. resourcera-0.1.0/docs/stylesheets/extra.css +163 -0
  64. resourcera-0.1.0/examples/adaptive_concurrency.py +28 -0
  65. resourcera-0.1.0/examples/automatic_accelerator_discovery.py +28 -0
  66. resourcera-0.1.0/examples/basic_snapshot.py +21 -0
  67. resourcera-0.1.0/examples/capacity_estimation.py +23 -0
  68. resourcera-0.1.0/examples/container_resources.py +29 -0
  69. resourcera-0.1.0/examples/cpu_monitoring.py +25 -0
  70. resourcera-0.1.0/examples/custom_provider.py +109 -0
  71. resourcera-0.1.0/examples/disk_monitoring.py +25 -0
  72. resourcera-0.1.0/examples/hybrid_sampling.py +22 -0
  73. resourcera-0.1.0/examples/machine_resources.py +20 -0
  74. resourcera-0.1.0/examples/memory_monitoring.py +24 -0
  75. resourcera-0.1.0/examples/network_monitoring.py +36 -0
  76. resourcera-0.1.0/examples/process_resources.py +22 -0
  77. resourcera-0.1.0/examples/resource_admission.py +19 -0
  78. resourcera-0.1.0/examples/resource_reservations.py +30 -0
  79. resourcera-0.1.0/examples/strict_overhead.py +21 -0
  80. resourcera-0.1.0/examples/workload_requirements.py +17 -0
  81. resourcera-0.1.0/pyproject.toml +188 -0
  82. resourcera-0.1.0/pyproject.toml.orig +136 -0
  83. resourcera-0.1.0/scripts/check_distributions.py +65 -0
  84. resourcera-0.1.0/scripts/check_site_links.py +83 -0
  85. resourcera-0.1.0/scripts/render-diagrams.mjs +120 -0
  86. resourcera-0.1.0/skills/README.md +13 -0
  87. resourcera-0.1.0/skills/resourcera/SKILL.md +81 -0
  88. resourcera-0.1.0/skills/resourcera/evals/evals.json +39 -0
  89. resourcera-0.1.0/skills/resourcera/evals/trigger_queries.json +21 -0
  90. resourcera-0.1.0/skills/resourcera/references/runtime.md +20 -0
  91. resourcera-0.1.0/skills/resourcera/references/workloads.md +22 -0
  92. resourcera-0.1.0/skills/resourcera/scripts/verify_setup.py +86 -0
  93. resourcera-0.1.0/skills/resourcera-provider/SKILL.md +50 -0
  94. resourcera-0.1.0/skills/resourcera-provider/evals/evals.json +38 -0
  95. resourcera-0.1.0/skills/resourcera-provider/evals/trigger_queries.json +21 -0
  96. resourcera-0.1.0/skills/resourcera-provider/references/provider-contract.md +21 -0
  97. resourcera-0.1.0/skills/resourcera-provider/references/validation.md +17 -0
  98. resourcera-0.1.0/skills.sh.json +4 -0
  99. resourcera-0.1.0/src/resourcera/__init__.py +108 -0
  100. resourcera-0.1.0/src/resourcera/_inventory_worker.py +69 -0
  101. resourcera-0.1.0/src/resourcera/_provider_worker.py +244 -0
  102. resourcera-0.1.0/src/resourcera/_subprocess.py +53 -0
  103. resourcera-0.1.0/src/resourcera/accelerators.py +458 -0
  104. resourcera-0.1.0/src/resourcera/admission.py +432 -0
  105. resourcera-0.1.0/src/resourcera/capacity.py +540 -0
  106. resourcera-0.1.0/src/resourcera/cgroups.py +243 -0
  107. resourcera-0.1.0/src/resourcera/config.py +61 -0
  108. resourcera-0.1.0/src/resourcera/coordination.py +405 -0
  109. resourcera-0.1.0/src/resourcera/exceptions.py +40 -0
  110. resourcera-0.1.0/src/resourcera/inventory.py +239 -0
  111. resourcera-0.1.0/src/resourcera/manager.py +1286 -0
  112. resourcera-0.1.0/src/resourcera/metrics.py +50 -0
  113. resourcera-0.1.0/src/resourcera/models.py +399 -0
  114. resourcera-0.1.0/src/resourcera/overhead.py +193 -0
  115. resourcera-0.1.0/src/resourcera/py.typed +0 -0
  116. resourcera-0.1.0/src/resourcera/telemetry.py +944 -0
  117. resourcera-0.1.0/tests/conftest.py +85 -0
  118. resourcera-0.1.0/tests/test_accelerators.py +340 -0
  119. resourcera-0.1.0/tests/test_admission.py +371 -0
  120. resourcera-0.1.0/tests/test_capacity.py +231 -0
  121. resourcera-0.1.0/tests/test_cgroups.py +99 -0
  122. resourcera-0.1.0/tests/test_coordination.py +212 -0
  123. resourcera-0.1.0/tests/test_documentation.py +136 -0
  124. resourcera-0.1.0/tests/test_examples.py +51 -0
  125. resourcera-0.1.0/tests/test_inventory.py +92 -0
  126. resourcera-0.1.0/tests/test_manager.py +168 -0
  127. resourcera-0.1.0/tests/test_models.py +62 -0
  128. resourcera-0.1.0/tests/test_overhead.py +267 -0
  129. resourcera-0.1.0/tests/test_performance.py +145 -0
  130. resourcera-0.1.0/tests/test_skills.py +105 -0
  131. resourcera-0.1.0/tests/test_telemetry.py +276 -0
  132. resourcera-0.1.0/uv.lock +1875 -0
  133. resourcera-0.1.0/zensical.toml +110 -0
@@ -0,0 +1,136 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ runtime:
13
+ name: Python ${{ matrix.python }} on ${{ matrix.os }}
14
+ strategy:
15
+ fail-fast: false
16
+ matrix:
17
+ os: [ubuntu-latest, windows-latest, macos-latest]
18
+ python: ["3.12", "3.13", "3.14", "3.15"]
19
+ runs-on: ${{ matrix.os }}
20
+ steps:
21
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
22
+ - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
23
+ with:
24
+ python-version: ${{ matrix.python }}
25
+ - uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0
26
+ with:
27
+ version: "0.13.6"
28
+ - run: uv sync --locked --no-default-groups --group test
29
+ - run: uv run --locked --no-default-groups --group test pytest -m "not examples and not benchmark"
30
+
31
+ quality:
32
+ runs-on: ubuntu-latest
33
+ steps:
34
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
35
+ - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
36
+ with:
37
+ python-version: "3.12"
38
+ - uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0
39
+ with:
40
+ version: "0.13.6"
41
+ - run: uv sync --locked --all-groups
42
+ - run: uv lock --check
43
+ - run: uv run --locked ruff check .
44
+ - run: uv run --locked ruff format --check .
45
+ - run: uv run --locked pyrefly check
46
+ - run: uv run --locked pytest --cov=resourcera --cov-branch
47
+
48
+ core-only:
49
+ runs-on: ubuntu-latest
50
+ steps:
51
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
52
+ - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
53
+ with:
54
+ python-version: "3.12"
55
+ - uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0
56
+ with:
57
+ version: "0.13.6"
58
+ - run: uv sync --locked --no-default-groups
59
+ - run: uv run --locked --no-default-groups python -c "import importlib.util, sys, resourcera; assert importlib.util.find_spec('pynvml') is None; assert 'pynvml' not in sys.modules; print(resourcera.__version__)"
60
+ - run: uv pip check
61
+
62
+ nvidia-extra:
63
+ runs-on: ubuntu-latest
64
+ steps:
65
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
66
+ - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
67
+ with:
68
+ python-version: "3.12"
69
+ - uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0
70
+ with:
71
+ version: "0.13.6"
72
+ - run: uv sync --locked --no-default-groups --group test --extra nvidia
73
+ - run: uv run --locked --no-default-groups --group test --extra nvidia python -c "import importlib.util; assert importlib.util.find_spec('pynvml') is not None"
74
+ - run: uv run --locked --no-default-groups --group test --extra nvidia pytest tests/test_accelerators.py tests/test_models.py
75
+ - run: uv pip check
76
+
77
+ lowest-direct:
78
+ runs-on: ubuntu-latest
79
+ steps:
80
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
81
+ - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
82
+ with:
83
+ python-version: "3.12"
84
+ - uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0
85
+ with:
86
+ version: "0.13.6"
87
+ - run: uv sync --no-default-groups --group test --resolution lowest-direct
88
+ - run: uv run --no-default-groups --group test --resolution lowest-direct pytest -m "not examples and not benchmark"
89
+ - run: uv pip check
90
+
91
+ docs-and-diagrams:
92
+ runs-on: ubuntu-latest
93
+ steps:
94
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
95
+ - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
96
+ with:
97
+ python-version: "3.12"
98
+ - uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0
99
+ with:
100
+ version: "0.13.6"
101
+ - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
102
+ with:
103
+ node-version: "22"
104
+ - run: uv sync --locked --group docs
105
+ - run: uv run --locked --group docs zensical build --strict
106
+ - run: uv run --locked python scripts/check_site_links.py
107
+ - run: node scripts/render-diagrams.mjs --check
108
+ - run: npm install --global --ignore-scripts --no-audit --no-fund @mermaid-js/mermaid-cli@12.2.0
109
+ - name: Validate Mermaid sources with pinned renderer
110
+ env:
111
+ PUPPETEER_EXECUTABLE_PATH: /usr/bin/google-chrome
112
+ run: |
113
+ mkdir -p "$RUNNER_TEMP/resourcera-diagrams"
114
+ for source in diagrams/*.mmd; do
115
+ name="$(basename "$source" .mmd)"
116
+ mmdc -i "$source" -o "$RUNNER_TEMP/resourcera-diagrams/$name.png" -c diagrams/mermaid-config.json -p diagrams/ci-puppeteer.json -b white -s 2
117
+ done
118
+
119
+ package:
120
+ runs-on: ubuntu-latest
121
+ steps:
122
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
123
+ - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
124
+ with:
125
+ python-version: "3.12"
126
+ - uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0
127
+ with:
128
+ version: "0.13.6"
129
+ - run: uv build
130
+ - run: uv run --locked --group package twine check dist/*.whl dist/*.tar.gz
131
+ - run: uv run --locked python scripts/check_distributions.py dist/*.whl dist/*.tar.gz
132
+ - run: uv venv --seed --python 3.12 "$RUNNER_TEMP/clean-env"
133
+ - run: uv pip install --python "$RUNNER_TEMP/clean-env/bin/python" dist/*.whl
134
+ - run: |
135
+ "$RUNNER_TEMP/clean-env/bin/python" -m pip check
136
+ "$RUNNER_TEMP/clean-env/bin/python" -I -c "import importlib.util, resourcera; assert importlib.util.find_spec('pynvml') is None; print(resourcera.__version__)"
@@ -0,0 +1,17 @@
1
+ .venv/
2
+ .pytest_cache/
3
+ .ruff_cache/
4
+ .hypothesis/
5
+ .coverage
6
+ .coverage.*
7
+ coverage.xml
8
+ htmlcov/
9
+ site/
10
+ dist/
11
+ build/
12
+ *.egg-info/
13
+ __pycache__/
14
+ *.py[cod]
15
+ node_modules/
16
+ .env
17
+ .DS_Store
@@ -0,0 +1,7 @@
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ rev: v0.17.3
4
+ hooks:
5
+ - id: ruff-check
6
+ args: [--fix]
7
+ - id: ruff-format
@@ -0,0 +1,18 @@
1
+ version: 2
2
+
3
+ build:
4
+ os: ubuntu-24.04
5
+ tools:
6
+ python: "3.14"
7
+ jobs:
8
+ post_create_environment:
9
+ - python -m pip install uv==0.13.6
10
+ install:
11
+ - python -m uv sync --locked --no-default-groups --group docs
12
+ build:
13
+ html:
14
+ - python -m uv run --no-sync zensical build --strict
15
+ - python -m uv run --no-sync python scripts/check_site_links.py
16
+ post_build:
17
+ - mkdir -p "$READTHEDOCS_OUTPUT/html"
18
+ - cp -r site/. "$READTHEDOCS_OUTPUT/html/"
@@ -0,0 +1,17 @@
1
+ # Changelog
2
+
3
+ ## Unreleased
4
+
5
+ - Handle unsupported CPU frequency on macOS and fix the hosted documentation build.
6
+ - Add RESOURCERA branding, a redesigned documentation homepage, and expanded agent skills.
7
+ - Use a pinned global Mermaid renderer for diagram regeneration, without Node project files.
8
+ - Add async resource snapshots, psutil telemetry including process virtual memory,
9
+ Linux runnable-task observations, optional process socket counts, and
10
+ cgroup-aware limits.
11
+ - Add automatic OS-visible accelerator inventory and optional isolated NVIDIA NVML
12
+ telemetry, with explicit missing and partial capability states.
13
+ - Add bounded hybrid sampling, attributable overhead feedback, and refresh-engine
14
+ inventory reconciliation.
15
+ - Add explainable capacity estimates, bounded resource-aware admission, process-local
16
+ leases, and opt-in same-machine SQLite coordination.
17
+ - Add asyncio and Trio support, documentation, examples, diagrams, and development checks.
@@ -0,0 +1,8 @@
1
+ # Code of Conduct
2
+
3
+ Participate respectfully and constructively. Harassment, discrimination, threats,
4
+ and disclosure of another person's private information are not acceptable.
5
+
6
+ Project maintainers may remove inappropriate content or restrict participation
7
+ to protect the community. Report concerns privately to the address in
8
+ [SECURITY.md](SECURITY.md).
@@ -0,0 +1,27 @@
1
+ # Contributing
2
+
3
+ Keep RESOURCERA a standalone resource-intelligence library. Add tests and documentation
4
+ for user-visible behavior, report unavailable measurements honestly, and do not commit
5
+ credentials or local environments.
6
+
7
+ Use Python 3.12 or later and uv:
8
+
9
+ ```shell
10
+ uv sync --all-groups
11
+ uv run ruff check .
12
+ uv run ruff format --check .
13
+ uv run pyrefly check
14
+ uv run pytest --cov=resourcera --cov-branch
15
+ uv run zensical build --strict
16
+ uv run python scripts/check_site_links.py
17
+ node scripts/render-diagrams.mjs --check
18
+ ```
19
+
20
+ The diagram check needs Node.js but does not require the renderer to be installed.
21
+ For regeneration, install `@mermaid-js/mermaid-cli@12.2.0` globally with
22
+ `npm install --global --ignore-scripts @mermaid-js/mermaid-cli@12.2.0`, and set
23
+ `PUPPETEER_EXECUTABLE_PATH` to an existing Chromium or Edge executable. Run
24
+ `node scripts/render-diagrams.mjs` and commit the sources, rendered images, and
25
+ manifest together. Never install vendor SDKs or hardware drivers from library code.
26
+
27
+ Report security issues privately as described in [SECURITY.md](SECURITY.md).
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,148 @@
1
+ Metadata-Version: 2.4
2
+ Name: resourcera
3
+ Version: 0.1.0
4
+ Summary: Resource intelligence, capacity estimation, and resource-aware concurrency for Python applications.
5
+ Author: S MUNI HARISH
6
+ Author-email: S MUNI HARISH <samamuniharish@gmail.com>
7
+ License-Expression: Apache-2.0
8
+ License-File: LICENSE
9
+ Classifier: Framework :: AsyncIO
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Classifier: Programming Language :: Python :: 3.15
18
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
+ Classifier: Typing :: Typed
20
+ Requires-Dist: psutil>=7.2.2,<8
21
+ Requires-Dist: anyio>=4.16.0,<5
22
+ Requires-Dist: pydantic>=2.14.3,<3
23
+ Requires-Dist: refresh-engine>=1.0.0,<2
24
+ Requires-Dist: nvidia-ml-py>=13.615.71,<14 ; extra == 'nvidia'
25
+ Requires-Python: >=3.12
26
+ Project-URL: Homepage, https://github.com/smuniharish/resourcera
27
+ Project-URL: Documentation, https://resourcera.readthedocs.io/
28
+ Project-URL: Repository, https://github.com/smuniharish/resourcera
29
+ Project-URL: Issues, https://github.com/smuniharish/resourcera/issues
30
+ Project-URL: Changelog, https://github.com/smuniharish/resourcera/blob/main/CHANGELOG.md
31
+ Provides-Extra: nvidia
32
+ Description-Content-Type: text/markdown
33
+
34
+ <p align="center">
35
+ <img src="https://raw.githubusercontent.com/smuniharish/resourcera/main/docs/assets/logo.svg" alt="RESOURCERA resource gauge logo" width="112" height="112">
36
+ </p>
37
+
38
+ <h1 align="center">RESOURCERA</h1>
39
+
40
+ <p align="center">
41
+ <strong>Know your resources. Admit work with confidence.</strong><br>
42
+ Resource intelligence, capacity estimation, and resource-aware concurrency for Python applications.
43
+ </p>
44
+
45
+ <p align="center">
46
+ <a href="https://github.com/smuniharish/resourcera/actions/workflows/ci.yml"><img src="https://github.com/smuniharish/resourcera/actions/workflows/ci.yml/badge.svg" alt="CI status"></a>
47
+ <a href="https://resourcera.readthedocs.io/"><img src="https://readthedocs.org/projects/resourcera/badge/?version=latest" alt="Documentation status"></a>
48
+ <a href="https://www.python.org/"><img src="https://img.shields.io/badge/python-3.12%20%7C%203.13%20%7C%203.14%20%7C%203.15-3b4cca" alt="Python 3.12, 3.13, 3.14 and 3.15"></a>
49
+ <img src="https://img.shields.io/badge/typing-typed-6655b8" alt="Typed package">
50
+ <a href="https://github.com/smuniharish/resourcera/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-257b74" alt="Apache License 2.0"></a>
51
+ <a href="https://github.com/smuniharish/resourcera"><img src="https://img.shields.io/badge/asyncio%20%2B%20Trio-supported-6655b8" alt="Asyncio and Trio supported"></a>
52
+ </p>
53
+
54
+ <p align="center">
55
+ <a href="https://resourcera.readthedocs.io/">Documentation</a> ·
56
+ <a href="https://github.com/smuniharish/resourcera/blob/main/docs/getting-started/quickstart.md">Quickstart</a> ·
57
+ <a href="https://github.com/smuniharish/resourcera/tree/main/examples">Examples</a> ·
58
+ <a href="https://github.com/smuniharish/resourcera/tree/main/skills">Agent skills</a> ·
59
+ <a href="https://github.com/smuniharish/resourcera/blob/main/CONTRIBUTING.md">Contributing</a>
60
+ </p>
61
+
62
+ ---
63
+
64
+ RESOURCERA is an embeddable, async-first library that observes local resources,
65
+ estimates capacity for a workload, and helps cooperating application tasks make
66
+ explainable admission decisions. It is framework-neutral and does not require an
67
+ accelerator SDK.
68
+
69
+ ## What you can do
70
+
71
+ | Capability | How it helps |
72
+ | --- | --- |
73
+ | **Observe** | Inspect CPU, memory, disk, network, container limits, and visible accelerators with explicit freshness and capability states. |
74
+ | **Estimate** | Describe workload requirements and identify the limiting resource without treating missing data as free capacity. |
75
+ | **Admit** | Bound concurrent work with explainable acceptance or rejection and optional finite waiting. |
76
+ | **Coordinate** | Hold logical leases within an interpreter or between cooperating processes on one machine. |
77
+ | **Control overhead** | Use bounded, adaptive sampling with observable self-overhead safeguards. |
78
+
79
+ RESOURCERA is not a dashboard, distributed execution engine, or physical resource
80
+ isolation mechanism. Measurements and estimates are observations, not guarantees.
81
+
82
+ ## Installation
83
+
84
+ Python 3.12, 3.13, 3.14, and 3.15 are supported (3.12 or newer is required).
85
+ Install from a checkout:
86
+
87
+ ```shell
88
+ python -m pip install .
89
+ ```
90
+
91
+ The intended distribution name is `resourcera` once a release is published. For
92
+ optional NVIDIA NVML telemetry, install `.[nvidia]` from a checkout and provide a
93
+ compatible driver and NVML library. RESOURCERA never installs SDKs or drivers.
94
+
95
+ ## Quickstart
96
+
97
+ ```python
98
+ import anyio
99
+
100
+ from resourcera import AdmissionRejectedError, ResourceManager
101
+
102
+
103
+ async def main():
104
+ async with ResourceManager(scope="machine") as resources:
105
+ snapshot = await resources.snapshot()
106
+ print("Available memory:", snapshot.memory.available_bytes.value, "bytes")
107
+
108
+ try:
109
+ async with resources.admission({"memory": "64MiB"}) as decision:
110
+ print("Admitted:", decision.lease_id)
111
+ await anyio.sleep(0.01) # Your workload goes here.
112
+ except AdmissionRejectedError as error:
113
+ print("Not admitted:", error.decision.reason)
114
+
115
+
116
+ anyio.run(main)
117
+ ```
118
+
119
+ The manager owns its sampling and lease lifecycle. CPU and throughput rates need
120
+ two samples; unavailable, stale, or failed required measurements reject admission.
121
+ Keep the admission context open while the work runs.
122
+
123
+ ## How it fits together
124
+
125
+ ![RESOURCERA resource intelligence architecture](https://raw.githubusercontent.com/smuniharish/resourcera/main/docs/assets/diagrams/overall-architecture.png)
126
+
127
+ Start with the [quickstart](https://resourcera.readthedocs.io/en/latest/getting-started/quickstart/),
128
+ then explore [capacity estimates](https://resourcera.readthedocs.io/en/latest/guide/capacity/),
129
+ [admission](https://resourcera.readthedocs.io/en/latest/guide/admission/),
130
+ and [coordination guarantees](https://resourcera.readthedocs.io/en/latest/guide/coordination/). Platform-specific
131
+ accelerator capabilities and their limitations are described in the
132
+ [accelerator guide](https://resourcera.readthedocs.io/en/latest/guide/accelerators/).
133
+
134
+ ## Agent skills
135
+
136
+ The repository includes two optional [Agent Skills](https://github.com/smuniharish/resourcera/tree/main/skills):
137
+ `resourcera` for using the public API safely, and `resourcera-provider` for
138
+ building isolated accelerator providers. They are instructions for compatible
139
+ coding agents, not runtime dependencies. See the
140
+ [installation guide](https://resourcera.readthedocs.io/en/latest/agent-skills/install/).
141
+
142
+ ## Project
143
+
144
+ - [Documentation](https://resourcera.readthedocs.io/) and [examples](https://github.com/smuniharish/resourcera/tree/main/examples)
145
+ - [Contributing](https://github.com/smuniharish/resourcera/blob/main/CONTRIBUTING.md),
146
+ [security](https://github.com/smuniharish/resourcera/blob/main/SECURITY.md), and
147
+ [changelog](https://github.com/smuniharish/resourcera/blob/main/CHANGELOG.md)
148
+ - Licensed under the [Apache License 2.0](https://github.com/smuniharish/resourcera/blob/main/LICENSE)