indipyconsole 0.0.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.
- indipyconsole-0.0.1/LICENSE +21 -0
- indipyconsole-0.0.1/PKG-INFO +108 -0
- indipyconsole-0.0.1/README.md +92 -0
- indipyconsole-0.0.1/indipyconsole/__init__.py +10 -0
- indipyconsole-0.0.1/indipyconsole/__main__.py +126 -0
- indipyconsole-0.0.1/indipyconsole/choosevectorscreen.py +1315 -0
- indipyconsole-0.0.1/indipyconsole/consoleclient.py +371 -0
- indipyconsole-0.0.1/indipyconsole/devicesscreen.py +548 -0
- indipyconsole-0.0.1/indipyconsole/memberscreen.py +182 -0
- indipyconsole-0.0.1/indipyconsole/vectorscreen.py +1492 -0
- indipyconsole-0.0.1/indipyconsole/widgets.py +1431 -0
- indipyconsole-0.0.1/indipyconsole/windows.py +635 -0
- indipyconsole-0.0.1/pyproject.toml +21 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Bernard Czenkusz
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: indipyconsole
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: A terminal client which can be used to control remote instruments using the INDI protocol.
|
|
5
|
+
Keywords: indi,client,astronomy,instrument
|
|
6
|
+
Author-email: Bernard Czenkusz <bernie@skipole.co.uk>
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Topic :: Scientific/Engineering :: Astronomy
|
|
11
|
+
Classifier: Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Requires-Dist: indipyclient>=0.8.4
|
|
14
|
+
Project-URL: Source, https://github.com/bernie-skipole/indipyconsole
|
|
15
|
+
|
|
16
|
+
# indipyconsole
|
|
17
|
+
|
|
18
|
+
You may have Python programs implementing some form of data collection or control and wish to remotely operate such an instrument.
|
|
19
|
+
|
|
20
|
+
An associated package 'indipydriver' can be used to take your data, organise it into a data structure defined by the INDI protocol, and serve it on a port.
|
|
21
|
+
|
|
22
|
+
This indipyconsole package provides a terminal client, which connects to the port, allowing you to view and control your instrument from a terminal session.
|
|
23
|
+
|
|
24
|
+
A further package indipyterm is also available, by the same author, which you may prefer.
|
|
25
|
+
|
|
26
|
+
indipyterm can run on other OS's apart from Linux, and gives a more attractive terminal output, however it depends on third party libraries.
|
|
27
|
+
|
|
28
|
+
indipyconsole only depends on indipyclient - which provides the communication methods. It uses the Python standard library curses package, which is only available on Linux.
|
|
29
|
+
|
|
30
|
+
The main purpose of indipyconsole is to provide an indipendent client, in case the third party packages used by indipyterm break. It also provides logging capabilities to save communications data to a logfile. The two clients can both connect to an INDI server to compare output.
|
|
31
|
+
|
|
32
|
+
indipyconsole can be installed from Pypi with:
|
|
33
|
+
|
|
34
|
+
pip install indipyconsole
|
|
35
|
+
|
|
36
|
+
or if you use uv, it can be loaded and run with:
|
|
37
|
+
|
|
38
|
+
uvx indipyconsole
|
|
39
|
+
|
|
40
|
+
indipydriver and indipyconsole communicate with the INDI protocol.
|
|
41
|
+
|
|
42
|
+
INDI - Instrument Neutral Distributed Interface.
|
|
43
|
+
|
|
44
|
+
See https://en.wikipedia.org/wiki/Instrument_Neutral_Distributed_Interface
|
|
45
|
+
|
|
46
|
+
The INDI protocol defines the format of the data sent, such as light, number, text, switch or BLOB (Binary Large Object). The client is general purpose, taking the format of switches, numbers etc., from the protocol.
|
|
47
|
+
|
|
48
|
+
The client can be run from a virtual environment with
|
|
49
|
+
|
|
50
|
+
indipyconsole [options]
|
|
51
|
+
|
|
52
|
+
or with
|
|
53
|
+
|
|
54
|
+
python3 -m indipyconsole [options]
|
|
55
|
+
|
|
56
|
+
The package help is:
|
|
57
|
+
|
|
58
|
+
usage: indipyconsole [options]
|
|
59
|
+
|
|
60
|
+
Console client to communicate to an INDI service.
|
|
61
|
+
|
|
62
|
+
options:
|
|
63
|
+
-h, --help show this help message and exit
|
|
64
|
+
-p PORT, --port PORT Port of the INDI server (default 7624).
|
|
65
|
+
--host HOST Hostname/IP of the INDI server (default localhost).
|
|
66
|
+
-b BLOBS, --blobs BLOBS Optional folder where BLOB's will be saved.
|
|
67
|
+
--loglevel LOGLEVEL Enables logging, value 1, 2, 3 or 4.
|
|
68
|
+
--logfile LOGFILE File where logs will be saved
|
|
69
|
+
--version show program's version number and exit
|
|
70
|
+
|
|
71
|
+
The BLOB's folder can also be set from within the session.
|
|
72
|
+
Setting loglevel and logfile should only be used for brief
|
|
73
|
+
diagnostic purposes, the logfile could grow very big.
|
|
74
|
+
loglevel:1 Information and error messages only, no exception trace.
|
|
75
|
+
The following levels enable exception traces in the logs
|
|
76
|
+
loglevel:2 As 1 plus xml vector tags without members or contents,
|
|
77
|
+
loglevel:3 As 1 plus xml vectors and members - but not BLOB contents,
|
|
78
|
+
loglevel:4 As 1 plus xml vectors and all contents
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
If installed from Pypi, then the dependecy indipyclient will automatically be pulled and installed.
|
|
82
|
+
|
|
83
|
+
The indipydriver package which can be used to create instrument control, and serve the INDI protocol is available at:
|
|
84
|
+
|
|
85
|
+
https://pypi.org/project/indipydriver
|
|
86
|
+
|
|
87
|
+
https://github.com/bernie-skipole/indipydriver
|
|
88
|
+
|
|
89
|
+
https://indipydriver.readthedocs.io
|
|
90
|
+
|
|
91
|
+
With example driver scripts at:
|
|
92
|
+
|
|
93
|
+
https://github.com/bernie-skipole/inditest
|
|
94
|
+
|
|
95
|
+
The indipyterm package is available at:
|
|
96
|
+
|
|
97
|
+
https://pypi.org/project/indipyterm
|
|
98
|
+
|
|
99
|
+
https://github.com/bernie-skipole/indipyterm
|
|
100
|
+
|
|
101
|
+
The indipyclient package contains classes which may be useful if you want to create your own client or client script:
|
|
102
|
+
|
|
103
|
+
https://pypi.org/project/indipyclient
|
|
104
|
+
|
|
105
|
+
https://github.com/bernie-skipole/indipyclient
|
|
106
|
+
|
|
107
|
+
https://indipyclient.readthedocs.io
|
|
108
|
+
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# indipyconsole
|
|
2
|
+
|
|
3
|
+
You may have Python programs implementing some form of data collection or control and wish to remotely operate such an instrument.
|
|
4
|
+
|
|
5
|
+
An associated package 'indipydriver' can be used to take your data, organise it into a data structure defined by the INDI protocol, and serve it on a port.
|
|
6
|
+
|
|
7
|
+
This indipyconsole package provides a terminal client, which connects to the port, allowing you to view and control your instrument from a terminal session.
|
|
8
|
+
|
|
9
|
+
A further package indipyterm is also available, by the same author, which you may prefer.
|
|
10
|
+
|
|
11
|
+
indipyterm can run on other OS's apart from Linux, and gives a more attractive terminal output, however it depends on third party libraries.
|
|
12
|
+
|
|
13
|
+
indipyconsole only depends on indipyclient - which provides the communication methods. It uses the Python standard library curses package, which is only available on Linux.
|
|
14
|
+
|
|
15
|
+
The main purpose of indipyconsole is to provide an indipendent client, in case the third party packages used by indipyterm break. It also provides logging capabilities to save communications data to a logfile. The two clients can both connect to an INDI server to compare output.
|
|
16
|
+
|
|
17
|
+
indipyconsole can be installed from Pypi with:
|
|
18
|
+
|
|
19
|
+
pip install indipyconsole
|
|
20
|
+
|
|
21
|
+
or if you use uv, it can be loaded and run with:
|
|
22
|
+
|
|
23
|
+
uvx indipyconsole
|
|
24
|
+
|
|
25
|
+
indipydriver and indipyconsole communicate with the INDI protocol.
|
|
26
|
+
|
|
27
|
+
INDI - Instrument Neutral Distributed Interface.
|
|
28
|
+
|
|
29
|
+
See https://en.wikipedia.org/wiki/Instrument_Neutral_Distributed_Interface
|
|
30
|
+
|
|
31
|
+
The INDI protocol defines the format of the data sent, such as light, number, text, switch or BLOB (Binary Large Object). The client is general purpose, taking the format of switches, numbers etc., from the protocol.
|
|
32
|
+
|
|
33
|
+
The client can be run from a virtual environment with
|
|
34
|
+
|
|
35
|
+
indipyconsole [options]
|
|
36
|
+
|
|
37
|
+
or with
|
|
38
|
+
|
|
39
|
+
python3 -m indipyconsole [options]
|
|
40
|
+
|
|
41
|
+
The package help is:
|
|
42
|
+
|
|
43
|
+
usage: indipyconsole [options]
|
|
44
|
+
|
|
45
|
+
Console client to communicate to an INDI service.
|
|
46
|
+
|
|
47
|
+
options:
|
|
48
|
+
-h, --help show this help message and exit
|
|
49
|
+
-p PORT, --port PORT Port of the INDI server (default 7624).
|
|
50
|
+
--host HOST Hostname/IP of the INDI server (default localhost).
|
|
51
|
+
-b BLOBS, --blobs BLOBS Optional folder where BLOB's will be saved.
|
|
52
|
+
--loglevel LOGLEVEL Enables logging, value 1, 2, 3 or 4.
|
|
53
|
+
--logfile LOGFILE File where logs will be saved
|
|
54
|
+
--version show program's version number and exit
|
|
55
|
+
|
|
56
|
+
The BLOB's folder can also be set from within the session.
|
|
57
|
+
Setting loglevel and logfile should only be used for brief
|
|
58
|
+
diagnostic purposes, the logfile could grow very big.
|
|
59
|
+
loglevel:1 Information and error messages only, no exception trace.
|
|
60
|
+
The following levels enable exception traces in the logs
|
|
61
|
+
loglevel:2 As 1 plus xml vector tags without members or contents,
|
|
62
|
+
loglevel:3 As 1 plus xml vectors and members - but not BLOB contents,
|
|
63
|
+
loglevel:4 As 1 plus xml vectors and all contents
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
If installed from Pypi, then the dependecy indipyclient will automatically be pulled and installed.
|
|
67
|
+
|
|
68
|
+
The indipydriver package which can be used to create instrument control, and serve the INDI protocol is available at:
|
|
69
|
+
|
|
70
|
+
https://pypi.org/project/indipydriver
|
|
71
|
+
|
|
72
|
+
https://github.com/bernie-skipole/indipydriver
|
|
73
|
+
|
|
74
|
+
https://indipydriver.readthedocs.io
|
|
75
|
+
|
|
76
|
+
With example driver scripts at:
|
|
77
|
+
|
|
78
|
+
https://github.com/bernie-skipole/inditest
|
|
79
|
+
|
|
80
|
+
The indipyterm package is available at:
|
|
81
|
+
|
|
82
|
+
https://pypi.org/project/indipyterm
|
|
83
|
+
|
|
84
|
+
https://github.com/bernie-skipole/indipyterm
|
|
85
|
+
|
|
86
|
+
The indipyclient package contains classes which may be useful if you want to create your own client or client script:
|
|
87
|
+
|
|
88
|
+
https://pypi.org/project/indipyclient
|
|
89
|
+
|
|
90
|
+
https://github.com/bernie-skipole/indipyclient
|
|
91
|
+
|
|
92
|
+
https://indipyclient.readthedocs.io
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
|
|
2
|
+
"""Creates a terminal client
|
|
3
|
+
|
|
4
|
+
Try
|
|
5
|
+
|
|
6
|
+
python3 -m indipyconsole --help
|
|
7
|
+
|
|
8
|
+
For a description of options
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
import sys, argparse, asyncio, pathlib, logging
|
|
13
|
+
|
|
14
|
+
from . import version
|
|
15
|
+
|
|
16
|
+
from . import ConsoleClient
|
|
17
|
+
|
|
18
|
+
logger = logging.getLogger()
|
|
19
|
+
|
|
20
|
+
# logger is the root logger, with level and handler set here
|
|
21
|
+
# by the arguments given. If no logging option is given, it
|
|
22
|
+
# has a NullHandler() added
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def setlogging(client, level, logfile):
|
|
26
|
+
"""Sets the logging level and logfile, returns the level on success, None on failure.
|
|
27
|
+
level should be an integer, one of 1, 2, 3 or 4."""
|
|
28
|
+
|
|
29
|
+
# loglevel:1 Information and error messages only
|
|
30
|
+
# loglevel:2 log vector tags without members or contents
|
|
31
|
+
# loglevel:3 log vectors and members - but not BLOB contents
|
|
32
|
+
# loglevel:4 log vectors and all contents
|
|
33
|
+
|
|
34
|
+
try:
|
|
35
|
+
if level not in (1, 2, 3, 4):
|
|
36
|
+
return
|
|
37
|
+
logfile = pathlib.Path(logfile).expanduser().resolve()
|
|
38
|
+
|
|
39
|
+
if level == 4:
|
|
40
|
+
logger.setLevel(logging.DEBUG)
|
|
41
|
+
client.debug_verbosity(3)
|
|
42
|
+
elif level == 3:
|
|
43
|
+
logger.setLevel(logging.DEBUG)
|
|
44
|
+
client.debug_verbosity(2)
|
|
45
|
+
elif level == 2:
|
|
46
|
+
logger.setLevel(logging.DEBUG)
|
|
47
|
+
client.debug_verbosity(1)
|
|
48
|
+
elif level == 1:
|
|
49
|
+
logger.setLevel(logging.INFO)
|
|
50
|
+
client.debug_verbosity(0)
|
|
51
|
+
# If logging debug not enabled, reduce traceback info
|
|
52
|
+
sys.tracebacklimit = 0
|
|
53
|
+
|
|
54
|
+
fh = logging.FileHandler(logfile)
|
|
55
|
+
logger.addHandler(fh)
|
|
56
|
+
except Exception:
|
|
57
|
+
return
|
|
58
|
+
return level
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def main():
|
|
62
|
+
"""The commandline entry point to run the terminal client."""
|
|
63
|
+
|
|
64
|
+
parser = argparse.ArgumentParser(usage="indipyconsole [options]",
|
|
65
|
+
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
66
|
+
description="Console client to communicate to an INDI service.",
|
|
67
|
+
epilog="""The BLOB's folder can also be set from within the session.
|
|
68
|
+
Setting loglevel and logfile should only be used for brief
|
|
69
|
+
diagnostic purposes, the logfile could grow very big.
|
|
70
|
+
loglevel:1 Information and error messages only, no exception trace.
|
|
71
|
+
The following levels enable exception traces in the logs
|
|
72
|
+
loglevel:2 As 1 plus xml vector tags without members or contents,
|
|
73
|
+
loglevel:3 As 1 plus xml vectors and members - but not BLOB contents,
|
|
74
|
+
loglevel:4 As 1 plus xml vectors and all contents
|
|
75
|
+
""")
|
|
76
|
+
parser.add_argument("-p", "--port", type=int, default=7624, help="Port of the INDI server (default 7624).")
|
|
77
|
+
parser.add_argument("--host", default="localhost", help="Hostname/IP of the INDI server (default localhost).")
|
|
78
|
+
parser.add_argument("-b", "--blobs", help="Optional folder where BLOB's will be saved.")
|
|
79
|
+
parser.add_argument("--loglevel", help="Enables logging, value 1, 2, 3 or 4.")
|
|
80
|
+
parser.add_argument("--logfile", help="File where logs will be saved")
|
|
81
|
+
|
|
82
|
+
parser.add_argument("--version", action="version", version=version)
|
|
83
|
+
args = parser.parse_args()
|
|
84
|
+
|
|
85
|
+
if args.blobs:
|
|
86
|
+
try:
|
|
87
|
+
blobfolder = pathlib.Path(args.blobs).expanduser().resolve()
|
|
88
|
+
except Exception:
|
|
89
|
+
print("Error: If given, the BLOB's folder should be an existing directory")
|
|
90
|
+
return 1
|
|
91
|
+
else:
|
|
92
|
+
if not blobfolder.is_dir():
|
|
93
|
+
print("Error: If given, the BLOB's folder should be an existing directory")
|
|
94
|
+
return 1
|
|
95
|
+
else:
|
|
96
|
+
blobfolder = None
|
|
97
|
+
|
|
98
|
+
if args.loglevel:
|
|
99
|
+
if args.loglevel not in ("1", "2", "3", "4"):
|
|
100
|
+
print("Error: If given, the loglevel should be 1, 2, 3 or 4")
|
|
101
|
+
return 1
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
client = ConsoleClient(indihost=args.host, indiport=args.port, blobfolder=blobfolder)
|
|
105
|
+
|
|
106
|
+
if args.loglevel and args.logfile:
|
|
107
|
+
loglevel = int(args.loglevel)
|
|
108
|
+
level = setlogging(client, loglevel, args.logfile)
|
|
109
|
+
if level != loglevel:
|
|
110
|
+
print("Error: Failed to set logging")
|
|
111
|
+
return 1
|
|
112
|
+
else:
|
|
113
|
+
logger.addHandler(logging.NullHandler())
|
|
114
|
+
|
|
115
|
+
try:
|
|
116
|
+
# Starts the client, creates the console screens
|
|
117
|
+
asyncio.run(client.asyncrun())
|
|
118
|
+
finally:
|
|
119
|
+
# clear curses setup
|
|
120
|
+
client.console_reset()
|
|
121
|
+
|
|
122
|
+
return 0
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
if __name__ == "__main__":
|
|
126
|
+
sys.exit(main())
|