aioboinc 0.1.0__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.
@@ -0,0 +1,134 @@
1
+ secret*
2
+ .mypy_cache/
3
+ .tox/
4
+ .idea/
5
+ Pipfile.lock
6
+ *.pdf
7
+ *.html
8
+ *.h
9
+
10
+ # Created by https://www.gitignore.io/api/python
11
+ # Edit at https://www.gitignore.io/?templates=python
12
+
13
+ ### Python ###
14
+ # Byte-compiled / optimized / DLL files
15
+ __pycache__/
16
+ *.py[cod]
17
+ *$py.class
18
+
19
+ # C extensions
20
+ *.so
21
+
22
+ # Distribution / packaging
23
+ .Python
24
+ build/
25
+ develop-eggs/
26
+ dist/
27
+ downloads/
28
+ eggs/
29
+ .eggs/
30
+ lib/
31
+ lib64/
32
+ parts/
33
+ sdist/
34
+ var/
35
+ wheels/
36
+ share/python-wheels/
37
+ *.egg-info/
38
+ .installed.cfg
39
+ *.egg
40
+ MANIFEST
41
+
42
+ # PyInstaller
43
+ # Usually these files are written by a python script from a template
44
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
45
+ *.manifest
46
+ *.spec
47
+
48
+ # Installer logs
49
+ pip-log.txt
50
+ pip-delete-this-directory.txt
51
+
52
+ # Unit test / coverage reports
53
+ htmlcov/
54
+ .tox/
55
+ .nox/
56
+ .coverage
57
+ .coverage.*
58
+ .cache
59
+ nosetests.xml
60
+ coverage.xml
61
+ *.cover
62
+ .hypothesis/
63
+ .pytest_cache/
64
+
65
+ # Translations
66
+ *.mo
67
+ *.pot
68
+
69
+ # Django stuff:
70
+ *.log
71
+ local_settings.py
72
+ db.sqlite3
73
+
74
+ # Flask stuff:
75
+ instance/
76
+ .webassets-cache
77
+
78
+ # Scrapy stuff:
79
+ .scrapy
80
+
81
+ # Sphinx documentation
82
+ docs/_build/
83
+
84
+ # PyBuilder
85
+ target/
86
+
87
+ # Jupyter Notebook
88
+ .ipynb_checkpoints
89
+
90
+ # IPython
91
+ profile_default/
92
+ ipython_config.py
93
+
94
+ # pyenv
95
+ .python-version
96
+
97
+ # celery beat schedule file
98
+ celerybeat-schedule
99
+
100
+ # SageMath parsed files
101
+ *.sage.py
102
+
103
+ # Environments
104
+ .env
105
+ .venv
106
+ env/
107
+ venv/
108
+ ENV/
109
+ env.bak/
110
+ venv.bak/
111
+
112
+ # Spyder project settings
113
+ .spyderproject
114
+ .spyproject
115
+
116
+ # Rope project settings
117
+ .ropeproject
118
+
119
+ # mkdocs documentation
120
+ /site
121
+
122
+ # mypy
123
+ .mypy_cache/
124
+ .dmypy.json
125
+ dmypy.json
126
+
127
+ # Pyre type checker
128
+ .pyre/
129
+
130
+ ### Python Patch ###
131
+ .venv/
132
+
133
+ # End of https://www.gitignore.io/api/python
134
+
@@ -0,0 +1,20 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0
4
+
5
+ First release on PyPI, as `aioboinc`. It is [nielstron/pyboinc](https://github.com/nielstron/pyboinc)
6
+ at its last commit (`f8a31de`, 2022-10-16) plus:
7
+
8
+ - **Renamed** the package from `pyboinc` to `aioboinc`, to match the name it is installed by.
9
+ Code written against the original needs its imports changed from `pyboinc` to `aioboinc`.
10
+ - **Fixed** `set_run_mode()`, `set_network_mode()` and `set_gpu_mode()`. All three raised `TypeError`
11
+ before sending anything, so none of them could ever have worked. The duration is now sent, so a
12
+ temporary change is temporary.
13
+ - **Fixed** a reply that does not come from a BOINC client going unnoticed when Python runs with
14
+ `-O`, because the check was an `assert`.
15
+ - **Fixed** `Project` not being usable in a set or as a dictionary key.
16
+ - **Added** `RPCClient.close()`. The connection was never closed, which leaked a socket for every
17
+ client created.
18
+ - Tests run against a fake BOINC client instead of needing a real one on `localhost`, and cover
19
+ every request the client can make.
20
+ - Requires Python 3.10 or later.
aioboinc-0.1.0/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 nielstron
4
+ Copyright (c) 2026 Hector Espert
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
@@ -0,0 +1,135 @@
1
+ Metadata-Version: 2.5
2
+ Name: aioboinc
3
+ Version: 0.1.0
4
+ Summary: Asyncio client for the BOINC GUI RPC protocol: monitor and control BOINC clients
5
+ Project-URL: Homepage, https://github.com/hectorespert/aioboinc
6
+ Project-URL: Changelog, https://github.com/hectorespert/aioboinc/blob/main/CHANGELOG.md
7
+ Project-URL: Issues, https://github.com/hectorespert/aioboinc/issues
8
+ Project-URL: Upstream, https://github.com/nielstron/pyboinc
9
+ Author-email: nielstron <n.muendler@web.de>
10
+ Maintainer: Hector Espert
11
+ License-Expression: MIT
12
+ License-File: LICENSE
13
+ Keywords: asyncio,boinc,gui rpc,rpc,volunteer computing
14
+ Classifier: Development Status :: 3 - Alpha
15
+ Classifier: Framework :: AsyncIO
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Programming Language :: Python :: 3.14
24
+ Classifier: Topic :: Scientific/Engineering
25
+ Classifier: Topic :: Software Development :: Libraries
26
+ Requires-Python: >=3.10
27
+ Description-Content-Type: text/markdown
28
+
29
+ # aioboinc
30
+
31
+ [![Test](https://github.com/hectorespert/aioboinc/actions/workflows/test.yml/badge.svg)](https://github.com/hectorespert/aioboinc/actions/workflows/test.yml)
32
+ [![Coverage](https://raw.githubusercontent.com/hectorespert/aioboinc/python-coverage-comment-action-data/badge.svg)](https://htmlpreview.github.io/?https://github.com/hectorespert/aioboinc/blob/python-coverage-comment-action-data/htmlcov/index.html)
33
+ [![PyPI](https://img.shields.io/pypi/v/aioboinc)](https://pypi.org/project/aioboinc/)
34
+
35
+ A small package to talk to a [BOINC](https://boinc.berkeley.edu/) client from Python using asyncio,
36
+ based on the [BOINC GUI RPC Protocol](https://boinc.berkeley.edu/trac/wiki/GuiRpcProtocol).
37
+ It is meant for monitoring and controlling a BOINC client and does not cover the whole protocol.
38
+ It has no dependencies outside the standard library.
39
+
40
+ This is a maintained fork of [nielstron/pyboinc](https://github.com/nielstron/pyboinc), which was
41
+ never published to PyPI. What differs from upstream is listed in the [changelog](CHANGELOG.md).
42
+
43
+ ### Coming from `pyboinc`
44
+
45
+ The package is imported as `aioboinc`, not `pyboinc`. Nothing else changed, so moving over is a
46
+ rename of the imports:
47
+
48
+ ```python
49
+ from aioboinc import init_rpc_client
50
+ from aioboinc.rpc_client import Mode
51
+ ```
52
+
53
+ ## Installation
54
+
55
+ ```
56
+ pip install aioboinc
57
+ ```
58
+
59
+ ## Usage
60
+
61
+ ```python
62
+ import asyncio
63
+
64
+ from aioboinc import init_rpc_client
65
+ from aioboinc.rpc_client import Mode
66
+
67
+ IP_BOINC = "127.0.0.1"
68
+ PASSWORD_BOINC = "example_password"
69
+
70
+
71
+ async def main():
72
+ rpc_client = await init_rpc_client(IP_BOINC, PASSWORD_BOINC)
73
+ try:
74
+ # Connecting does not authenticate. Do it before anything else and check the answer:
75
+ # without it BOINC refuses to change anything and gives incomplete answers to queries.
76
+ if not await rpc_client.authorize():
77
+ raise SystemExit("Wrong password")
78
+
79
+ print(await rpc_client.get_cc_status())
80
+ print(await rpc_client.get_project_status())
81
+
82
+ # Get the last three messages
83
+ c = await rpc_client.get_message_count()
84
+ print(await rpc_client.get_messages(c - 3))
85
+
86
+ # Get the tasks. With no tasks this is the string "\n" rather than an empty list.
87
+ results = await rpc_client.get_results()
88
+ print(results)
89
+
90
+ # Suspend a task and resume it
91
+ if isinstance(results, list) and results:
92
+ task = (results[0]["project_url"], results[0]["name"])
93
+ print(await rpc_client.suspend_result(*task))
94
+ print(await rpc_client.resume_result(*task))
95
+
96
+ # Stop computing for an hour, then go back to what was configured.
97
+ # A duration of 0, the default, makes the change permanent.
98
+ print(await rpc_client.set_run_mode(Mode.NEVER, 3600))
99
+ finally:
100
+ await rpc_client.close()
101
+
102
+
103
+ asyncio.run(main())
104
+ ```
105
+
106
+ ## Development
107
+
108
+ ```
109
+ python -m unittest discover -s tests -t .
110
+ ```
111
+
112
+ The tests talk to a fake BOINC client on a local socket; no BOINC installation is needed.
113
+
114
+ To see what the tests cover, run them under [coverage.py](https://coverage.readthedocs.io/):
115
+
116
+ ```
117
+ pip install coverage
118
+ coverage run -m unittest discover -s tests -t .
119
+ coverage report
120
+ ```
121
+
122
+ CI fails below 95 %, and every pull request gets a comment with what it changes.
123
+
124
+ The code is linted with [ruff](https://docs.astral.sh/ruff/) and its types are checked with
125
+ [mypy](https://mypy-lang.org/). CI requires both to pass:
126
+
127
+ ```
128
+ pip install ruff mypy
129
+ ruff check .
130
+ mypy
131
+ ```
132
+
133
+ ## License
134
+
135
+ MIT, see [LICENSE](LICENSE). Copyright of the original work remains with its author.
@@ -0,0 +1,107 @@
1
+ # aioboinc
2
+
3
+ [![Test](https://github.com/hectorespert/aioboinc/actions/workflows/test.yml/badge.svg)](https://github.com/hectorespert/aioboinc/actions/workflows/test.yml)
4
+ [![Coverage](https://raw.githubusercontent.com/hectorespert/aioboinc/python-coverage-comment-action-data/badge.svg)](https://htmlpreview.github.io/?https://github.com/hectorespert/aioboinc/blob/python-coverage-comment-action-data/htmlcov/index.html)
5
+ [![PyPI](https://img.shields.io/pypi/v/aioboinc)](https://pypi.org/project/aioboinc/)
6
+
7
+ A small package to talk to a [BOINC](https://boinc.berkeley.edu/) client from Python using asyncio,
8
+ based on the [BOINC GUI RPC Protocol](https://boinc.berkeley.edu/trac/wiki/GuiRpcProtocol).
9
+ It is meant for monitoring and controlling a BOINC client and does not cover the whole protocol.
10
+ It has no dependencies outside the standard library.
11
+
12
+ This is a maintained fork of [nielstron/pyboinc](https://github.com/nielstron/pyboinc), which was
13
+ never published to PyPI. What differs from upstream is listed in the [changelog](CHANGELOG.md).
14
+
15
+ ### Coming from `pyboinc`
16
+
17
+ The package is imported as `aioboinc`, not `pyboinc`. Nothing else changed, so moving over is a
18
+ rename of the imports:
19
+
20
+ ```python
21
+ from aioboinc import init_rpc_client
22
+ from aioboinc.rpc_client import Mode
23
+ ```
24
+
25
+ ## Installation
26
+
27
+ ```
28
+ pip install aioboinc
29
+ ```
30
+
31
+ ## Usage
32
+
33
+ ```python
34
+ import asyncio
35
+
36
+ from aioboinc import init_rpc_client
37
+ from aioboinc.rpc_client import Mode
38
+
39
+ IP_BOINC = "127.0.0.1"
40
+ PASSWORD_BOINC = "example_password"
41
+
42
+
43
+ async def main():
44
+ rpc_client = await init_rpc_client(IP_BOINC, PASSWORD_BOINC)
45
+ try:
46
+ # Connecting does not authenticate. Do it before anything else and check the answer:
47
+ # without it BOINC refuses to change anything and gives incomplete answers to queries.
48
+ if not await rpc_client.authorize():
49
+ raise SystemExit("Wrong password")
50
+
51
+ print(await rpc_client.get_cc_status())
52
+ print(await rpc_client.get_project_status())
53
+
54
+ # Get the last three messages
55
+ c = await rpc_client.get_message_count()
56
+ print(await rpc_client.get_messages(c - 3))
57
+
58
+ # Get the tasks. With no tasks this is the string "\n" rather than an empty list.
59
+ results = await rpc_client.get_results()
60
+ print(results)
61
+
62
+ # Suspend a task and resume it
63
+ if isinstance(results, list) and results:
64
+ task = (results[0]["project_url"], results[0]["name"])
65
+ print(await rpc_client.suspend_result(*task))
66
+ print(await rpc_client.resume_result(*task))
67
+
68
+ # Stop computing for an hour, then go back to what was configured.
69
+ # A duration of 0, the default, makes the change permanent.
70
+ print(await rpc_client.set_run_mode(Mode.NEVER, 3600))
71
+ finally:
72
+ await rpc_client.close()
73
+
74
+
75
+ asyncio.run(main())
76
+ ```
77
+
78
+ ## Development
79
+
80
+ ```
81
+ python -m unittest discover -s tests -t .
82
+ ```
83
+
84
+ The tests talk to a fake BOINC client on a local socket; no BOINC installation is needed.
85
+
86
+ To see what the tests cover, run them under [coverage.py](https://coverage.readthedocs.io/):
87
+
88
+ ```
89
+ pip install coverage
90
+ coverage run -m unittest discover -s tests -t .
91
+ coverage report
92
+ ```
93
+
94
+ CI fails below 95 %, and every pull request gets a comment with what it changes.
95
+
96
+ The code is linted with [ruff](https://docs.astral.sh/ruff/) and its types are checked with
97
+ [mypy](https://mypy-lang.org/). CI requires both to pass:
98
+
99
+ ```
100
+ pip install ruff mypy
101
+ ruff check .
102
+ mypy
103
+ ```
104
+
105
+ ## License
106
+
107
+ MIT, see [LICENSE](LICENSE). Copyright of the original work remains with its author.
@@ -0,0 +1,3 @@
1
+ from .rpc_client import init_rpc_client
2
+
3
+ __all__ = ["init_rpc_client"]
@@ -0,0 +1,112 @@
1
+ # generated by h_to_py.py
2
+ from enum import Enum
3
+
4
+
5
+ class Constants:
6
+ BATCH_STATE_ABORTED = 3
7
+ BATCH_STATE_COMPLETE = 2
8
+ BATCH_STATE_INIT = 0
9
+ BATCH_STATE_IN_PROGRESS = 1
10
+ BATCH_STATE_RETIRED = 4
11
+ COBBLESTONE_SCALE = 200
12
+ CPU_SCHED_PREEMPTED = 1
13
+ CPU_SCHED_SCHEDULED = 2
14
+ CPU_SCHED_UNINITIALIZED = 0
15
+ CREDIT_TYPE_FLOPS = 0
16
+ CREDIT_TYPE_NETWORK = 2
17
+ CREDIT_TYPE_PROJECT = 3
18
+ CREDIT_TYPE_STORAGE = 1
19
+ FILE_NOT_PRESENT = 0
20
+ FILE_PRESENT = 1
21
+ FILE_VERIFY_PENDING = 2
22
+ GUI_RPC_PORT = 31416
23
+ HTTP_STATUS_BAD_GATEWAY = 502
24
+ HTTP_STATUS_CLIENT_ERROR = 400
25
+ HTTP_STATUS_CONTINUE = 100
26
+ HTTP_STATUS_EXPECTATION_FAILED = 417
27
+ HTTP_STATUS_GATEWAY_TIMEOUT = 504
28
+ HTTP_STATUS_INTERNAL_SERVER_ERROR = 500
29
+ HTTP_STATUS_MOVED_PERM = 301
30
+ HTTP_STATUS_MOVED_TEMP = 302
31
+ HTTP_STATUS_NOT_FOUND = 404
32
+ HTTP_STATUS_NOT_IMPLEMENTED = 501
33
+ HTTP_STATUS_OK = 200
34
+ HTTP_STATUS_PARTIAL_CONTENT = 206
35
+ HTTP_STATUS_PROXY_AUTH_REQ = 407
36
+ HTTP_STATUS_RANGE_REQUEST_ERROR = 416
37
+ HTTP_STATUS_SERVICE_UNAVAILABLE = 503
38
+ MODE_BLANKSCREEN = 4
39
+ MODE_FULLSCREEN = 3
40
+ MODE_HIDE_GRAPHICS = 1
41
+ MODE_QUIT = 6
42
+ MODE_REREAD_PREFS = 5
43
+ MODE_UNSUPPORTED = 0
44
+ MODE_WINDOW = 2
45
+ MSG_INFO = 1
46
+ MSG_INTERNAL_ERROR = 3
47
+ MSG_SCHEDULER_ALERT = 4
48
+ MSG_USER_ALERT = 2
49
+ NETWORK_STATUS_LOOKUP_PENDING = 3
50
+ NETWORK_STATUS_ONLINE = 0
51
+ NETWORK_STATUS_WANT_CONNECTION = 1
52
+ NETWORK_STATUS_WANT_DISCONNECT = 2
53
+ NGRAPHICS_MSGS = 7
54
+ PROCESS_ABORTED = 6
55
+ PROCESS_ABORT_PENDING = 5
56
+ PROCESS_COPY_PENDING = 10
57
+ PROCESS_COULDNT_START = 7
58
+ PROCESS_EXECUTING = 1
59
+ PROCESS_EXITED = 2
60
+ PROCESS_EXIT_UNKNOWN = 4
61
+ PROCESS_PRIORITY_HIGH = 4
62
+ PROCESS_PRIORITY_HIGHEST = 5
63
+ PROCESS_PRIORITY_LOW = 2
64
+ PROCESS_PRIORITY_LOWEST = 1
65
+ PROCESS_PRIORITY_NORMAL = 3
66
+ PROCESS_PRIORITY_UNSPECIFIED = 0
67
+ PROCESS_QUIT_PENDING = 8
68
+ PROCESS_SUSPENDED = 9
69
+ PROCESS_UNINITIALIZED = 0
70
+ PROCESS_WAS_SIGNALED = 3
71
+ RESULT_ABORTED = 6
72
+ RESULT_COMPUTE_ERROR = 3
73
+ RESULT_FILES_DOWNLOADED = 2
74
+ RESULT_FILES_DOWNLOADING = 1
75
+ RESULT_FILES_UPLOADED = 5
76
+ RESULT_FILES_UPLOADING = 4
77
+ RESULT_NEW = 0
78
+ RESULT_UPLOAD_FAILED = 7
79
+ RPC_REASON_ACCT_MGR_REQ = 5
80
+ RPC_REASON_INIT = 6
81
+ RPC_REASON_NEED_WORK = 3
82
+ RPC_REASON_PROJECT_REQ = 7
83
+ RPC_REASON_RESULTS_DUE = 2
84
+ RPC_REASON_TRICKLE_UP = 4
85
+ RPC_REASON_USER_REQ = 1
86
+ RUN_MODE_ALWAYS = 1
87
+ RUN_MODE_AUTO = 2
88
+ RUN_MODE_NEVER = 3
89
+ RUN_MODE_RESTORE = 4
90
+
91
+
92
+ class SUSPEND_REASON(Enum):
93
+ SUSPEND_REASON_USER_ACTIVE = 2
94
+ SUSPEND_REASON_BATTERIES = 1
95
+ SUSPEND_REASON_USER_REQ = 4
96
+ SUSPEND_REASON_BENCHMARKS = 16
97
+ SUSPEND_REASON_EXCLUSIVE_APP_RUNNING = 512
98
+ SUSPEND_REASON_BATTERY_CHARGING = 4098
99
+ SUSPEND_REASON_CPU_THROTTLE = 64
100
+ SUSPEND_REASON_INITIAL_DELAY = 256
101
+ SUSPEND_REASON_OS = 4096
102
+ SUSPEND_REASON_WIFI_STATE = 4097
103
+ SUSPEND_REASON_BATTERY_OVERHEATED = 4099
104
+ SUSPEND_REASON_CPU_USAGE = 1024
105
+ SUSPEND_REASON_DISK_SIZE = 32
106
+ SUSPEND_REASON_NETWORK_QUOTA_EXCEEDED = 2048
107
+ SUSPEND_REASON_NO_RECENT_INPUT = 128
108
+ SUSPEND_REASON_TIME_OF_DAY = 8
109
+
110
+
111
+ class BATTERY_STATE(Enum):
112
+ BATTERY_STATE_UNKNOWN = 0