flashforge-python-api 3.0.0__py3-none-any.whl → 3.1.0__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.
flashforge/__init__.py CHANGED
@@ -1,337 +1,337 @@
1
- """
2
- FlashForge Python API
3
-
4
- A Python library for controlling FlashForge 3D printers over their HTTP and TCP APIs.
5
- Each printer family has its own backend; :func:`connect_printer` picks the right one.
6
-
7
- Example:
8
- ```python
9
- import asyncio
10
- from flashforge import ConnectOptions, ConnectTarget, PrinterDiscovery, connect_printer
11
-
12
- async def main():
13
- printers = await PrinterDiscovery().discover()
14
- backend = await connect_printer(printers[0], ConnectOptions(check_code="12345678"))
15
- async with backend:
16
- status = await backend.get_status()
17
- print(status.state, status.temperatures.extruder.current)
18
- if backend.capabilities.led.controllable:
19
- await backend.set_led(True)
20
-
21
- asyncio.run(main())
22
- ```
23
- """
24
-
25
- from .api.constants.commands import Commands
26
- from .api.constants.endpoints import Endpoints
27
- from .api.filament import Filament
28
- from .api.misc import Temperature as TempWrapper
29
- from .api.misc import format_scientific_notation
30
- from .api.network.fnet_code import FNetCode
31
-
32
- # Import utility classes
33
- from .api.network.utils import NetworkUtils
34
- from .backends import (
35
- AD5XBackend,
36
- Adventurer5MBackend,
37
- Adventurer5MProBackend,
38
- ConnectOptions,
39
- ConnectTarget,
40
- Creator5Backend,
41
- DualApiBackend,
42
- FiltrationMode,
43
- HttpCore,
44
- HttpPrinterBackend,
45
- LegacyBackend,
46
- LocalJobParams,
47
- MaterialMapping,
48
- PrinterBackend,
49
- PrinterIdentity,
50
- PrintOverrides,
51
- SlotAction,
52
- UploadJobParams,
53
- connect_printer,
54
- )
55
- from .capabilities import (
56
- AD5X_FILAMENT_PALETTE,
57
- AD5X_MATERIALS,
58
- AD5X_PALETTE,
59
- CREATOR5_FILAMENT_PALETTE,
60
- CREATOR5_MATERIALS,
61
- CREATOR5_PALETTE,
62
- BackendFamily,
63
- FeatureSupport,
64
- LedSupport,
65
- MaterialStationSupport,
66
- Palette,
67
- PaletteColor,
68
- PrinterCapabilities,
69
- get_model_palette,
70
- get_palette_for_model,
71
- resolve_capabilities,
72
- resolve_model,
73
- snap_to_ad5x_palette,
74
- snap_to_creator5_palette,
75
- snap_to_model_palette,
76
- )
77
-
78
- # Import discovery classes
79
- from .discovery import (
80
- DiscoveredPrinter,
81
- DiscoveryError,
82
- DiscoveryMonitor,
83
- DiscoveryOptions,
84
- DiscoveryProtocol,
85
- DiscoveryTimeoutError,
86
- FlashForgePrinter,
87
- FlashForgePrinterDiscovery,
88
- InvalidResponseError,
89
- PrinterDiscovery,
90
- PrinterModelId,
91
- PrinterStatus,
92
- SocketCreationError,
93
- )
94
- from .exceptions import (
95
- FlashForgeError,
96
- FlashForgeResponseError,
97
- InvalidParameterError,
98
- NotSupportedError,
99
- PrinterConnectionError,
100
- )
101
-
102
- # Import key models for convenience
103
- from .models import (
104
- DetailResponse,
105
- FFGcodeFileEntry,
106
- FFGcodeToolData,
107
- FFMachineInfo,
108
- FFPrinterDetail,
109
- FilamentArgs,
110
- GCodeListResponse,
111
- GenericResponse,
112
- IndepMatlInfo,
113
- MachineInfoParser,
114
- MachineState,
115
- MatlStationInfo,
116
- Product,
117
- ProductResponse,
118
- SlotInfo,
119
- Temperature,
120
- ThumbnailResponse,
121
- )
122
-
123
- # Sliced 3MF parsing (tools and materials before upload)
124
- from .status import (
125
- JobProgress,
126
- JobSnapshot,
127
- MaterialSlotSnapshot,
128
- MaterialStationSnapshot,
129
- PrinterRunState,
130
- PrinterSnapshot,
131
- TemperatureReading,
132
- )
133
- from .tcp import (
134
- A3BuildVolume,
135
- A3FileEntry,
136
- A3GCodeController,
137
- A3PrinterInfo,
138
- A3Thumbnail,
139
- A4BuildVolume,
140
- A4FileEntry,
141
- A4PrinterInfo,
142
- Endstop,
143
- EndstopStatus,
144
- FlashForgeA3Client,
145
- FlashForgeA4Client,
146
- FlashForgeTcpClient,
147
- FlashForgeTcpClientOptions,
148
- GCodeController,
149
- GCodes,
150
- LegacyGCodeController,
151
- LocationInfo,
152
- MachineStatus,
153
- MoveMode,
154
- PrinterInfo,
155
- PrintStatus,
156
- Status,
157
- TempData,
158
- TempInfo,
159
- ThumbnailInfo,
160
- )
161
-
162
- # Import TCP classes for low-level access
163
- from .tcp import (
164
- FlashForgeTcpClient as TcpClient,
165
- )
166
- from .threemf import (
167
- PrinterFamily,
168
- ThreeMFError,
169
- ThreeMFFilament,
170
- ThreeMFFile,
171
- ThreeMFFormatError,
172
- ThreeMFMultiplePlatesError,
173
- ThreeMFNotSlicedError,
174
- ThreeMFWarning,
175
- parse_3mf,
176
- )
177
-
178
- __version__ = "3.0.0"
179
- __author__ = "FlashForge Python API Contributors"
180
- __email__ = "notghosttypes@gmail.com"
181
- __description__ = "Python library for controlling FlashForge 3D printers"
182
-
183
- # Public API - Main classes most users will need
184
- __all__ = [
185
- # Backends and the connect factory
186
- "connect_printer",
187
- "ConnectOptions",
188
- "ConnectTarget",
189
- "PrinterBackend",
190
- "PrinterIdentity",
191
- "HttpCore",
192
- "HttpPrinterBackend",
193
- "DualApiBackend",
194
- "Adventurer5MBackend",
195
- "Adventurer5MProBackend",
196
- "AD5XBackend",
197
- "Creator5Backend",
198
- "LegacyBackend",
199
- "UploadJobParams",
200
- "LocalJobParams",
201
- "MaterialMapping",
202
- "PrintOverrides",
203
- "FiltrationMode",
204
- "SlotAction",
205
- # Capabilities and palettes
206
- "BackendFamily",
207
- "FeatureSupport",
208
- "LedSupport",
209
- "MaterialStationSupport",
210
- "PrinterCapabilities",
211
- "PrinterModelId",
212
- "resolve_capabilities",
213
- "resolve_model",
214
- "PaletteColor",
215
- "AD5X_PALETTE",
216
- "AD5X_MATERIALS",
217
- "CREATOR5_PALETTE",
218
- "CREATOR5_MATERIALS",
219
- "AD5X_FILAMENT_PALETTE",
220
- "CREATOR5_FILAMENT_PALETTE",
221
- "Palette",
222
- "get_model_palette",
223
- "get_palette_for_model",
224
- "snap_to_model_palette",
225
- "snap_to_ad5x_palette",
226
- "snap_to_creator5_palette",
227
- # Status model
228
- "PrinterSnapshot",
229
- "PrinterRunState",
230
- "TemperatureReading",
231
- "JobSnapshot",
232
- "JobProgress",
233
- "MaterialStationSnapshot",
234
- "MaterialSlotSnapshot",
235
- # Exceptions
236
- "FlashForgeError",
237
- "FlashForgeResponseError",
238
- "NotSupportedError",
239
- "InvalidParameterError",
240
- "PrinterConnectionError",
241
- # Data models
242
- "FFMachineInfo",
243
- "FFPrinterDetail",
244
- "MachineInfoParser",
245
- "FFGcodeFileEntry",
246
- "FFGcodeToolData",
247
- "MachineState",
248
- "Temperature",
249
- "GenericResponse",
250
- "DetailResponse",
251
- "ProductResponse",
252
- "Product",
253
- "FilamentArgs",
254
- # AD5X models
255
- "SlotInfo",
256
- "MatlStationInfo",
257
- "IndepMatlInfo",
258
- "GCodeListResponse",
259
- "ThumbnailResponse",
260
- # Sliced 3MF parsing
261
- "parse_3mf",
262
- "PrinterFamily",
263
- "ThreeMFError",
264
- "ThreeMFFilament",
265
- "ThreeMFFile",
266
- "ThreeMFFormatError",
267
- "ThreeMFMultiplePlatesError",
268
- "ThreeMFNotSlicedError",
269
- "ThreeMFWarning",
270
- # TCP classes for low-level operations
271
- "TcpClient",
272
- "FlashForgeTcpClient",
273
- "FlashForgeTcpClientOptions",
274
- "FlashForgeA3Client",
275
- "FlashForgeA4Client",
276
- "PrinterInfo",
277
- "TempInfo",
278
- "TempData",
279
- "LocationInfo",
280
- "EndstopStatus",
281
- "MachineStatus",
282
- "MoveMode",
283
- "Status",
284
- "Endstop",
285
- "PrintStatus",
286
- "ThumbnailInfo",
287
- "GCodes",
288
- "GCodeController",
289
- "A3GCodeController",
290
- "LegacyGCodeController",
291
- "A3BuildVolume",
292
- "A3PrinterInfo",
293
- "A3FileEntry",
294
- "A3Thumbnail",
295
- "A4BuildVolume",
296
- "A4PrinterInfo",
297
- "A4FileEntry",
298
- # Discovery classes
299
- "PrinterDiscovery",
300
- "DiscoveredPrinter",
301
- "DiscoveryOptions",
302
- "DiscoveryProtocol",
303
- "PrinterStatus",
304
- "DiscoveryMonitor",
305
- "DiscoveryError",
306
- "InvalidResponseError",
307
- "SocketCreationError",
308
- "DiscoveryTimeoutError",
309
- "FlashForgePrinter",
310
- "FlashForgePrinterDiscovery",
311
- # Utilities
312
- "NetworkUtils",
313
- "FNetCode",
314
- "Filament",
315
- "TempWrapper",
316
- "format_scientific_notation",
317
- "Endpoints",
318
- "Commands",
319
- # Package metadata
320
- "__version__",
321
- "__author__",
322
- "__email__",
323
- "__description__",
324
- ]
325
-
326
- # Convenience imports for common patterns
327
- State = MachineState
328
-
329
- # Add version info accessible as flashforge.version
330
- version = __version__
331
-
332
-
333
- def __getattr__(name: str) -> object:
334
- """Raise a clear error for names removed in 3.0 (see ``flashforge._removed``)."""
335
- from ._removed import REMOVED_TOP_LEVEL, module_getattr
336
-
337
- return module_getattr(__name__, REMOVED_TOP_LEVEL, name)
1
+ """
2
+ FlashForge Python API
3
+
4
+ A Python library for controlling FlashForge 3D printers over their HTTP and TCP APIs.
5
+ Each printer family has its own backend; :func:`connect_printer` picks the right one.
6
+
7
+ Example:
8
+ ```python
9
+ import asyncio
10
+ from flashforge import ConnectOptions, ConnectTarget, PrinterDiscovery, connect_printer
11
+
12
+ async def main():
13
+ printers = await PrinterDiscovery().discover()
14
+ backend = await connect_printer(printers[0], ConnectOptions(check_code="12345678"))
15
+ async with backend:
16
+ status = await backend.get_status()
17
+ print(status.state, status.temperatures.extruder.current)
18
+ if backend.capabilities.led.controllable:
19
+ await backend.set_led(True)
20
+
21
+ asyncio.run(main())
22
+ ```
23
+ """
24
+
25
+ from .api.constants.commands import Commands
26
+ from .api.constants.endpoints import Endpoints
27
+ from .api.filament import Filament
28
+ from .api.misc import Temperature as TempWrapper
29
+ from .api.misc import format_scientific_notation
30
+ from .api.network.fnet_code import FNetCode
31
+
32
+ # Import utility classes
33
+ from .api.network.utils import NetworkUtils
34
+ from .backends import (
35
+ AD5XBackend,
36
+ Adventurer5MBackend,
37
+ Adventurer5MProBackend,
38
+ ConnectOptions,
39
+ ConnectTarget,
40
+ Creator5Backend,
41
+ DualApiBackend,
42
+ FiltrationMode,
43
+ HttpCore,
44
+ HttpPrinterBackend,
45
+ LegacyBackend,
46
+ LocalJobParams,
47
+ MaterialMapping,
48
+ PrinterBackend,
49
+ PrinterIdentity,
50
+ PrintOverrides,
51
+ SlotAction,
52
+ UploadJobParams,
53
+ connect_printer,
54
+ )
55
+ from .capabilities import (
56
+ AD5X_FILAMENT_PALETTE,
57
+ AD5X_MATERIALS,
58
+ AD5X_PALETTE,
59
+ CREATOR5_FILAMENT_PALETTE,
60
+ CREATOR5_MATERIALS,
61
+ CREATOR5_PALETTE,
62
+ BackendFamily,
63
+ FeatureSupport,
64
+ LedSupport,
65
+ MaterialStationSupport,
66
+ Palette,
67
+ PaletteColor,
68
+ PrinterCapabilities,
69
+ get_model_palette,
70
+ get_palette_for_model,
71
+ resolve_capabilities,
72
+ resolve_model,
73
+ snap_to_ad5x_palette,
74
+ snap_to_creator5_palette,
75
+ snap_to_model_palette,
76
+ )
77
+
78
+ # Import discovery classes
79
+ from .discovery import (
80
+ DiscoveredPrinter,
81
+ DiscoveryError,
82
+ DiscoveryMonitor,
83
+ DiscoveryOptions,
84
+ DiscoveryProtocol,
85
+ DiscoveryTimeoutError,
86
+ FlashForgePrinter,
87
+ FlashForgePrinterDiscovery,
88
+ InvalidResponseError,
89
+ PrinterDiscovery,
90
+ PrinterModelId,
91
+ PrinterStatus,
92
+ SocketCreationError,
93
+ )
94
+ from .exceptions import (
95
+ FlashForgeError,
96
+ FlashForgeResponseError,
97
+ InvalidParameterError,
98
+ NotSupportedError,
99
+ PrinterConnectionError,
100
+ )
101
+
102
+ # Import key models for convenience
103
+ from .models import (
104
+ DetailResponse,
105
+ FFGcodeFileEntry,
106
+ FFGcodeToolData,
107
+ FFMachineInfo,
108
+ FFPrinterDetail,
109
+ FilamentArgs,
110
+ GCodeListResponse,
111
+ GenericResponse,
112
+ IndepMatlInfo,
113
+ MachineInfoParser,
114
+ MachineState,
115
+ MatlStationInfo,
116
+ Product,
117
+ ProductResponse,
118
+ SlotInfo,
119
+ Temperature,
120
+ ThumbnailResponse,
121
+ )
122
+
123
+ # Sliced 3MF parsing (tools and materials before upload)
124
+ from .status import (
125
+ JobProgress,
126
+ JobSnapshot,
127
+ MaterialSlotSnapshot,
128
+ MaterialStationSnapshot,
129
+ PrinterRunState,
130
+ PrinterSnapshot,
131
+ TemperatureReading,
132
+ )
133
+ from .tcp import (
134
+ A3BuildVolume,
135
+ A3FileEntry,
136
+ A3GCodeController,
137
+ A3PrinterInfo,
138
+ A3Thumbnail,
139
+ A4BuildVolume,
140
+ A4FileEntry,
141
+ A4PrinterInfo,
142
+ Endstop,
143
+ EndstopStatus,
144
+ FlashForgeA3Client,
145
+ FlashForgeA4Client,
146
+ FlashForgeTcpClient,
147
+ FlashForgeTcpClientOptions,
148
+ GCodeController,
149
+ GCodes,
150
+ LegacyGCodeController,
151
+ LocationInfo,
152
+ MachineStatus,
153
+ MoveMode,
154
+ PrinterInfo,
155
+ PrintStatus,
156
+ Status,
157
+ TempData,
158
+ TempInfo,
159
+ ThumbnailInfo,
160
+ )
161
+
162
+ # Import TCP classes for low-level access
163
+ from .tcp import (
164
+ FlashForgeTcpClient as TcpClient,
165
+ )
166
+ from .threemf import (
167
+ PrinterFamily,
168
+ ThreeMFError,
169
+ ThreeMFFilament,
170
+ ThreeMFFile,
171
+ ThreeMFFormatError,
172
+ ThreeMFMultiplePlatesError,
173
+ ThreeMFNotSlicedError,
174
+ ThreeMFWarning,
175
+ parse_3mf,
176
+ )
177
+
178
+ __version__ = "3.1.0"
179
+ __author__ = "FlashForge Python API Contributors"
180
+ __email__ = "notghosttypes@gmail.com"
181
+ __description__ = "Python library for controlling FlashForge 3D printers"
182
+
183
+ # Public API - Main classes most users will need
184
+ __all__ = [
185
+ # Backends and the connect factory
186
+ "connect_printer",
187
+ "ConnectOptions",
188
+ "ConnectTarget",
189
+ "PrinterBackend",
190
+ "PrinterIdentity",
191
+ "HttpCore",
192
+ "HttpPrinterBackend",
193
+ "DualApiBackend",
194
+ "Adventurer5MBackend",
195
+ "Adventurer5MProBackend",
196
+ "AD5XBackend",
197
+ "Creator5Backend",
198
+ "LegacyBackend",
199
+ "UploadJobParams",
200
+ "LocalJobParams",
201
+ "MaterialMapping",
202
+ "PrintOverrides",
203
+ "FiltrationMode",
204
+ "SlotAction",
205
+ # Capabilities and palettes
206
+ "BackendFamily",
207
+ "FeatureSupport",
208
+ "LedSupport",
209
+ "MaterialStationSupport",
210
+ "PrinterCapabilities",
211
+ "PrinterModelId",
212
+ "resolve_capabilities",
213
+ "resolve_model",
214
+ "PaletteColor",
215
+ "AD5X_PALETTE",
216
+ "AD5X_MATERIALS",
217
+ "CREATOR5_PALETTE",
218
+ "CREATOR5_MATERIALS",
219
+ "AD5X_FILAMENT_PALETTE",
220
+ "CREATOR5_FILAMENT_PALETTE",
221
+ "Palette",
222
+ "get_model_palette",
223
+ "get_palette_for_model",
224
+ "snap_to_model_palette",
225
+ "snap_to_ad5x_palette",
226
+ "snap_to_creator5_palette",
227
+ # Status model
228
+ "PrinterSnapshot",
229
+ "PrinterRunState",
230
+ "TemperatureReading",
231
+ "JobSnapshot",
232
+ "JobProgress",
233
+ "MaterialStationSnapshot",
234
+ "MaterialSlotSnapshot",
235
+ # Exceptions
236
+ "FlashForgeError",
237
+ "FlashForgeResponseError",
238
+ "NotSupportedError",
239
+ "InvalidParameterError",
240
+ "PrinterConnectionError",
241
+ # Data models
242
+ "FFMachineInfo",
243
+ "FFPrinterDetail",
244
+ "MachineInfoParser",
245
+ "FFGcodeFileEntry",
246
+ "FFGcodeToolData",
247
+ "MachineState",
248
+ "Temperature",
249
+ "GenericResponse",
250
+ "DetailResponse",
251
+ "ProductResponse",
252
+ "Product",
253
+ "FilamentArgs",
254
+ # AD5X models
255
+ "SlotInfo",
256
+ "MatlStationInfo",
257
+ "IndepMatlInfo",
258
+ "GCodeListResponse",
259
+ "ThumbnailResponse",
260
+ # Sliced 3MF parsing
261
+ "parse_3mf",
262
+ "PrinterFamily",
263
+ "ThreeMFError",
264
+ "ThreeMFFilament",
265
+ "ThreeMFFile",
266
+ "ThreeMFFormatError",
267
+ "ThreeMFMultiplePlatesError",
268
+ "ThreeMFNotSlicedError",
269
+ "ThreeMFWarning",
270
+ # TCP classes for low-level operations
271
+ "TcpClient",
272
+ "FlashForgeTcpClient",
273
+ "FlashForgeTcpClientOptions",
274
+ "FlashForgeA3Client",
275
+ "FlashForgeA4Client",
276
+ "PrinterInfo",
277
+ "TempInfo",
278
+ "TempData",
279
+ "LocationInfo",
280
+ "EndstopStatus",
281
+ "MachineStatus",
282
+ "MoveMode",
283
+ "Status",
284
+ "Endstop",
285
+ "PrintStatus",
286
+ "ThumbnailInfo",
287
+ "GCodes",
288
+ "GCodeController",
289
+ "A3GCodeController",
290
+ "LegacyGCodeController",
291
+ "A3BuildVolume",
292
+ "A3PrinterInfo",
293
+ "A3FileEntry",
294
+ "A3Thumbnail",
295
+ "A4BuildVolume",
296
+ "A4PrinterInfo",
297
+ "A4FileEntry",
298
+ # Discovery classes
299
+ "PrinterDiscovery",
300
+ "DiscoveredPrinter",
301
+ "DiscoveryOptions",
302
+ "DiscoveryProtocol",
303
+ "PrinterStatus",
304
+ "DiscoveryMonitor",
305
+ "DiscoveryError",
306
+ "InvalidResponseError",
307
+ "SocketCreationError",
308
+ "DiscoveryTimeoutError",
309
+ "FlashForgePrinter",
310
+ "FlashForgePrinterDiscovery",
311
+ # Utilities
312
+ "NetworkUtils",
313
+ "FNetCode",
314
+ "Filament",
315
+ "TempWrapper",
316
+ "format_scientific_notation",
317
+ "Endpoints",
318
+ "Commands",
319
+ # Package metadata
320
+ "__version__",
321
+ "__author__",
322
+ "__email__",
323
+ "__description__",
324
+ ]
325
+
326
+ # Convenience imports for common patterns
327
+ State = MachineState
328
+
329
+ # Add version info accessible as flashforge.version
330
+ version = __version__
331
+
332
+
333
+ def __getattr__(name: str) -> object:
334
+ """Raise a clear error for names removed in 3.0 (see ``flashforge._removed``)."""
335
+ from ._removed import REMOVED_TOP_LEVEL, module_getattr
336
+
337
+ return module_getattr(__name__, REMOVED_TOP_LEVEL, name)