pmxt 1.0.0b8__py3-none-any.whl → 1.0.3__py3-none-any.whl
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.
- pmxt/__init__.py +1 -1
- pmxt/_server/__init__.py +0 -0
- pmxt/_server/bin/pmxt-ensure-server +158 -0
- pmxt/_server/server/bundled.js +84703 -0
- pmxt/client.py +7 -1
- pmxt/server_manager.py +33 -7
- {pmxt-1.0.0b8.dist-info → pmxt-1.0.3.dist-info}/METADATA +1 -1
- {pmxt-1.0.0b8.dist-info → pmxt-1.0.3.dist-info}/RECORD +13 -10
- pmxt_internal/__init__.py +1 -1
- pmxt_internal/api_client.py +1 -1
- pmxt_internal/configuration.py +1 -1
- {pmxt-1.0.0b8.dist-info → pmxt-1.0.3.dist-info}/WHEEL +0 -0
- {pmxt-1.0.0b8.dist-info → pmxt-1.0.3.dist-info}/top_level.txt +0 -0
pmxt/client.py
CHANGED
|
@@ -182,6 +182,12 @@ class Exchange(ABC):
|
|
|
182
182
|
if auto_start_server:
|
|
183
183
|
try:
|
|
184
184
|
self._server_manager.ensure_server_running()
|
|
185
|
+
|
|
186
|
+
# Get the actual port the server is running on
|
|
187
|
+
# (may differ from default if default port was busy)
|
|
188
|
+
actual_port = self._server_manager.get_running_port()
|
|
189
|
+
base_url = f"http://localhost:{actual_port}"
|
|
190
|
+
|
|
185
191
|
except Exception as e:
|
|
186
192
|
raise Exception(
|
|
187
193
|
f"Failed to start PMXT server: {e}\n\n"
|
|
@@ -189,7 +195,7 @@ class Exchange(ABC):
|
|
|
189
195
|
f"Or start the server manually: pmxt-server"
|
|
190
196
|
)
|
|
191
197
|
|
|
192
|
-
# Configure the API client
|
|
198
|
+
# Configure the API client with the actual base URL
|
|
193
199
|
config = Configuration(host=base_url)
|
|
194
200
|
self._api_client = ApiClient(configuration=config)
|
|
195
201
|
self._api = DefaultApi(api_client=self._api_client)
|
pmxt/server_manager.py
CHANGED
|
@@ -144,18 +144,29 @@ class ServerManager:
|
|
|
144
144
|
"""
|
|
145
145
|
Start the server using the pmxt-ensure-server launcher.
|
|
146
146
|
"""
|
|
147
|
-
# 1. Check for
|
|
147
|
+
# 1. Check for bundled server (PRODUCTION - installed via pip)
|
|
148
|
+
bundled_launcher = Path(__file__).parent / '_server' / 'bin' / 'pmxt-ensure-server'
|
|
149
|
+
|
|
150
|
+
# 2. Check for monorepo structure (DEVELOPMENT)
|
|
148
151
|
current_file = Path(__file__).resolve()
|
|
149
|
-
|
|
150
|
-
local_launcher = current_file.parent.parent.parent / 'bin' / 'pmxt-ensure-server'
|
|
152
|
+
local_launcher = current_file.parent.parent.parent.parent / 'core' / 'bin' / 'pmxt-ensure-server'
|
|
151
153
|
|
|
152
|
-
|
|
154
|
+
# 3. Check PATH (GLOBAL INSTALL)
|
|
155
|
+
path_launcher = shutil.which('pmxt-ensure-server')
|
|
153
156
|
|
|
154
|
-
|
|
157
|
+
# Priority order: bundled > local dev > PATH
|
|
158
|
+
if bundled_launcher.exists():
|
|
159
|
+
launcher = str(bundled_launcher)
|
|
160
|
+
elif local_launcher.exists():
|
|
161
|
+
launcher = str(local_launcher)
|
|
162
|
+
elif path_launcher:
|
|
163
|
+
launcher = path_launcher
|
|
164
|
+
else:
|
|
155
165
|
raise Exception(
|
|
156
166
|
"pmxt-ensure-server not found.\n"
|
|
157
|
-
"
|
|
158
|
-
"Please
|
|
167
|
+
"This should have been bundled with the package.\n"
|
|
168
|
+
"Please reinstall: pip install --force-reinstall pmxt\n"
|
|
169
|
+
"Or install the server manually: npm install -g pmxt-core"
|
|
159
170
|
)
|
|
160
171
|
|
|
161
172
|
# Call the launcher
|
|
@@ -240,3 +251,18 @@ class ServerManager:
|
|
|
240
251
|
return json.loads(self.lock_path.read_text())
|
|
241
252
|
except:
|
|
242
253
|
return None
|
|
254
|
+
|
|
255
|
+
def get_running_port(self) -> int:
|
|
256
|
+
"""
|
|
257
|
+
Get the actual port the server is running on.
|
|
258
|
+
|
|
259
|
+
This reads the lock file to determine the actual port,
|
|
260
|
+
which may differ from the default if the default port was busy.
|
|
261
|
+
|
|
262
|
+
Returns:
|
|
263
|
+
Port number the server is running on, or DEFAULT_PORT if unknown
|
|
264
|
+
"""
|
|
265
|
+
info = self.get_server_info()
|
|
266
|
+
if info and 'port' in info:
|
|
267
|
+
return info['port']
|
|
268
|
+
return self.DEFAULT_PORT
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
pmxt/__init__.py,sha256=
|
|
2
|
-
pmxt/client.py,sha256=
|
|
1
|
+
pmxt/__init__.py,sha256=vh7zkQGfvusno6-CgWx2iDFSKjQS2Yk_aCPWHOuaCEA,1150
|
|
2
|
+
pmxt/client.py,sha256=pXAPl_IPhnza2xwlObSlLia9aWpBHA97Nsxq9aP3yvU,23485
|
|
3
3
|
pmxt/models.py,sha256=Mu0hLVjQU3PM5m68poK61VQcJtPQ8ZdLdLU7pq1lqjQ,6004
|
|
4
|
-
pmxt/server_manager.py,sha256=
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
pmxt/server_manager.py,sha256=GVTZAFBs5LC8dXGpeH_kt2ZlKpYk2dbYncCbt8gRcX0,8799
|
|
5
|
+
pmxt/_server/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
+
pmxt/_server/bin/pmxt-ensure-server,sha256=kXIond0UbxS52FAVQD7kHmSBaL_s6cbIyapLRr4KZJw,4544
|
|
7
|
+
pmxt/_server/server/bundled.js,sha256=Dvq8eVbqk8UrGK71b6jBK-kXI0-ixnspMe5zScxWCrA,3395166
|
|
8
|
+
pmxt_internal/__init__.py,sha256=UfA5SFa5dJ73wYol0X2vem-rfhir4DOd6_nSYjkCaqg,5973
|
|
9
|
+
pmxt_internal/api_client.py,sha256=yhAWPtRlSAZZo6u4ShePgRTTbL5j4DXXDyXtCB_ayfM,27889
|
|
7
10
|
pmxt_internal/api_response.py,sha256=eMxw1mpmJcoGZ3gs9z6jM4oYoZ10Gjk333s9sKxGv7s,652
|
|
8
|
-
pmxt_internal/configuration.py,sha256=
|
|
11
|
+
pmxt_internal/configuration.py,sha256=ezNaGgJUCKgOLcF0-UjwrhwthQiKNTNULw4hUDiZ8Us,18320
|
|
9
12
|
pmxt_internal/exceptions.py,sha256=txF8A7vlan57JS69kFPs-IZF-Qhp7IZobBTJVa4fOaM,6644
|
|
10
13
|
pmxt_internal/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
14
|
pmxt_internal/rest.py,sha256=FMj4yaV6XLr842u_ScWHSzQsTFdk0jaUeuWLJoRbogQ,9760
|
|
@@ -50,7 +53,7 @@ pmxt_internal/models/search_markets_request.py,sha256=BARoy2GXgV7RQNIGck6UaOyQqf
|
|
|
50
53
|
pmxt_internal/models/search_markets_request_args_inner.py,sha256=PkusFd_OxhUsItsBpluPJA11zg0sXXjbOK-lPmemvLs,5561
|
|
51
54
|
pmxt_internal/models/trade.py,sha256=U6Fc18rbwILs9FmX8CSDYYL8dF6763l8QzeMQNRxQdo,3328
|
|
52
55
|
pmxt_internal/models/unified_market.py,sha256=mNyUrGKWxvI2f2KCa2uhGwq22cBdDia2hD5AtzFw8fE,4487
|
|
53
|
-
pmxt-1.0.
|
|
54
|
-
pmxt-1.0.
|
|
55
|
-
pmxt-1.0.
|
|
56
|
-
pmxt-1.0.
|
|
56
|
+
pmxt-1.0.3.dist-info/METADATA,sha256=wRbKtij3NsrlPLx9HmSho_HyDkfwe-nKjTnpWCWWtNA,6300
|
|
57
|
+
pmxt-1.0.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
58
|
+
pmxt-1.0.3.dist-info/top_level.txt,sha256=J_jrcouJ-x-5lpcXMxeW0GOSi1HsBVR5_PdSfvigVrw,19
|
|
59
|
+
pmxt-1.0.3.dist-info/RECORD,,
|
pmxt_internal/__init__.py
CHANGED
pmxt_internal/api_client.py
CHANGED
|
@@ -91,7 +91,7 @@ class ApiClient:
|
|
|
91
91
|
self.default_headers[header_name] = header_value
|
|
92
92
|
self.cookie = cookie
|
|
93
93
|
# Set default User-Agent.
|
|
94
|
-
self.user_agent = 'OpenAPI-Generator/1.0.
|
|
94
|
+
self.user_agent = 'OpenAPI-Generator/1.0.3/python'
|
|
95
95
|
self.client_side_validation = configuration.client_side_validation
|
|
96
96
|
|
|
97
97
|
def __enter__(self):
|
pmxt_internal/configuration.py
CHANGED
|
@@ -506,7 +506,7 @@ class Configuration:
|
|
|
506
506
|
"OS: {env}\n"\
|
|
507
507
|
"Python Version: {pyversion}\n"\
|
|
508
508
|
"Version of the API: 0.4.4\n"\
|
|
509
|
-
"SDK Package Version: 1.0.
|
|
509
|
+
"SDK Package Version: 1.0.3".\
|
|
510
510
|
format(env=sys.platform, pyversion=sys.version)
|
|
511
511
|
|
|
512
512
|
def get_host_settings(self) -> List[HostSetting]:
|
|
File without changes
|
|
File without changes
|