helius-python 0.0.1__tar.gz → 0.0.3__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.
@@ -169,7 +169,7 @@ Skeleton:
169
169
  import json
170
170
  import httpx
171
171
  import respx
172
- from helius import HeliusClient
172
+ from helius.client import HeliusClient
173
173
 
174
174
  @respx.mock
175
175
  def test_get_balance():
@@ -105,6 +105,12 @@ basedpyright src
105
105
  Make sure your change at least imports cleanly and the method you added
106
106
  actually works against a real Helius endpoint.
107
107
 
108
+ Run the test suite with the local `src` package on the import path:
109
+
110
+ ```bash
111
+ PYTHONPATH=src .venv/bin/pytest
112
+ ```
113
+
108
114
  ## Pull Requests
109
115
 
110
116
  - Keep PRs focused. One method, one bug fix, or one refactor per PR.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: helius-python
3
- Version: 0.0.1
3
+ Version: 0.0.3
4
4
  Summary: Typed Python client for the Helius API
5
5
  Project-URL: Homepage, https://github.com/markosnarinian/helius-python
6
6
  Project-URL: Issues, https://github.com/markosnarinian/helius-python/issues
@@ -10,6 +10,9 @@ License-File: LICENSE
10
10
  Classifier: Operating System :: OS Independent
11
11
  Classifier: Programming Language :: Python :: 3
12
12
  Requires-Python: >=3.9
13
+ Requires-Dist: httpx
14
+ Requires-Dist: pydantic
15
+ Requires-Dist: python-dotenv
13
16
  Provides-Extra: dev
14
17
  Requires-Dist: pytest; extra == 'dev'
15
18
  Requires-Dist: respx; extra == 'dev'
@@ -61,27 +64,42 @@ type checking.
61
64
  pip install helius-python
62
65
  ```
63
66
 
67
+ This installs the runtime dependencies automatically:
68
+
69
+ - `httpx` for HTTP transport
70
+ - `pydantic` for typed response models and argument validation
71
+ - `python-dotenv` for optional `.env` loading of `HELIUS_API_KEY`
72
+
73
+ You do not need to install these separately unless your environment disables
74
+ dependency installation.
75
+
64
76
  ## Authentication
65
77
 
66
78
  Pass your Helius API key explicitly:
67
79
 
68
80
  ```python
69
- from helius import HeliusClient
81
+ from helius.client import HeliusClient
70
82
 
71
83
  client = HeliusClient(api_key="YOUR_HELIUS_API_KEY")
72
84
  ```
73
85
 
74
- or set it in a `.env` file at the project root and let the client pick it up
75
- automatically:
86
+ or set `HELIUS_API_KEY` as an environment variable:
87
+
88
+ ```bash
89
+ export HELIUS_API_KEY=your_helius_api_key
90
+ ```
91
+
92
+ You can also set it in a `.env` file at the project root and let the client
93
+ pick it up automatically:
76
94
 
77
95
  ```env
78
96
  HELIUS_API_KEY=your_helius_api_key
79
97
  ```
80
98
 
81
99
  ```python
82
- from helius import HeliusClient
100
+ from helius.client import HeliusClient
83
101
 
84
- client = HeliusClient() # reads HELIUS_API_KEY from .env
102
+ client = HeliusClient() # reads HELIUS_API_KEY from the environment or .env
85
103
  ```
86
104
 
87
105
  ## Usage
@@ -89,7 +107,7 @@ client = HeliusClient() # reads HELIUS_API_KEY from .env
89
107
  ### As a context manager (recommended)
90
108
 
91
109
  ```python
92
- from helius import HeliusClient
110
+ from helius.client import HeliusClient
93
111
 
94
112
  with HeliusClient(api_key="YOUR_HELIUS_API_KEY") as client:
95
113
  balance = client.get_balance("So11111111111111111111111111111111111111112")
@@ -109,7 +127,7 @@ If a `with` block doesn't fit your code structure (e.g. the client lives on
109
127
  a long-lived object), call `close()` yourself when you're done:
110
128
 
111
129
  ```python
112
- from helius import HeliusClient
130
+ from helius.client import HeliusClient
113
131
 
114
132
  client = HeliusClient(api_key="YOUR_HELIUS_API_KEY")
115
133
  try:
@@ -133,7 +151,7 @@ instance is garbage-collected. Prefer `with` or `close()` regardless.
133
151
  | Argument | Default | Notes |
134
152
  | --------- | ------------------------------------ | --------------------------------------------------------------------------------------------- |
135
153
  | `base_url`| `"https://mainnet.helius-rpc.com"` | Override to point at devnet, staging, or a custom Helius endpoint. |
136
- | `api_key` | `None` → falls back to `HELIUS_API_KEY` in a `.env` file | If neither is provided, the constructor raises `ValueError`. |
154
+ | `api_key` | `None` → falls back to `HELIUS_API_KEY` from the environment, then `.env` | If none is provided, the constructor raises `ValueError`. |
137
155
 
138
156
  Per-method RPC parameters (`commitment`, `encoding`, `min_context_slot`, etc.)
139
157
  are left unset by default — the Helius/Solana server defaults apply unless you
@@ -207,7 +225,7 @@ docstring that is the source of truth for that symbol. You can read it
207
225
  straight from a REPL:
208
226
 
209
227
  ```python
210
- from helius import HeliusClient
228
+ from helius.client import HeliusClient
211
229
  help(HeliusClient.get_balance)
212
230
  ```
213
231
 
@@ -44,27 +44,42 @@ type checking.
44
44
  pip install helius-python
45
45
  ```
46
46
 
47
+ This installs the runtime dependencies automatically:
48
+
49
+ - `httpx` for HTTP transport
50
+ - `pydantic` for typed response models and argument validation
51
+ - `python-dotenv` for optional `.env` loading of `HELIUS_API_KEY`
52
+
53
+ You do not need to install these separately unless your environment disables
54
+ dependency installation.
55
+
47
56
  ## Authentication
48
57
 
49
58
  Pass your Helius API key explicitly:
50
59
 
51
60
  ```python
52
- from helius import HeliusClient
61
+ from helius.client import HeliusClient
53
62
 
54
63
  client = HeliusClient(api_key="YOUR_HELIUS_API_KEY")
55
64
  ```
56
65
 
57
- or set it in a `.env` file at the project root and let the client pick it up
58
- automatically:
66
+ or set `HELIUS_API_KEY` as an environment variable:
67
+
68
+ ```bash
69
+ export HELIUS_API_KEY=your_helius_api_key
70
+ ```
71
+
72
+ You can also set it in a `.env` file at the project root and let the client
73
+ pick it up automatically:
59
74
 
60
75
  ```env
61
76
  HELIUS_API_KEY=your_helius_api_key
62
77
  ```
63
78
 
64
79
  ```python
65
- from helius import HeliusClient
80
+ from helius.client import HeliusClient
66
81
 
67
- client = HeliusClient() # reads HELIUS_API_KEY from .env
82
+ client = HeliusClient() # reads HELIUS_API_KEY from the environment or .env
68
83
  ```
69
84
 
70
85
  ## Usage
@@ -72,7 +87,7 @@ client = HeliusClient() # reads HELIUS_API_KEY from .env
72
87
  ### As a context manager (recommended)
73
88
 
74
89
  ```python
75
- from helius import HeliusClient
90
+ from helius.client import HeliusClient
76
91
 
77
92
  with HeliusClient(api_key="YOUR_HELIUS_API_KEY") as client:
78
93
  balance = client.get_balance("So11111111111111111111111111111111111111112")
@@ -92,7 +107,7 @@ If a `with` block doesn't fit your code structure (e.g. the client lives on
92
107
  a long-lived object), call `close()` yourself when you're done:
93
108
 
94
109
  ```python
95
- from helius import HeliusClient
110
+ from helius.client import HeliusClient
96
111
 
97
112
  client = HeliusClient(api_key="YOUR_HELIUS_API_KEY")
98
113
  try:
@@ -116,7 +131,7 @@ instance is garbage-collected. Prefer `with` or `close()` regardless.
116
131
  | Argument | Default | Notes |
117
132
  | --------- | ------------------------------------ | --------------------------------------------------------------------------------------------- |
118
133
  | `base_url`| `"https://mainnet.helius-rpc.com"` | Override to point at devnet, staging, or a custom Helius endpoint. |
119
- | `api_key` | `None` → falls back to `HELIUS_API_KEY` in a `.env` file | If neither is provided, the constructor raises `ValueError`. |
134
+ | `api_key` | `None` → falls back to `HELIUS_API_KEY` from the environment, then `.env` | If none is provided, the constructor raises `ValueError`. |
120
135
 
121
136
  Per-method RPC parameters (`commitment`, `encoding`, `min_context_slot`, etc.)
122
137
  are left unset by default — the Helius/Solana server defaults apply unless you
@@ -190,7 +205,7 @@ docstring that is the source of truth for that symbol. You can read it
190
205
  straight from a REPL:
191
206
 
192
207
  ```python
193
- from helius import HeliusClient
208
+ from helius.client import HeliusClient
194
209
  help(HeliusClient.get_balance)
195
210
  ```
196
211
 
@@ -10,13 +10,18 @@ build-backend = "hatchling.build"
10
10
 
11
11
  [project]
12
12
  name = "helius-python"
13
- version = "0.0.1"
13
+ version = "0.0.3"
14
14
  authors = [
15
15
  { name="Markos Narinian", email="manarinian@gmail.com" },
16
16
  ]
17
17
  description = "Typed Python client for the Helius API"
18
18
  readme = "README.md"
19
19
  requires-python = ">=3.9"
20
+ dependencies = [
21
+ "httpx",
22
+ "pydantic",
23
+ "python-dotenv",
24
+ ]
20
25
  classifiers = [
21
26
  "Programming Language :: Python :: 3",
22
27
  "Operating System :: OS Independent",
@@ -1,3 +1,4 @@
1
+ import os
1
2
  from typing import Annotated, Any, Literal
2
3
 
3
4
  import httpx
@@ -38,7 +39,11 @@ class HeliusClient:
38
39
  api_key: str | None = None,
39
40
  ) -> None:
40
41
  self.base_url = base_url
41
- self.api_key = api_key or dotenv_values().get("HELIUS_API_KEY")
42
+ self.api_key = (
43
+ api_key
44
+ or os.environ.get("HELIUS_API_KEY")
45
+ or dotenv_values().get("HELIUS_API_KEY")
46
+ )
42
47
  if not self.api_key:
43
48
  raise ValueError("No API key provided.")
44
49
  self._client = httpx.Client(
File without changes
File without changes
File without changes