Metadata-Version: 2.4
Name: scitex-resource
Version: 0.1.0
Summary: System resource info, processor usage logging, RAM limit — standalone module from the SciTeX ecosystem
Author-email: Yusuke Watanabe <ywatanabe@scitex.ai>
License-Expression: AGPL-3.0-only
Project-URL: Homepage, https://github.com/ywatanabe1989/scitex-resource
Project-URL: Repository, https://github.com/ywatanabe1989/scitex-resource
Project-URL: Documentation, https://scitex-resource.readthedocs.io
Keywords: scitex,resource,psutil,system-info,ram-limit
Classifier: Development Status :: 3 - Alpha
Classifier: Operating System :: POSIX
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: System :: Monitoring
Classifier: Topic :: System :: Hardware
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pandas
Requires-Dist: psutil
Requires-Dist: PyYAML
Requires-Dist: matplotlib
Provides-Extra: sh
Requires-Dist: scitex-sh>=0.1.0; extra == "sh"
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Provides-Extra: docs
Requires-Dist: sphinx>=7.0; extra == "docs"
Requires-Dist: sphinx-rtd-theme>=2.0; extra == "docs"
Requires-Dist: myst-parser>=2.0; extra == "docs"
Requires-Dist: sphinx-copybutton>=0.5; extra == "docs"
Requires-Dist: sphinx-autodoc-typehints>=1.25; extra == "docs"
Provides-Extra: all
Requires-Dist: scitex-resource[dev,docs,sh]; extra == "all"
Dynamic: license-file

# scitex-resource

System resource info, processor usage logging, and RAM limiting helpers, extracted from the [SciTeX](https://github.com/ywatanabe1989/scitex-python) ecosystem as a standalone package.

## Install

```bash
pip install scitex-resource
```

## API

```python
import scitex_resource as r

# Snapshot of CPU / RAM / disk / GPU / monitor info
specs = r.get_specs()

# CPU/RAM samples (one-shot)
usage = r.get_processor_usages()

# Continuous logging (CSV)
r.log_processor_usages("/tmp/usage.csv", limit_min=30, interval_s=1)

# Cap process RAM
r.limit_ram(0.5)
```

## Status

Standalone fork of `scitex.resource`. Deps: pandas, psutil, PyYAML, matplotlib.

Decoupling notes:
- `scitex.str.readable_bytes` / `scitex.gen.fmt_size` / `scitex.str.printc` →
  vendored as 3 small helpers in `_compat.py`.
- `scitex.io._load.load` / `scitex.io._save.save` → use `pandas.read_csv` /
  `to_csv` directly for the CSV log files; defer to scitex.io only if a
  non-CSV path is requested (raises ImportError without scitex installed).
- `scitex.sh.sh` → prefer `scitex_sh` if installed, fall back to plain
  `subprocess.run` (list-only).
- `scitex.session.start/close` `__main__` block → simplified to plain `main()`.

The umbrella package's `scitex.resource` import path is preserved via a
`sys.modules`-alias bridge. 65/65 tests pass.

## License

AGPL-3.0-only (see [LICENSE](./LICENSE)).
