Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

LuxOS Tools Repository

PyPI version Python versions License - MIT Build PyPI - Downloads Mypy Ruff

This package contains the luxos python package: a collection of scripts and api to operate miners running LuxOS. See the full documentation here.

Install

To install the latest version:

   $> pip install -U luxos

   # to install the extra features
   $> pip install -U luxos[extra]

You can check the version:

python -c "import luxos.version; print(luxos.version.get_version())"
py[3.13.0rc2], luxos[0.2.4, 08cc733ce]

Api usage

luxos provides an API in both sync and async version: full documentation here.

rexec/validate

The 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 function supports also timeouts and retry. The validate check the result.

launch

The 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 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:

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:

# 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:

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:

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

luxos-0.2.5b63.tar.gz (42.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

luxos-0.2.5b63-py3-none-any.whl (38.1 kB view details)

Uploaded Python 3

File details

Details for the file luxos-0.2.5b63.tar.gz.

File metadata

  • Download URL: luxos-0.2.5b63.tar.gz
  • Upload date:
  • Size: 42.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for luxos-0.2.5b63.tar.gz
Algorithm Hash digest
SHA256 1fc13a5943d65b35834b4bf5eb7299e8ce8c1a3db7f2e30e99756aaffdcfa04d
MD5 08f232358d1a9090c6300421e3026734
BLAKE2b-256 01e4cbdd6a0734b92e03dd128ce8d2048995a15292497a91fec7b38ea0001068

See more details on using hashes here.

File details

Details for the file luxos-0.2.5b63-py3-none-any.whl.

File metadata

  • Download URL: luxos-0.2.5b63-py3-none-any.whl
  • Upload date:
  • Size: 38.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for luxos-0.2.5b63-py3-none-any.whl
Algorithm Hash digest
SHA256 80d31f317c96627ea5f368dfdc37060cb27111ea48beea9a3db59e5b8e7da2c0
MD5 215f32f825a5d5e218fd2df6a4e17767
BLAKE2b-256 f398cdd863390a287c60ebe2867deb0d9bfe41fd49de391479f9897df0657c8f

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.5b63 This release

2 files

0.2.4

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

0.0.9

2 files

0.0.8

2 files

0.0.7

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

0.0.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page