nerva-py 1.0.1__tar.gz → 1.1.1__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.
@@ -13,11 +13,11 @@ jobs:
13
13
  publish:
14
14
  runs-on: ubuntu-latest
15
15
  steps:
16
- - uses: actions/checkout@v4
16
+ - uses: actions/checkout@v5
17
17
  - name: Install uv
18
- uses: astral-sh/setup-uv@v3
18
+ uses: astral-sh/setup-uv@v7
19
19
  with:
20
- version: "0.4.22"
20
+ version: "0.9.28"
21
21
  enable-cache: true
22
22
  - name: Set up Python
23
23
  uses: actions/setup-python@v5
@@ -9,11 +9,11 @@ jobs:
9
9
  publish:
10
10
  runs-on: ubuntu-latest
11
11
  steps:
12
- - uses: actions/checkout@v4
12
+ - uses: actions/checkout@v5
13
13
  - name: Install uv
14
- uses: astral-sh/setup-uv@v3
14
+ uses: astral-sh/setup-uv@v7
15
15
  with:
16
- version: "0.4.22"
16
+ version: "0.9.28"
17
17
  enable-cache: true
18
18
  - name: Set up Python
19
19
  uses: actions/setup-python@v5
@@ -13,15 +13,15 @@ jobs:
13
13
  ruff:
14
14
  runs-on: ubuntu-latest
15
15
  steps:
16
- - uses: actions/checkout@v4
16
+ - uses: actions/checkout@v5
17
17
  - name: Set up Python
18
- uses: actions/setup-python@v5
18
+ uses: actions/setup-python@v6
19
19
  with:
20
20
  python-version-file: ".python-version"
21
21
  - name: Install dependencies
22
22
  run: |
23
23
  python -m pip install --upgrade pip
24
- pip install ruff
24
+ pip install ruff==0.14.14
25
25
  - name: Lint
26
26
  run: ruff check --select I --no-fix .
27
27
  - name: Format
@@ -1,6 +1,6 @@
1
1
  repos:
2
2
  - repo: https://github.com/astral-sh/ruff-pre-commit
3
- rev: v0.6.9
3
+ rev: v0.14.14
4
4
  hooks:
5
5
  - id: ruff
6
6
  - id: ruff-format
@@ -0,0 +1,26 @@
1
+ env:
2
+ uv venv
3
+
4
+ rmenv:
5
+ rm -rf .venv
6
+
7
+ install: install-prod
8
+
9
+ install-dev:
10
+ uv sync --all-extras
11
+
12
+ install-prod:
13
+ uv sync --all-extras --no-dev
14
+
15
+ build:
16
+ uv build
17
+
18
+ publish:
19
+ uv publish --token $(token)
20
+
21
+ format:
22
+ ruff check --select I --fix .
23
+ ruff format .
24
+
25
+ .PHONY: env rmenv install install-dev install-prod build publish format
26
+ .DEFAULT_GOAL := build
@@ -1,7 +1,7 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: nerva-py
3
- Version: 1.0.1
4
- Summary: Python bindings for the JSON RPC interface of the Nerva cryptocurrency.
3
+ Version: 1.1.1
4
+ Summary: Python bindings for the JSON RPC interface of the Nerva (XNV) cryptocurrency.
5
5
  Author-email: Sayan Bhattacharyya <sayan@sn1f3rt.dev>
6
6
  License-Expression: MIT
7
7
  License-File: LICENSE
@@ -18,15 +18,14 @@ Classifier: Programming Language :: Python :: 3.11
18
18
  Classifier: Programming Language :: Python :: 3.12
19
19
  Classifier: Programming Language :: Python :: 3.13
20
20
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
- Requires-Python: >=3.8
22
- Requires-Dist: aiohttp>=3.10.10
21
+ Requires-Python: >=3.10
22
+ Requires-Dist: httpx==0.28.1
23
23
  Description-Content-Type: text/markdown
24
24
 
25
- # Nerva Python Library
25
+ # Nerva (XNV) Python Library
26
26
 
27
- [![Ruff](https://github.com/Sn1F3rt/nerva-py/actions/workflows/ruff.yml/badge.svg)](https://github.com/Sn1F3rt/nerva-py/actions/workflows/ruff.yml)
28
- [![Build](https://github.com/Sn1F3rt/nerva-py/actions/workflows/build.yml/badge.svg)](https://github.com/Sn1F3rt/nerva-py/actions/workflows/build.yml)
29
- [![License](https://img.shields.io/github/license/Sn1F3rt/nerva-py)](LICENSE)
27
+ [![Ruff](https://github.com/sn1f3rt/nerva-py/actions/workflows/ruff.yml/badge.svg)](https://github.com/sn1f3rt/nerva-py/actions/workflows/ruff.yml)
28
+ [![Build](https://github.com/sn1f3rt/nerva-py/actions/workflows/build.yml/badge.svg)](https://github.com/sn1f3rt/nerva-py/actions/workflows/build.yml)
30
29
 
31
30
  ## Table of Contents
32
31
 
@@ -40,13 +39,13 @@ Description-Content-Type: text/markdown
40
39
 
41
40
  ## About
42
41
 
43
- Python bindings for the JSON RPC interface of the Nerva cryptocurrency.
42
+ Python bindings for the JSON RPC interface of the [Nerva (XNV)](https://nerva.one/) cryptocurrency.
44
43
 
45
44
  ## Installation
46
45
 
47
46
  ### Requirements
48
47
 
49
- - Python 3.8+
48
+ - Python 3.10+
50
49
  - [`uv`](https://docs.astral.sh/uv/) (for development only)
51
50
 
52
51
  ### Setup
@@ -70,12 +69,16 @@ Here is a simple example to get you started:
70
69
  ```python
71
70
  import asyncio
72
71
 
73
- from nerva.daemon import DaemonJSONRPC
72
+ from nerva.daemon import Daemon
74
73
 
75
74
 
76
75
  async def main():
77
- daemon = DaemonJSONRPC(
78
- host="x.y.z.w",
76
+ daemon = Daemon(
77
+ host="localhost",
78
+ port=17566,
79
+ ssl=False,
80
+ username="rpcuser", # omit if daemon was not started with the rpc-login flag
81
+ password="rpcpassword" # omit if daemon was not started with the rpc-login flag
79
82
  )
80
83
 
81
84
  print(await daemon.get_info())
@@ -86,11 +89,11 @@ asyncio.run(main())
86
89
 
87
90
  ## Support
88
91
 
89
- - [Issues](https://github.com/Sn1F3rt/nerva-py/issues)
92
+ - [Issues](https://github.com/sn1f3rt/nerva-py/issues)
90
93
  - [Discord](https://discord.gg/ufysfvcFwe) - `Development > #nerva-py`
91
94
 
92
95
  ## License
93
96
 
94
- [MIT License](LICENSE)
97
+ [![License](https://img.shields.io/github/license/sn1f3rt/nerva-py)](LICENSE)
95
98
 
96
- Copyright &copy; 2024 [Sayan "Sn1F3rt" Bhattacharyya](https://sn1f3rt.dev)
99
+ Copyright &copy; 2024-present [Sayan "sn1f3rt" Bhattacharyya](https://sn1f3rt.dev)
@@ -1,8 +1,7 @@
1
- # Nerva Python Library
1
+ # Nerva (XNV) Python Library
2
2
 
3
- [![Ruff](https://github.com/Sn1F3rt/nerva-py/actions/workflows/ruff.yml/badge.svg)](https://github.com/Sn1F3rt/nerva-py/actions/workflows/ruff.yml)
4
- [![Build](https://github.com/Sn1F3rt/nerva-py/actions/workflows/build.yml/badge.svg)](https://github.com/Sn1F3rt/nerva-py/actions/workflows/build.yml)
5
- [![License](https://img.shields.io/github/license/Sn1F3rt/nerva-py)](LICENSE)
3
+ [![Ruff](https://github.com/sn1f3rt/nerva-py/actions/workflows/ruff.yml/badge.svg)](https://github.com/sn1f3rt/nerva-py/actions/workflows/ruff.yml)
4
+ [![Build](https://github.com/sn1f3rt/nerva-py/actions/workflows/build.yml/badge.svg)](https://github.com/sn1f3rt/nerva-py/actions/workflows/build.yml)
6
5
 
7
6
  ## Table of Contents
8
7
 
@@ -16,13 +15,13 @@
16
15
 
17
16
  ## About
18
17
 
19
- Python bindings for the JSON RPC interface of the Nerva cryptocurrency.
18
+ Python bindings for the JSON RPC interface of the [Nerva (XNV)](https://nerva.one/) cryptocurrency.
20
19
 
21
20
  ## Installation
22
21
 
23
22
  ### Requirements
24
23
 
25
- - Python 3.8+
24
+ - Python 3.10+
26
25
  - [`uv`](https://docs.astral.sh/uv/) (for development only)
27
26
 
28
27
  ### Setup
@@ -46,12 +45,16 @@ Here is a simple example to get you started:
46
45
  ```python
47
46
  import asyncio
48
47
 
49
- from nerva.daemon import DaemonJSONRPC
48
+ from nerva.daemon import Daemon
50
49
 
51
50
 
52
51
  async def main():
53
- daemon = DaemonJSONRPC(
54
- host="x.y.z.w",
52
+ daemon = Daemon(
53
+ host="localhost",
54
+ port=17566,
55
+ ssl=False,
56
+ username="rpcuser", # omit if daemon was not started with the rpc-login flag
57
+ password="rpcpassword" # omit if daemon was not started with the rpc-login flag
55
58
  )
56
59
 
57
60
  print(await daemon.get_info())
@@ -62,11 +65,11 @@ asyncio.run(main())
62
65
 
63
66
  ## Support
64
67
 
65
- - [Issues](https://github.com/Sn1F3rt/nerva-py/issues)
68
+ - [Issues](https://github.com/sn1f3rt/nerva-py/issues)
66
69
  - [Discord](https://discord.gg/ufysfvcFwe) - `Development > #nerva-py`
67
70
 
68
71
  ## License
69
72
 
70
- [MIT License](LICENSE)
73
+ [![License](https://img.shields.io/github/license/sn1f3rt/nerva-py)](LICENSE)
71
74
 
72
- Copyright &copy; 2024 [Sayan "Sn1F3rt" Bhattacharyya](https://sn1f3rt.dev)
75
+ Copyright &copy; 2024-present [Sayan "sn1f3rt" Bhattacharyya](https://sn1f3rt.dev)
@@ -37,7 +37,7 @@ class VersionInfo(NamedTuple):
37
37
 
38
38
 
39
39
  version_info: VersionInfo = VersionInfo(
40
- major=1, minor=0, micro=1, releaselevel="final", serial=0
40
+ major=1, minor=1, micro=1, releaselevel="final", serial=0
41
41
  )
42
42
 
43
43
  __version__ = str(version_info)
@@ -2,7 +2,7 @@ import sys
2
2
  import argparse
3
3
  import platform
4
4
 
5
- import aiohttp
5
+ import httpx
6
6
 
7
7
  import nerva
8
8
 
@@ -18,7 +18,7 @@ def show_version() -> None:
18
18
 
19
19
  entries.append(f"- nerva-py v{nerva.__version__}")
20
20
 
21
- entries.append(f"- aiohttp v{aiohttp.__version__}")
21
+ entries.append(f"- httpx v{httpx.__version__}")
22
22
 
23
23
  uname = platform.uname()
24
24
  entries.append(f"- System Info: {uname.system} {uname.release} {uname.version}")
@@ -2,12 +2,12 @@ from __future__ import annotations
2
2
 
3
3
  from typing import Any, Dict, List, Optional
4
4
 
5
- import aiohttp
5
+ import httpx
6
6
 
7
- __all__ = ["DaemonRPC", "DaemonLegacy"]
7
+ __all__ = ["Daemon", "DaemonLegacy"]
8
8
 
9
9
 
10
- class DaemonRPC:
10
+ class Daemon:
11
11
  """
12
12
  A class to interact with the Nerva daemon's JSON-RPC interface.
13
13
 
@@ -32,7 +32,7 @@ class DaemonRPC:
32
32
  The headers for the request.
33
33
  """
34
34
 
35
- __slots__ = ["url", "timeout", "headers"]
35
+ __slots__ = ["url", "timeout", "headers", "auth"]
36
36
 
37
37
  def __init__(
38
38
  self,
@@ -40,20 +40,26 @@ class DaemonRPC:
40
40
  port: Optional[int] = 17566,
41
41
  ssl: Optional[bool] = False,
42
42
  timeout: Optional[float] = 10.0,
43
+ username: Optional[str] = None,
44
+ password: Optional[str] = None,
43
45
  ) -> None:
44
46
  self.url: str = f"{'https' if ssl else 'http'}://{host}:{port}"
45
47
  self.timeout: float = timeout
46
48
  self.headers: Dict[str, str] = {"Content-Type": "application/json"}
49
+ self.auth: Optional[httpx.DigestAuth] = (
50
+ httpx.DigestAuth(username, password) if username and password else None
51
+ )
47
52
 
48
53
  async def _request(self, method: str, params: Dict[str, Any]) -> Dict[str, Any]:
49
- async with aiohttp.ClientSession() as session:
50
- async with session.post(
54
+ async with httpx.AsyncClient() as client:
55
+ response = await client.post(
51
56
  f"{self.url}/json_rpc",
52
57
  json={"jsonrpc": "2.0", "id": 0, "method": method, "params": params},
53
58
  headers=self.headers,
54
59
  timeout=self.timeout,
55
- ) as response:
56
- return await response.json(content_type=None)
60
+ auth=self.auth,
61
+ )
62
+ return response.json()
57
63
 
58
64
  async def get_block_count(self) -> Dict[str, Any]:
59
65
  """
@@ -660,7 +666,7 @@ class DaemonLegacy:
660
666
 
661
667
  """
662
668
 
663
- __slots__ = ["url", "timeout", "headers"]
669
+ __slots__ = ["url", "timeout", "headers", "auth"]
664
670
 
665
671
  def __init__(
666
672
  self,
@@ -668,23 +674,28 @@ class DaemonLegacy:
668
674
  port: Optional[int] = 17566,
669
675
  ssl: Optional[bool] = False,
670
676
  timeout: Optional[float] = 10.0,
677
+ username: Optional[str] = None,
678
+ password: Optional[str] = None,
671
679
  ):
672
680
  self.url = f"{'https' if ssl else 'http'}://{host}:{port}"
673
681
  self.timeout = timeout
674
-
675
682
  self.headers = {"Content-Type": "application/json"}
683
+ self.auth = (
684
+ httpx.DigestAuth(username, password) if username and password else None
685
+ )
676
686
 
677
687
  async def _request(
678
688
  self, endpoint: str, params: Dict[str, Any]
679
689
  ) -> Dict[str, Any]:
680
- async with aiohttp.ClientSession() as session:
681
- async with session.post(
690
+ async with httpx.AsyncClient() as client:
691
+ response = await client.post(
682
692
  f"{self.url}/{endpoint}",
683
693
  json=params,
684
694
  headers=self.headers,
685
695
  timeout=self.timeout,
686
- ) as response:
687
- return await response.json(content_type=None)
696
+ auth=self.auth,
697
+ )
698
+ return response.json()
688
699
 
689
700
  async def get_height(self) -> Dict[str, Any]:
690
701
  """
@@ -2,7 +2,7 @@ from __future__ import annotations
2
2
 
3
3
  from typing import Any, Dict, List, Optional
4
4
 
5
- import aiohttp
5
+ import httpx
6
6
 
7
7
  __all__ = ["Wallet"]
8
8
 
@@ -56,23 +56,22 @@ class Wallet:
56
56
  password: str = "",
57
57
  ) -> None:
58
58
  self.url: str = f"http{'s' if ssl else ''}://{host}:{port}"
59
- self.auth: Optional[aiohttp.BasicAuth] = (
60
- aiohttp.BasicAuth(username, password) if username and password else None
61
- )
62
59
  self.timeout: float = timeout
63
-
64
60
  self.headers: Dict[str, str] = {"Content-Type": "application/json"}
61
+ self.auth: Optional[httpx.DigestAuth] = (
62
+ httpx.DigestAuth(username, password) if username and password else None
63
+ )
65
64
 
66
65
  async def _request(self, method: str, params: Dict[str, Any]) -> Dict[str, Any]:
67
- async with aiohttp.ClientSession() as session:
68
- async with session.post(
66
+ async with httpx.AsyncClient() as client:
67
+ response = await client.post(
69
68
  f"{self.url}/json_rpc",
70
69
  json={"jsonrpc": "2.0", "id": 0, "method": method, "params": params},
71
70
  headers=self.headers,
72
71
  auth=self.auth,
73
72
  timeout=self.timeout,
74
- ) as response:
75
- return await response.json(content_type=None)
73
+ )
74
+ return response.json()
76
75
 
77
76
  async def get_balance(
78
77
  self, account_index: int, address_indices: Optional[List[int]] = None
@@ -1,16 +1,16 @@
1
1
  [project]
2
2
  name = "nerva-py"
3
- version = "1.0.1"
4
- description = "Python bindings for the JSON RPC interface of the Nerva cryptocurrency."
3
+ version = "1.1.1"
4
+ description = "Python bindings for the JSON RPC interface of the Nerva (XNV) cryptocurrency."
5
5
  license = "MIT"
6
6
  authors = [
7
7
  { name="Sayan Bhattacharyya", email="sayan@sn1f3rt.dev" },
8
8
  ]
9
9
  readme = "README.md"
10
- requires-python = ">=3.8"
11
- homepage = "https://github.com/Sn1F3rt/nerva-py"
12
- repository = "https://github.com/Sn1F3rt/nerva-py"
13
- documentation = "https://github.com/Sn1F3rt/nerva-py?tab=readme-ov-file#documentation"
10
+ requires-python = ">=3.10"
11
+ homepage = "https://github.com/sn1f3rt/nerva-py"
12
+ repository = "https://github.com/sn1f3rt/nerva-py"
13
+ documentation = "https://github.com/sn1f3rt/nerva-py?tab=readme-ov-file#documentation"
14
14
  keywords = ["nerva", "cryptocurrency", "json-rpc", "bindings", "python"]
15
15
  classifiers = [
16
16
  "Development Status :: 5 - Production/Stable",
@@ -27,13 +27,13 @@ classifiers = [
27
27
  "Topic :: Software Development :: Libraries :: Python Modules",
28
28
  ]
29
29
  dependencies = [
30
- "aiohttp>=3.10.10",
30
+ "httpx==0.28.1",
31
31
  ]
32
32
 
33
- [tool.uv]
34
- dev-dependencies = [
35
- "pre-commit>=3.5.0",
36
- "ruff>=0.7.0",
33
+ [dependency-groups]
34
+ dev = [
35
+ "pre-commit==4.5.1",
36
+ "ruff==0.14.14",
37
37
  ]
38
38
 
39
39
  [tool.hatch.build.targets.wheel]