Name | luxos JSON |
Version |
0.2.4
JSON |
| download |
home_page | None |
Summary | The all encompassing LuxOS python library. |
upload_time | 2024-10-18 11:39:40 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | MIT |
keywords |
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# LuxOS Tools Repository
[](https://pypi.org/project/luxos)
[](https://pypi.org/project/luxos)
[](https://spdx.org/licenses/)
[](https://github.com/LuxorLabs/luxos/actions/runs/0)

[](https://mypy-lang.org/)
[](https://github.com/astral-sh/ruff)
This package contains the `luxos` python package: a collection of scripts and api to operate miners running LuxOS. See the
full documentation [here](https://luxorlabs.github.io/luxos-tooling).
## Install
To install the latest version:
```bash
$> pip install -U luxos
# to install the extra features
$> pip install -U luxos[extra]
```
You can check the version:
```bash
python -c "import luxos.version; print(luxos.version.get_version())"
py[3.13.0rc2], luxos[0.2.4, 08cc733ce]
```
## Api usage
[luxos](https://pypi.org/project/luxos) provides an API in both sync and async
version: [full documentation here](https://luxorlabs.github.io/luxos-tooling).
### rexec/validate
The [luxos](https://pypi.org/project/luxos) has an extremely simple api.
For example to retrive the version info from a miner:
```
import asyncio
from luxos.asyncops import rexec, validate
# for a miner at 127.0.0.1 listening to port 4028 (the default)
res = await rexec("127.0.0.1", 4028, "version")
print(validate(res, "VERSION", 1, 1))
{'API': '3.7', 'CompileTime': 'Tue Sep 17 17:49:18 UTC 2024', 'LUXminer': '2024.9.17.174900-4631c4d1', 'Miner': '2024.9.17.174900', 'Type': 'Antminer S19'}
```
> **NOTE** The above should be executed using `python3 -m asyncio` instead `python3`.
For a syncronous version (eg. not using asyncio):
```
import asyncio
from luxos.syncops import rexec, validate
res = rexec("127.0.0.1", 4028, "version")
print(validate(res, "VERSION", 1, 1)) # validate makes sure you the correct message and returns one dictionary
```
Yes, it only needs to import `luxos.syncops` instead `luxos.asyncops`, the api is similar (minus the async/await).
> **NOTE** the [rexec](https://luxorlabs.github.io/luxos-tooling/api/luxos.asyncops.html#luxos.asyncops.rexec) function supports also
timeouts and retry.
> The [validate](https://luxorlabs.github.io/luxos-tooling/api/luxos.asyncops.html#luxos.asyncops.validate) check the result.
### launch
The [launch](https://luxorlabs.github.io/luxos-tooling/api/luxos.utils.html#luxos.utils.launch) command can launch an arbitrary function
across many miners leveraging asyncio for performance.
```
from luxos import utils, ips
# we'll execute and return the "version" command on miners
async def version(host, port):
res = await utils.rexec(host, port, "version")
return utils.validate(res, "VERSION", 1, 1)
# load miners ip addresses from a csv file
addresses = addresses = ips.load_ips_from_csv("miners.csv")
# run 50 version function in parallel
print(await utils.launch(addresses, version, batch=50))
[{'API': '3.7', 'CompileTime': 'Tue Sep 17 17:49:18 UTC 2024', 'LUXminer': '2024.9.17.174900-4631c4d1', 'Miner': '2024.9.17.174900', 'Type': 'Antminer S19'}]
```
## Scripting
[luxos](https://pypi.org/project/luxos) comes with some helper
scripts, to ease everyday miners' maintenance.
### luxos (cli)
This will launch the version command on a miner, returning the json output:
```shell
luxos --range 127.0.0.1 --quiet --json --cmd version
```
The `--range` flag can tak as argument:
* a single ip address `--range 127.0.0.1`
* a range like `--range 127.0.0.1-127.0.0.5`
* or addresses from a file `--range @miners.csv`.
Other examples:
```shell
# set/unset ATM
luxos --range 127.0.0.1 --quiet --json --cmd atmset --params "enabled=true"
# add a new profile
luxos --range 127.0.0.1 --quiet --json --cmd profilenew --params "myprofile,700,14.8"
```
### luxos-run (cli)
The `luxos-run` allow to "*run*" a scriptlet on miners.
A scriptlet is a a python file such as `my-script.py` looking like this:
```python
from luxos import asyncops
async def main(host: str, port: int):
res = await asyncops.rexec(host, port, "version")
return asyncops.validate(host, port, res, "VERSION")[0]
```
The `main` entry point is an async function, taking **host**, **ip** parameter: they
can execute more complex operations on a set of miners specified with the
`--range` flag, in the same way the `luxos` cli script does.
This will run `my-script.py` and report the results in json:
```shell
luxos-run --range 127.0.0.1 my-script.py
```
## LuxOS HealthChecker - health_checker.py
The HealthChecker script is designed to continuously pull miner data from LuxOS, providing valuable insights into the health of your mining machines.
You can customize the HealthChecker params using the `config.yaml` file provided.
To run the HealthChecker you can use `health-checker` if you installed using pip, or
the cli `python3 -m luxos.scripts.health_checker`.
---
Feel free to explore and customize these tools to suit your specific needs.
If you encounter any issues or have suggestions for improvement, please open an issue or submit a pull request.
You can find LuxOS API documentation [here](https://docs.luxor.tech/firmware/api/intro).
Raw data
{
"_id": null,
"home_page": null,
"name": "luxos",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": null,
"author": null,
"author_email": "Antonio Cavallo <antonio.cavallo@luxor.tech>",
"download_url": "https://files.pythonhosted.org/packages/f5/9b/e9203422b871521685d7675e9d0823fa3292be9a1c3b77715f3c3d3510a7/luxos-0.2.4.tar.gz",
"platform": null,
"description": "# LuxOS Tools Repository\n\n[](https://pypi.org/project/luxos)\n[](https://pypi.org/project/luxos)\n[](https://spdx.org/licenses/)\n[](https://github.com/LuxorLabs/luxos/actions/runs/0)\n\n[](https://mypy-lang.org/)\n[](https://github.com/astral-sh/ruff)\n\nThis package contains the `luxos` python package: a collection of scripts and api to operate miners running LuxOS. See the\nfull documentation [here](https://luxorlabs.github.io/luxos-tooling).\n\n## Install\n\nTo install the latest version:\n```bash\n $> pip install -U luxos\n\n # to install the extra features\n $> pip install -U luxos[extra]\n```\n\nYou can check the version:\n```bash\npython -c \"import luxos.version; print(luxos.version.get_version())\"\npy[3.13.0rc2], luxos[0.2.4, 08cc733ce]\n```\n\n## Api usage\n\n[luxos](https://pypi.org/project/luxos) provides an API in both sync and async \nversion: [full documentation here](https://luxorlabs.github.io/luxos-tooling).\n\n### rexec/validate\n\nThe [luxos](https://pypi.org/project/luxos) has an extremely simple api.\n\nFor example to retrive the version info from a miner:\n```\nimport asyncio\nfrom luxos.asyncops import rexec, validate\n\n# for a miner at 127.0.0.1 listening to port 4028 (the default)\nres = await rexec(\"127.0.0.1\", 4028, \"version\")\nprint(validate(res, \"VERSION\", 1, 1))\n\n{'API': '3.7', 'CompileTime': 'Tue Sep 17 17:49:18 UTC 2024', 'LUXminer': '2024.9.17.174900-4631c4d1', 'Miner': '2024.9.17.174900', 'Type': 'Antminer S19'}\n```\n> **NOTE** The above should be executed using `python3 -m asyncio` instead `python3`.\n\nFor a syncronous version (eg. not using asyncio):\n```\nimport asyncio\nfrom luxos.syncops import rexec, validate\nres = rexec(\"127.0.0.1\", 4028, \"version\")\nprint(validate(res, \"VERSION\", 1, 1)) # validate makes sure you the correct message and returns one dictionary\n```\nYes, it only needs to import `luxos.syncops` instead `luxos.asyncops`, the api is similar (minus the async/await).\n\n> **NOTE** the [rexec](https://luxorlabs.github.io/luxos-tooling/api/luxos.asyncops.html#luxos.asyncops.rexec) function supports also\ntimeouts and retry.\n> The [validate](https://luxorlabs.github.io/luxos-tooling/api/luxos.asyncops.html#luxos.asyncops.validate) check the result.\n\n### launch\n\nThe [launch](https://luxorlabs.github.io/luxos-tooling/api/luxos.utils.html#luxos.utils.launch) command can launch an arbitrary function\nacross many miners leveraging asyncio for performance.\n\n```\nfrom luxos import utils, ips\n\n# we'll execute and return the \"version\" command on miners\nasync def version(host, port):\n res = await utils.rexec(host, port, \"version\")\n return utils.validate(res, \"VERSION\", 1, 1)\n\n# load miners ip addresses from a csv file\naddresses = addresses = ips.load_ips_from_csv(\"miners.csv\")\n\n# run 50 version function in parallel\nprint(await utils.launch(addresses, version, batch=50))\n[{'API': '3.7', 'CompileTime': 'Tue Sep 17 17:49:18 UTC 2024', 'LUXminer': '2024.9.17.174900-4631c4d1', 'Miner': '2024.9.17.174900', 'Type': 'Antminer S19'}]\n```\n\n## Scripting\n\n[luxos](https://pypi.org/project/luxos) comes with some helper\nscripts, to ease everyday miners' maintenance.\n\n### luxos (cli)\n\nThis will launch the version command on a miner, returning the json output:\n```shell\nluxos --range 127.0.0.1 --quiet --json --cmd version \n```\nThe `--range` flag can tak as argument:\n* a single ip address `--range 127.0.0.1`\n* a range like `--range 127.0.0.1-127.0.0.5` \n* or addresses from a file `--range @miners.csv`.\n\nOther examples:\n\n```shell\n# set/unset ATM\nluxos --range 127.0.0.1 --quiet --json --cmd atmset --params \"enabled=true\"\n\n# add a new profile\nluxos --range 127.0.0.1 --quiet --json --cmd profilenew --params \"myprofile,700,14.8\"\n```\n\n### luxos-run (cli)\nThe `luxos-run` allow to \"*run*\" a scriptlet on miners.\n\nA scriptlet is a a python file such as `my-script.py` looking like this:\n```python\nfrom luxos import asyncops\nasync def main(host: str, port: int):\n res = await asyncops.rexec(host, port, \"version\")\n return asyncops.validate(host, port, res, \"VERSION\")[0]\n```\nThe `main` entry point is an async function, taking **host**, **ip** parameter: they\ncan execute more complex operations on a set of miners specified with the\n`--range` flag, in the same way the `luxos` cli script does.\n\nThis will run `my-script.py` and report the results in json:\n```shell\nluxos-run --range 127.0.0.1 my-script.py\n```\n\n## LuxOS HealthChecker - health_checker.py\n\nThe HealthChecker script is designed to continuously pull miner data from LuxOS, providing valuable insights into the health of your mining machines.\n\nYou can customize the HealthChecker params using the `config.yaml` file provided. \nTo run the HealthChecker you can use `health-checker` if you installed using pip, or\nthe cli `python3 -m luxos.scripts.health_checker`.\n\n---\n\nFeel free to explore and customize these tools to suit your specific needs. \nIf you encounter any issues or have suggestions for improvement, please open an issue or submit a pull request.\n\nYou can find LuxOS API documentation [here](https://docs.luxor.tech/firmware/api/intro).\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "The all encompassing LuxOS python library.",
"version": "0.2.4",
"project_urls": {
"Documentation": "https://luxorlabs.github.io/luxos-tooling",
"Issues": "https://github.com/LuxorLabs/firmware-biz-tools/issues",
"Source": "https://github.com/LuxorLabs/firmware-biz-tools"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "25dcebc8755e25687f972ef8067b7f58a9202d2c435eb8df3ffdfbac9e6759ba",
"md5": "6d160f1e49bdb4ec84b0124426109661",
"sha256": "727da9593b7f5d40afe28576e30433f57187cc3c7bf9ee6287c87aed19d54254"
},
"downloads": -1,
"filename": "luxos-0.2.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6d160f1e49bdb4ec84b0124426109661",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 38096,
"upload_time": "2024-10-18T11:39:37",
"upload_time_iso_8601": "2024-10-18T11:39:37.350070Z",
"url": "https://files.pythonhosted.org/packages/25/dc/ebc8755e25687f972ef8067b7f58a9202d2c435eb8df3ffdfbac9e6759ba/luxos-0.2.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f59be9203422b871521685d7675e9d0823fa3292be9a1c3b77715f3c3d3510a7",
"md5": "0f70c76c795fdd6fa1a95f343095cbc0",
"sha256": "348d9e55029780c894d5bd819bf182a72290151716428e38f6b77d957e85dec8"
},
"downloads": -1,
"filename": "luxos-0.2.4.tar.gz",
"has_sig": false,
"md5_digest": "0f70c76c795fdd6fa1a95f343095cbc0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 42152,
"upload_time": "2024-10-18T11:39:40",
"upload_time_iso_8601": "2024-10-18T11:39:40.618606Z",
"url": "https://files.pythonhosted.org/packages/f5/9b/e9203422b871521685d7675e9d0823fa3292be9a1c3b77715f3c3d3510a7/luxos-0.2.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-18 11:39:40",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "LuxorLabs",
"github_project": "firmware-biz-tools",
"github_not_found": true,
"lcname": "luxos"
}