Compare commits

..

9 Commits

Author SHA1 Message Date
Upstream Data
bd9fd81b17 version: bump version number 2025-01-20 08:54:14 -07:00
Upstream Data
33803e89e2 feature: add support for Vnish S19i
Fixes: #279
2025-01-20 08:21:24 -07:00
Upstream Data
10a44b9877 bug: fix invlaid import in luxminer.py 2025-01-20 08:21:12 -07:00
pre-commit-ci[bot]
bbd883f639 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2025-01-19 08:18:27 -07:00
Wilfred Allyn
8e2ad478e9 refactor: simplify get_wattage_limit for luxos 2025-01-19 08:18:27 -07:00
Wilfred Allyn
957981a9c6 feature: get active preset from luxos 2025-01-19 08:18:27 -07:00
Wilfred Allyn
13a67dfdd1 feature: add _get_wattage_limit for luxos 2025-01-19 08:18:27 -07:00
Wilfred Allyn
e86f2b62c5 docs: fix issues for docs warnings 2025-01-18 08:03:11 -07:00
Wilfred Allyn
88b4d2cac3 docs: add instructions for building docs locally 2025-01-17 09:31:36 -07:00
12 changed files with 133 additions and 47 deletions

View File

@@ -1,7 +1,14 @@
ci:
skip:
- unittest
- poetry-lock
- pytest
repos:
- repo: https://github.com/python-poetry/poetry
rev: 2.0.1
hooks:
- id: poetry-check
- id: poetry-lock
- id: poetry-install
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:

View File

@@ -50,6 +50,13 @@ poetry install --with dev
pre-commit install
```
##### Building Documentation Locally
```
poetry install --with docs
python docs/generate_miners.py
poetry run mkdocs serve
```
---
## Getting started

24
poetry.lock generated
View File

@@ -1,4 +1,4 @@
# This file is automatically @generated by Poetry 2.0.0 and should not be changed by hand.
# This file is automatically @generated by Poetry 2.0.1 and should not be changed by hand.
[[package]]
name = "aiofiles"
@@ -457,14 +457,14 @@ dev = ["flake8", "markdown", "twine", "wheel"]
[[package]]
name = "griffe"
version = "1.5.4"
version = "1.5.5"
description = "Signatures for entire Python programs. Extract the structure, the frame, the skeleton of your project, to generate API documentation or find breaking changes in your API."
optional = false
python-versions = ">=3.9"
groups = ["docs"]
files = [
{file = "griffe-1.5.4-py3-none-any.whl", hash = "sha256:ed33af890586a5bebc842fcb919fc694b3dc1bc55b7d9e0228de41ce566b4a1d"},
{file = "griffe-1.5.4.tar.gz", hash = "sha256:073e78ad3e10c8378c2f798bd4ef87b92d8411e9916e157fd366a17cc4fd4e52"},
{file = "griffe-1.5.5-py3-none-any.whl", hash = "sha256:2761b1e8876c6f1f9ab1af274df93ea6bbadd65090de5f38f4cb5cc84897c7dd"},
{file = "griffe-1.5.5.tar.gz", hash = "sha256:35ee5b38b93d6a839098aad0f92207e6ad6b70c3e8866c08ca669275b8cba585"},
]
[package.dependencies]
@@ -846,14 +846,14 @@ pyyaml = ">=5.1"
[[package]]
name = "mkdocs-material"
version = "9.5.49"
version = "9.5.50"
description = "Documentation that simply works"
optional = false
python-versions = ">=3.8"
groups = ["docs"]
files = [
{file = "mkdocs_material-9.5.49-py3-none-any.whl", hash = "sha256:c3c2d8176b18198435d3a3e119011922f3e11424074645c24019c2dcf08a360e"},
{file = "mkdocs_material-9.5.49.tar.gz", hash = "sha256:3671bb282b4f53a1c72e08adbe04d2481a98f85fed392530051f80ff94a9621d"},
{file = "mkdocs_material-9.5.50-py3-none-any.whl", hash = "sha256:f24100f234741f4d423a9d672a909d859668a4f404796be3cf035f10d6050385"},
{file = "mkdocs_material-9.5.50.tar.gz", hash = "sha256:ae5fe16f3d7c9ccd05bb6916a7da7420cf99a9ce5e33debd9d40403a090d5825"},
]
[package.dependencies]
@@ -870,7 +870,7 @@ regex = ">=2022.4"
requests = ">=2.26,<3.0"
[package.extras]
git = ["mkdocs-git-committers-plugin-2 (>=1.1,<2.0)", "mkdocs-git-revision-date-localized-plugin (>=1.2.4,<2.0)"]
git = ["mkdocs-git-committers-plugin-2 (>=1.1,<3)", "mkdocs-git-revision-date-localized-plugin (>=1.2.4,<2.0)"]
imaging = ["cairosvg (>=2.6,<3.0)", "pillow (>=10.2,<11.0)"]
recommended = ["mkdocs-minify-plugin (>=0.7,<1.0)", "mkdocs-redirects (>=1.2,<2.0)", "mkdocs-rss-plugin (>=1.6,<2.0)"]
@@ -1674,14 +1674,14 @@ zstd = ["zstandard (>=0.18.0)"]
[[package]]
name = "virtualenv"
version = "20.28.1"
version = "20.29.1"
description = "Virtual Python Environment builder"
optional = false
python-versions = ">=3.8"
groups = ["dev"]
files = [
{file = "virtualenv-20.28.1-py3-none-any.whl", hash = "sha256:412773c85d4dab0409b83ec36f7a6499e72eaf08c80e81e9576bca61831c71cb"},
{file = "virtualenv-20.28.1.tar.gz", hash = "sha256:5d34ab240fdb5d21549b76f9e8ff3af28252f5499fb6d6f031adac4e5a8c5329"},
{file = "virtualenv-20.29.1-py3-none-any.whl", hash = "sha256:4e4cb403c0b0da39e13b46b1b2476e505cb0046b25f242bee80f62bf990b2779"},
{file = "virtualenv-20.29.1.tar.gz", hash = "sha256:b8b8970138d32fb606192cb97f6cd4bb644fa486be9308fb9b63f81091b5dc35"},
]
[package.dependencies]
@@ -1760,4 +1760,4 @@ type = ["pytest-mypy"]
[metadata]
lock-version = "2.1"
python-versions = "^3.9"
content-hash = "c0aa00dd5f3b52bbac53eb765be2bca2ec7f9429e835d6b2fe6bf207f2f39974"
content-hash = "a0d1e4d454da0d9d3c246a4f1047e804db5726c175071d95b7007e88689cdbf2"

View File

@@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and -
# limitations under the License. -
# ------------------------------------------------------------------------------
import importlib.metadata
from pyasic import settings
from pyasic.config import MinerConfig
from pyasic.data import MinerData
@@ -22,3 +24,5 @@ from pyasic.network import MinerNetwork
from pyasic.rpc import *
from pyasic.ssh import *
from pyasic.web import *
__version__ = importlib.metadata.version("pyasic")

View File

@@ -371,11 +371,7 @@ class MiningModePreset(MinerConfigValue):
def from_luxos(
cls, rpc_config: dict, rpc_profiles: list[dict]
) -> "MiningModePreset":
active_preset = None
active_profile = rpc_config["CONFIG"][0]["Profile"]
for profile in rpc_profiles["PROFILES"]:
if profile["Profile Name"] == active_profile:
active_preset = profile
active_preset = cls.get_active_preset_from_luxos(rpc_config, rpc_profiles)
return cls(
active_preset=MiningPreset.from_luxos(active_preset),
available_presets=[
@@ -383,6 +379,17 @@ class MiningModePreset(MinerConfigValue):
],
)
@classmethod
def get_active_preset_from_luxos(
cls, rpc_config: dict, rpc_profiles: list[dict]
) -> dict:
active_preset = None
active_profile = rpc_config["CONFIG"][0]["Profile"]
for profile in rpc_profiles["PROFILES"]:
if profile["Profile Name"] == active_profile:
active_preset = profile
return active_preset
class ManualBoardSettings(MinerConfigValue):
freq: float
@@ -705,7 +712,11 @@ class MiningModeConfig(MinerConfigOption):
@classmethod
def from_luxos(cls, rpc_config: dict, rpc_profiles: dict):
return MiningModePreset.from_luxos(rpc_config, rpc_profiles)
preset_info = MiningModePreset.from_luxos(rpc_config, rpc_profiles)
return cls.preset(
active_preset=preset_info.active_preset,
available_presets=preset_info.available_presets,
)
MiningMode = TypeVar(

View File

@@ -20,6 +20,7 @@ from pyasic.miners.device.models import (
S19XP,
S19a,
S19aPro,
S19i,
S19j,
S19jPro,
S19kPro,
@@ -53,6 +54,10 @@ class VNishS19aPro(VNish, S19aPro):
pass
class VNishS19i(VNish, S19i):
pass
class VNishS19j(VNish, S19j):
pass

View File

@@ -18,6 +18,7 @@ from .S19 import (
VNishS19,
VNishS19a,
VNishS19aPro,
VNishS19i,
VNishS19j,
VNishS19jPro,
VNishS19kPro,

View File

@@ -17,6 +17,7 @@ import logging
from typing import List, Optional
from pyasic.config import MinerConfig
from pyasic.config.mining import MiningModePreset
from pyasic.data import Fan, HashBoard
from pyasic.data.pools import PoolMetrics, PoolUrl
from pyasic.device.algorithm import AlgoHashRate
@@ -47,6 +48,13 @@ LUXMINER_DATA_LOC = DataLocations(
"_get_wattage",
[RPCAPICommand("rpc_power", "power")],
),
str(DataOptions.WATTAGE_LIMIT): DataFunction(
"_get_wattage_limit",
[
RPCAPICommand("rpc_config", "config"),
RPCAPICommand("rpc_profiles", "profiles"),
],
),
str(DataOptions.FANS): DataFunction(
"_get_fans",
[RPCAPICommand("rpc_fans", "fans")],
@@ -151,7 +159,7 @@ class LUXMiner(LuxOSFirmware):
bool: True if the firmware upgrade was successfully initiated, False otherwise.
"""
try:
await self.rpc.upgraderun()
await self.rpc.updaterun()
logging.info(f"{self.ip}: Firmware upgrade initiated successfully.")
return True
@@ -289,6 +297,17 @@ class LUXMiner(LuxOSFirmware):
except (LookupError, ValueError, TypeError):
pass
async def _get_wattage_limit(
self, rpc_config: dict = None, rpc_profiles: list[dict] = None
) -> Optional[int]:
try:
active_preset = MiningModePreset.get_active_preset_from_luxos(
rpc_config, rpc_profiles
)
return active_preset.power
except (LookupError, ValueError, TypeError):
pass
async def _get_fans(self, rpc_fans: dict = None) -> List[Fan]:
if rpc_fans is None:
try:

View File

@@ -559,6 +559,7 @@ MINER_CLASSES = {
"ANTMINER S19NOPIC": VNishS19NoPIC,
"ANTMINER S19 PRO": VNishS19Pro,
"ANTMINER S19J": VNishS19j,
"ANTMINER S19I": VNishS19j,
"ANTMINER S19J PRO": VNishS19jPro,
"ANTMINER S19J PRO A": VNishS19jPro,
"ANTMINER S19J PRO BB": VNishS19jPro,

View File

@@ -574,9 +574,6 @@ class LUXMinerRPCAPI(BaseMinerRPCAPI):
<details>
<summary>Expand</summary>
Parameters:
session_id: Session id from the logon command.
Returns:
Confirmation of logging off a session.
</details>
@@ -844,7 +841,7 @@ class LUXMinerRPCAPI(BaseMinerRPCAPI):
"""
return await self.send_privileged_command("voltageset", board_n, voltage)
async def upgraderun(self):
async def updaterun(self) -> dict:
"""
Send the 'updaterun' command to the miner.

View File

@@ -268,11 +268,11 @@ class AuradineWebAPI(BaseWebAPI):
"""
return await self.send_command("mode")
async def set_mode(self, **kwargs) -> dict:
async def set_mode(self, **kwargs: Any) -> dict:
"""Set the operational mode of the Auradine miner.
Args:
**kwargs: Mode settings specified as keyword arguments.
**kwargs (Any): Mode settings specified as keyword arguments.
Returns:
dict: A dictionary indicating the result of the mode setting operation.
@@ -287,11 +287,11 @@ class AuradineWebAPI(BaseWebAPI):
"""
return await self.send_command("network")
async def set_network(self, **kwargs) -> dict:
async def set_network(self, **kwargs: Any) -> dict:
"""Set the network configuration of the Auradine miner.
Args:
**kwargs: Network settings specified as keyword arguments.
**kwargs (Any): Network settings specified as keyword arguments.
Returns:
dict: A dictionary indicating the result of the network configuration.

View File

@@ -1,23 +1,57 @@
[tool.poetry]
[project]
name = "pyasic"
version = "0.69.2"
description = "A simplified and standardized interface for Bitcoin ASICs."
authors = ["UpstreamData <brett@upstreamdata.ca>"]
repository = "https://github.com/UpstreamData/pyasic"
documentation = "https://pyasic.readthedocs.io/en/latest/"
readme = "README.md"
version = "0.70.0"
[tool.poetry.dependencies]
python = "^3.9"
httpx = ">=0.26.0"
asyncssh = ">=2.17.0"
passlib = ">=1.7.4"
pyaml = ">=23.12.0"
tomli = { version = ">=2.0.1", python = "<3.11" }
tomli-w = "^1.0.0"
aiofiles = ">=23.2.1"
betterproto = "2.0.0b7"
pydantic = "^2.9.2"
description = "A simplified and standardized interface for Bitcoin ASICs."
authors = [{name = "UpstreamData", email = "brett@upstreamdata.ca"}]
repository = "https://github.com/UpstreamData/pyasic"
homepage = "https://docs.pyasic.org"
source = "https://github.com/UpstreamData/pyasic"
documentation = "https://docs.pyasic.org"
issues = "https://github.com/UpstreamData/pyasic/issues"
readme = {file = "README.md", content-type = "text/markdown"}
license = "Apache 2.0"
license-files = ["LICEN[CS]E.*"]
keywords = [
"python",
"asic",
"bitcoin",
"whatsminer",
"antminer",
"braiins-os",
"vnish",
"luxos"
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
requires-python = "^3.9"
dependencies = [
"httpx>=0.26.0",
"asyncssh>=2.17.0",
"passlib>=1.7.4",
"pyaml>=23.12.0",
"tomli (>=2.2.1,<3.0.0) ; python_version < '3.11'",
"tomli-w>=1.0.0",
"aiofiles>=23.2.1",
"betterproto==2.0.0b7",
"pydantic>=2.9.2",
]
[tool.poetry.group.dev]
optional = true
@@ -36,7 +70,7 @@ mkdocs-material = "^9.5.39"
[build-system]
requires = ["poetry-core>=1.0.0"]
requires = ["poetry-core>=2.0.0"]
build-backend = "poetry.core.masonry.api"
[tool.isort]