rpacore 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.
- rpacore-0.1.0/LICENSE +201 -0
- rpacore-0.1.0/NOTICE +4 -0
- rpacore-0.1.0/PKG-INFO +427 -0
- rpacore-0.1.0/README.md +393 -0
- rpacore-0.1.0/pyproject.toml +53 -0
- rpacore-0.1.0/rpacore/__init__.py +93 -0
- rpacore-0.1.0/rpacore/_json_state.py +66 -0
- rpacore-0.1.0/rpacore/_validation.py +104 -0
- rpacore-0.1.0/rpacore/cli.py +547 -0
- rpacore-0.1.0/rpacore/config.py +129 -0
- rpacore-0.1.0/rpacore/config_validation.py +141 -0
- rpacore-0.1.0/rpacore/context.py +128 -0
- rpacore-0.1.0/rpacore/credentials.py +101 -0
- rpacore-0.1.0/rpacore/engine.py +378 -0
- rpacore-0.1.0/rpacore/exceptions.py +69 -0
- rpacore-0.1.0/rpacore/logger.py +128 -0
- rpacore-0.1.0/rpacore/manifest.py +194 -0
- rpacore-0.1.0/rpacore/notify.py +316 -0
- rpacore-0.1.0/rpacore/paths.py +88 -0
- rpacore-0.1.0/rpacore/persistence.py +692 -0
- rpacore-0.1.0/rpacore/queue.py +543 -0
- rpacore-0.1.0/rpacore/recovery.py +109 -0
- rpacore-0.1.0/rpacore/report.py +388 -0
- rpacore-0.1.0/rpacore/runner.py +1023 -0
- rpacore-0.1.0/rpacore/screenshot.py +45 -0
- rpacore-0.1.0/rpacore/serialization.py +115 -0
- rpacore-0.1.0/rpacore/skill.py +40 -0
- rpacore-0.1.0/rpacore/status.py +17 -0
- rpacore-0.1.0/rpacore/transaction.py +156 -0
- rpacore-0.1.0/rpacore.egg-info/PKG-INFO +427 -0
- rpacore-0.1.0/rpacore.egg-info/SOURCES.txt +66 -0
- rpacore-0.1.0/rpacore.egg-info/dependency_links.txt +1 -0
- rpacore-0.1.0/rpacore.egg-info/entry_points.txt +2 -0
- rpacore-0.1.0/rpacore.egg-info/requires.txt +12 -0
- rpacore-0.1.0/rpacore.egg-info/top_level.txt +1 -0
- rpacore-0.1.0/setup.cfg +4 -0
- rpacore-0.1.0/tests/test_cli.py +785 -0
- rpacore-0.1.0/tests/test_config.py +327 -0
- rpacore-0.1.0/tests/test_config_validation.py +159 -0
- rpacore-0.1.0/tests/test_context.py +228 -0
- rpacore-0.1.0/tests/test_credentials.py +155 -0
- rpacore-0.1.0/tests/test_docs_verification.py +317 -0
- rpacore-0.1.0/tests/test_e2e.py +218 -0
- rpacore-0.1.0/tests/test_engine.py +1024 -0
- rpacore-0.1.0/tests/test_examples_wheel_validation.py +1307 -0
- rpacore-0.1.0/tests/test_exceptions.py +106 -0
- rpacore-0.1.0/tests/test_installed_wheel_validation.py +438 -0
- rpacore-0.1.0/tests/test_json_state.py +39 -0
- rpacore-0.1.0/tests/test_logger.py +300 -0
- rpacore-0.1.0/tests/test_manifest.py +277 -0
- rpacore-0.1.0/tests/test_notify.py +727 -0
- rpacore-0.1.0/tests/test_package.py +215 -0
- rpacore-0.1.0/tests/test_paths.py +207 -0
- rpacore-0.1.0/tests/test_persistence.py +1152 -0
- rpacore-0.1.0/tests/test_queue.py +1000 -0
- rpacore-0.1.0/tests/test_recovery.py +418 -0
- rpacore-0.1.0/tests/test_release_candidate_validation.py +1621 -0
- rpacore-0.1.0/tests/test_release_manifest.py +1250 -0
- rpacore-0.1.0/tests/test_report.py +634 -0
- rpacore-0.1.0/tests/test_runner.py +1982 -0
- rpacore-0.1.0/tests/test_sample_main.py +60 -0
- rpacore-0.1.0/tests/test_sample_skill.py +164 -0
- rpacore-0.1.0/tests/test_screenshot.py +161 -0
- rpacore-0.1.0/tests/test_serialization.py +229 -0
- rpacore-0.1.0/tests/test_skill.py +113 -0
- rpacore-0.1.0/tests/test_status.py +52 -0
- rpacore-0.1.0/tests/test_transaction.py +304 -0
- rpacore-0.1.0/tests/test_validation_helpers.py +175 -0
rpacore-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
rpacore-0.1.0/NOTICE
ADDED
rpacore-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: rpacore
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: RPA Core — deterministic, stateful RPA in Python
|
|
5
|
+
Author: Renato Moselli
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://rpacore.dev
|
|
8
|
+
Project-URL: Documentation, https://github.com/renatomoselli/rpacore/tree/main/docs
|
|
9
|
+
Project-URL: Repository, https://github.com/renatomoselli/rpacore
|
|
10
|
+
Project-URL: Issues, https://github.com/renatomoselli/rpacore/issues
|
|
11
|
+
Project-URL: Security, https://github.com/renatomoselli/rpacore/security/advisories/new
|
|
12
|
+
Keywords: rpa,automation,workflow,enterprise
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
License-File: NOTICE
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: pytest>=8.1.1; extra == "dev"
|
|
26
|
+
Requires-Dist: build>=1.0; extra == "dev"
|
|
27
|
+
Requires-Dist: twine>=5.1.0; extra == "dev"
|
|
28
|
+
Requires-Dist: wheel>=0.46.2; extra == "dev"
|
|
29
|
+
Provides-Extra: screenshots
|
|
30
|
+
Requires-Dist: mss>=9.0; extra == "screenshots"
|
|
31
|
+
Provides-Extra: keyring
|
|
32
|
+
Requires-Dist: keyring; extra == "keyring"
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
# RPA Core
|
|
36
|
+
|
|
37
|
+
Deterministic, stateful RPA in Python for code-first enterprise automation.
|
|
38
|
+
|
|
39
|
+
Requires Python 3.11+.
|
|
40
|
+
|
|
41
|
+
## Package Name
|
|
42
|
+
|
|
43
|
+
The public project name is **RPA Core**. The package, import path, and CLI
|
|
44
|
+
command are `rpacore`.
|
|
45
|
+
|
|
46
|
+
## What Is RPA Core?
|
|
47
|
+
|
|
48
|
+
RPA Core is a pip-installable Python library for building reliable, auditable
|
|
49
|
+
robotic process automations. Define your skills, wire them into a transaction,
|
|
50
|
+
and the framework handles execution order, retry logic, persistence, logging,
|
|
51
|
+
queues, reports, credentials, and notifications.
|
|
52
|
+
|
|
53
|
+
The long-term product direction is:
|
|
54
|
+
|
|
55
|
+
> AI-assisted development, deterministic execution.
|
|
56
|
+
|
|
57
|
+
That means RPA Core should be friendly to humans and AI coding agents, but the
|
|
58
|
+
runtime remains deterministic. There are no runtime AI dependencies.
|
|
59
|
+
|
|
60
|
+
Core traits:
|
|
61
|
+
|
|
62
|
+
- **Deterministic execution**: predictable behavior, no hidden runtime magic.
|
|
63
|
+
- **Stateful transactions**: every skill's status is tracked and persisted.
|
|
64
|
+
- **Idempotent retries**: resume from failure and re-run only failed work.
|
|
65
|
+
- **Explicit exceptions**: business rule failures and system failures are
|
|
66
|
+
classified separately.
|
|
67
|
+
- **Structured logging**: text or JSON output through stdlib logging.
|
|
68
|
+
- **TOML configuration**: externalized settings with simple defaults.
|
|
69
|
+
- **SQLite persistence**: local transaction history without a service.
|
|
70
|
+
- **Queue processing**: SQLite-backed queue with atomic item claiming.
|
|
71
|
+
- **Reports and notifications**: text/HTML reports, SMTP email, and webhooks.
|
|
72
|
+
|
|
73
|
+
## Installation
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
pip install rpacore
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
For complete documentation, start at [docs/README.md](docs/README.md). See
|
|
80
|
+
[CHANGELOG.md](CHANGELOG.md) for the v0.1.0 compatibility baseline. For
|
|
81
|
+
maintainer validation and release scripts, see [scripts/](scripts/); these
|
|
82
|
+
scripts are intentionally separate from the runtime package.
|
|
83
|
+
|
|
84
|
+
Community and release-readiness routes:
|
|
85
|
+
|
|
86
|
+
- [Security Policy](SECURITY.md)
|
|
87
|
+
- [Contributing](CONTRIBUTING.md)
|
|
88
|
+
- [Support](SUPPORT.md)
|
|
89
|
+
- [Code of Conduct](CODE_OF_CONDUCT.md)
|
|
90
|
+
- [Maintainers](MAINTAINERS.md)
|
|
91
|
+
- [Governance and Release Process](docs/governance.md)
|
|
92
|
+
|
|
93
|
+
## Quick Start
|
|
94
|
+
|
|
95
|
+
```python
|
|
96
|
+
from rpacore import (
|
|
97
|
+
Engine,
|
|
98
|
+
ProcessContext,
|
|
99
|
+
Transaction,
|
|
100
|
+
configure_logger,
|
|
101
|
+
load_config,
|
|
102
|
+
save_transaction,
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
from my_skills import FetchRecord, ProcessRecord, WriteOutput
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
config = load_config("config.toml")
|
|
109
|
+
configure_logger(level=config["log_level"], fmt=config["log_format"])
|
|
110
|
+
|
|
111
|
+
tx = Transaction(reference="my-automation")
|
|
112
|
+
tx.skills = [
|
|
113
|
+
FetchRecord(
|
|
114
|
+
name="fetch_record",
|
|
115
|
+
execution_order=1,
|
|
116
|
+
arguments={"record_id": "ABC-001"},
|
|
117
|
+
),
|
|
118
|
+
ProcessRecord(name="process_record", execution_order=2),
|
|
119
|
+
WriteOutput(name="write_output", execution_order=3),
|
|
120
|
+
]
|
|
121
|
+
|
|
122
|
+
ctx = ProcessContext(transaction=tx, config=config)
|
|
123
|
+
Engine(
|
|
124
|
+
max_retries=config["max_retries"],
|
|
125
|
+
retry_delay=config["retry_delay"],
|
|
126
|
+
retry_backoff=config["retry_backoff"],
|
|
127
|
+
).run(
|
|
128
|
+
ctx,
|
|
129
|
+
checkpoint=lambda transaction: save_transaction(
|
|
130
|
+
transaction,
|
|
131
|
+
db_path=config["transaction_db_path"],
|
|
132
|
+
),
|
|
133
|
+
)
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## CLI
|
|
137
|
+
|
|
138
|
+
Create a new project scaffold:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
rpacore init my_project
|
|
142
|
+
cd my_project
|
|
143
|
+
rpacore run
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
`rpacore init <project_name>` creates a normal Python project with
|
|
147
|
+
`pyproject.toml`, `rpacore.toml`, `config.toml`, `main.py`, a `skills/` package,
|
|
148
|
+
a pytest skill test, and `.gitignore`. Skill tests use normal pytest with
|
|
149
|
+
plain skill instances and `ProcessContext`; see [Testing RPA Core Skills](docs/testing.md).
|
|
150
|
+
|
|
151
|
+
`rpacore run` discovers `rpacore.toml` from the current directory, resolves the
|
|
152
|
+
declared `module:callable` entrypoint, and invokes it. The CLI does not build
|
|
153
|
+
skills, transactions, config, or persistence automatically; that wiring remains
|
|
154
|
+
in project Python code.
|
|
155
|
+
|
|
156
|
+
Inspect persisted local transactions:
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
rpacore transaction list
|
|
160
|
+
rpacore transaction list --json
|
|
161
|
+
rpacore transaction show <transaction_id>
|
|
162
|
+
rpacore transaction show <transaction_id> --json
|
|
163
|
+
rpacore transaction export --format json
|
|
164
|
+
rpacore transaction export --format ndjson
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Transaction inspection uses `[storage].transaction_db_path` from `rpacore.toml`
|
|
168
|
+
by default. Pass `--db path/to/rpacore.db` to inspect a specific database.
|
|
169
|
+
`--db` paths are resolved relative to the current working directory; manifest
|
|
170
|
+
storage paths are resolved relative to `rpacore.toml`. `transaction list`
|
|
171
|
+
returns the latest 100 transactions by default; pass `--limit N` to choose a
|
|
172
|
+
different cap. Human output is intended for operators; `--json` writes parseable
|
|
173
|
+
JSON to stdout with diagnostics only on stderr. Transaction inspection JSON uses
|
|
174
|
+
`schema_version = 1` and embeds the canonical transaction record with
|
|
175
|
+
`transaction_format_version = 1`.
|
|
176
|
+
|
|
177
|
+
Transaction export writes portable machine-readable records for all persisted
|
|
178
|
+
transactions. JSON export uses an envelope with `export_format_version = 1`,
|
|
179
|
+
`framework_version`, `exported_at`, and `transactions`. NDJSON export writes one
|
|
180
|
+
record per line with `export_format_version = 1` on each record.
|
|
181
|
+
|
|
182
|
+
Machine-readable transaction records include user-supplied state, metadata,
|
|
183
|
+
skill arguments, exception messages, and artifact metadata. These fields can
|
|
184
|
+
contain sensitive business data. They never include resources, config,
|
|
185
|
+
credentials, or artifact file contents. Webhook notifications preserve their
|
|
186
|
+
compact payload shape by default while including report metadata and artifact
|
|
187
|
+
records. Set
|
|
188
|
+
`[notification.webhook].include_transaction = true` to include the canonical
|
|
189
|
+
transaction record in the webhook JSON payload.
|
|
190
|
+
|
|
191
|
+
Webhook URLs must use `http` or `https`. Local, private, loopback, and
|
|
192
|
+
link-local hosts are allowed because webhook endpoints are trusted operator
|
|
193
|
+
configuration in local automation deployments. Treat webhook config as
|
|
194
|
+
sensitive: outbound requests can still reach internal services. The stdlib URL
|
|
195
|
+
open timeout bounds socket operations after resolution starts, but it does not
|
|
196
|
+
fully control operating-system DNS resolution latency.
|
|
197
|
+
|
|
198
|
+
Email notifications attach screenshots referenced by exception reports only
|
|
199
|
+
when `[notification.email].attach_screenshots` is true, which is the default.
|
|
200
|
+
Missing or unreadable screenshot files are skipped; report and notification
|
|
201
|
+
payloads include artifact records and paths, not artifact file contents.
|
|
202
|
+
|
|
203
|
+
Set `log_format = "json"` and pass it to `configure_logger(..., fmt=...)` for
|
|
204
|
+
line-delimited JSON logs. Each JSON log line contains `log_format_version`,
|
|
205
|
+
UTC `timestamp`, `event`, `level`, and `message`, plus sanitized event fields.
|
|
206
|
+
|
|
207
|
+
Exit behavior is stable across platforms:
|
|
208
|
+
|
|
209
|
+
- entrypoint returns `None`: exit `0`
|
|
210
|
+
- entrypoint returns an integer from `0` through `255`: propagate it
|
|
211
|
+
- entrypoint or framework execution raises: exit `1` with diagnostics on stderr
|
|
212
|
+
- CLI usage errors, invalid manifests, entrypoint-resolution errors, or invalid
|
|
213
|
+
return values: exit `2`
|
|
214
|
+
|
|
215
|
+
`rpacore version` prints the installed framework version.
|
|
216
|
+
|
|
217
|
+
## Writing a Skill
|
|
218
|
+
|
|
219
|
+
```python
|
|
220
|
+
from rpacore import BusinessException, ProcessContext, Skill
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
class FetchRecord(Skill):
|
|
224
|
+
def execute(self, ctx: ProcessContext) -> None:
|
|
225
|
+
record_id = self.arguments.get("record_id")
|
|
226
|
+
if not record_id:
|
|
227
|
+
raise BusinessException(
|
|
228
|
+
message="record_id is required",
|
|
229
|
+
action="FetchRecord",
|
|
230
|
+
)
|
|
231
|
+
|
|
232
|
+
# Fetch and store durable state for later skills.
|
|
233
|
+
ctx.state["record"] = {"id": record_id}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
## Project Structure
|
|
237
|
+
|
|
238
|
+
```text
|
|
239
|
+
rpacore/ # Framework core
|
|
240
|
+
__init__.py # Public API re-exports
|
|
241
|
+
exceptions.py # BusinessException, SystemException
|
|
242
|
+
status.py # Status enum
|
|
243
|
+
skill.py # Skill base class
|
|
244
|
+
transaction.py # Transaction model
|
|
245
|
+
engine.py # Execution engine
|
|
246
|
+
persistence.py # SQLite persistence
|
|
247
|
+
logger.py # Logging helpers
|
|
248
|
+
config.py # Configuration loader
|
|
249
|
+
context.py # ProcessContext
|
|
250
|
+
credentials.py # Credential providers
|
|
251
|
+
queue.py # SqliteQueue, QueueProvider
|
|
252
|
+
runner.py # run_queue_loop
|
|
253
|
+
report.py # Report generation and rendering
|
|
254
|
+
notify.py # Email and webhook notifications
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
User automations should live outside `rpacore/`, usually in their own repository
|
|
258
|
+
with a `skills/` package and a small `main.py` wiring layer.
|
|
259
|
+
|
|
260
|
+
## Execution Model
|
|
261
|
+
|
|
262
|
+
```text
|
|
263
|
+
main.py
|
|
264
|
+
load_config()
|
|
265
|
+
configure_logger()
|
|
266
|
+
create Transaction
|
|
267
|
+
attach ordered Skills
|
|
268
|
+
create ProcessContext
|
|
269
|
+
Engine.run(ctx, checkpoint=save_transaction)
|
|
270
|
+
generate report / dispatch notifications
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
Transaction lifecycle:
|
|
274
|
+
|
|
275
|
+
```text
|
|
276
|
+
PENDING -> IN_PROGRESS -> SUCCESSFUL
|
|
277
|
+
-> FAILED
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
`Engine.run()` validates transaction wiring before any skill runs. Transaction
|
|
281
|
+
references and skill names must be non-empty, skill names must be unique within
|
|
282
|
+
the transaction, and skill execution orders must be unique positive integers.
|
|
283
|
+
Malformed wiring raises `ExecutionValidationError`, marks the transaction
|
|
284
|
+
`FAILED`, and should be treated as a permanent configuration or code issue, not
|
|
285
|
+
as a retryable runtime failure. The same validation applies to loaded
|
|
286
|
+
transactions before resume, so persisted malformed skill wiring must be fixed
|
|
287
|
+
rather than silently re-run.
|
|
288
|
+
|
|
289
|
+
Persistence is written by user wiring through `save_transaction()`. For strict
|
|
290
|
+
crash boundaries, pass that persistence call as `Engine.run(checkpoint=...)`;
|
|
291
|
+
the engine checkpoints after each transaction or skill state transition. Without
|
|
292
|
+
a checkpoint callback, user code may still save only after `Engine.run()`
|
|
293
|
+
returns. Loading a persisted transaction resets any `IN_PROGRESS` transaction or
|
|
294
|
+
skill to `FAILED`.
|
|
295
|
+
|
|
296
|
+
## Configuration
|
|
297
|
+
|
|
298
|
+
Create a `rpacore.toml` in your project to declare the Python entrypoint and
|
|
299
|
+
transaction storage:
|
|
300
|
+
|
|
301
|
+
```toml
|
|
302
|
+
[project]
|
|
303
|
+
entrypoint = "main:main"
|
|
304
|
+
|
|
305
|
+
[storage]
|
|
306
|
+
transaction_db_path = "rpacore.db"
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
`rpacore.toml` is intentionally small. Skill construction and transaction wiring
|
|
310
|
+
stay in Python; the manifest does not define pipelines or automatic skill
|
|
311
|
+
discovery. See `docs/project-manifest.md` for the full schema.
|
|
312
|
+
|
|
313
|
+
When both `rpacore.toml` and `config.toml` are present, the value passed to the
|
|
314
|
+
runner or storage layer by user wiring still decides which transaction database
|
|
315
|
+
is used. Queue settings, retry settings, credentials, screenshots, and
|
|
316
|
+
notifications remain `config.toml` settings; they are not part of the project
|
|
317
|
+
manifest schema.
|
|
318
|
+
|
|
319
|
+
Create a `config.toml` in your project:
|
|
320
|
+
|
|
321
|
+
```toml
|
|
322
|
+
max_retries = 2
|
|
323
|
+
retry_delay = 0.0
|
|
324
|
+
retry_backoff = 1.0
|
|
325
|
+
log_level = "INFO"
|
|
326
|
+
log_format = "text" # "text" or "json"
|
|
327
|
+
transaction_db_path = "rpacore.db"
|
|
328
|
+
screenshot_dir = ""
|
|
329
|
+
credential_provider = "env"
|
|
330
|
+
|
|
331
|
+
[queue]
|
|
332
|
+
db_path = "queue.db"
|
|
333
|
+
lease_timeout = 30
|
|
334
|
+
max_retries = 3
|
|
335
|
+
|
|
336
|
+
# [notification.email]
|
|
337
|
+
# host = "smtp.example.com"
|
|
338
|
+
# port = 587
|
|
339
|
+
# from_addr = "rpacore@example.com"
|
|
340
|
+
# to_addrs = ["admin@example.com"]
|
|
341
|
+
# attach_screenshots = true
|
|
342
|
+
|
|
343
|
+
# [notification.webhook]
|
|
344
|
+
# url = "https://hooks.example.com/rpacore"
|
|
345
|
+
# include_transaction = false
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
## Exception Model
|
|
349
|
+
|
|
350
|
+
| Exception | Meaning | Engine behavior |
|
|
351
|
+
|---|---|---|
|
|
352
|
+
| `BusinessException` | Expected rule violation, such as invalid input data. | Skill fails, execution continues. |
|
|
353
|
+
| `SystemException` | Technical failure, such as network or file errors. | Skill fails, execution stops, retryable. |
|
|
354
|
+
| Any other exception | Unhandled Python exception. | Wrapped as `SystemException`. |
|
|
355
|
+
|
|
356
|
+
Use `stop=True` for a business failure that should stop downstream work:
|
|
357
|
+
|
|
358
|
+
```python
|
|
359
|
+
raise BusinessException("bad row", action=self.name, stop=True)
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
## Timeouts and Deadlines
|
|
363
|
+
|
|
364
|
+
RPA Core does not provide a generic per-skill timeout. Python threads cannot be
|
|
365
|
+
safely stopped, so an in-process timeout can mark a skill failed while the timed
|
|
366
|
+
out code keeps running and mutating external systems.
|
|
367
|
+
|
|
368
|
+
Configure I/O timeouts in the library that performs the work, such as the HTTP,
|
|
369
|
+
SMTP, browser, database, or desktop automation client used by a skill. If an
|
|
370
|
+
automation needs a hard deadline with termination, run it behind an external
|
|
371
|
+
worker-process or orchestrator boundary and record the outcome back into RPA
|
|
372
|
+
Core. RPA Core v0.1.0 intentionally rejects Pebble or similar process-timeout
|
|
373
|
+
dependencies because process termination cannot make arbitrary external side
|
|
374
|
+
effects reversible. See [Runtime Dependency Decisions](docs/runtime-dependencies.md)
|
|
375
|
+
for the v0.1.0 decisions on process-timeout libraries, Pydantic, Tenacity, and
|
|
376
|
+
AnyIO.
|
|
377
|
+
|
|
378
|
+
## Optional Dependencies
|
|
379
|
+
|
|
380
|
+
```bash
|
|
381
|
+
pip install "rpacore[screenshots]" # mss: auto-capture screenshots on exception
|
|
382
|
+
pip install "rpacore[keyring]" # keyring: OS credential store integration
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
## Examples
|
|
386
|
+
|
|
387
|
+
This repo keeps a minimal in-repo automation under `examples/` to support
|
|
388
|
+
integration-style tests for the framework itself:
|
|
389
|
+
|
|
390
|
+
- `examples/sample_skill.py`
|
|
391
|
+
- `examples/sample_main.py`
|
|
392
|
+
|
|
393
|
+
For a step-by-step beginner guide, see [docs/tutorial.md](docs/tutorial.md).
|
|
394
|
+
|
|
395
|
+
For persistence, migrations, and crash-behavior details, see
|
|
396
|
+
[docs/durability.md](docs/durability.md). For CLI, API, config, export, and
|
|
397
|
+
import-boundary references, see [docs/README.md](docs/README.md).
|
|
398
|
+
For vulnerability reporting and local security posture, see
|
|
399
|
+
[SECURITY.md](SECURITY.md) and [docs/security.md](docs/security.md).
|
|
400
|
+
|
|
401
|
+
For fuller showcase automations, see the examples repository:
|
|
402
|
+
|
|
403
|
+
- examples repository: `rpacore-examples`
|
|
404
|
+
|
|
405
|
+
## Local-First Direction
|
|
406
|
+
|
|
407
|
+
RPA Core Cloud is a future optional orchestrator/control plane. The framework
|
|
408
|
+
itself must stay useful without it:
|
|
409
|
+
|
|
410
|
+
- projects remain normal Python repos
|
|
411
|
+
- runs persist locally
|
|
412
|
+
- logs, reports, queues, transactions, and artifacts stay readable
|
|
413
|
+
- future worker/orchestrator contracts should be documented and exportable
|
|
414
|
+
|
|
415
|
+
Cloud and remote orchestration are not part of v0.1.0; see
|
|
416
|
+
[docs/non-goals.md](docs/non-goals.md).
|
|
417
|
+
|
|
418
|
+
## Compatibility Baseline
|
|
419
|
+
|
|
420
|
+
`v0.1.0` is the first supported public compatibility baseline. Breaking changes
|
|
421
|
+
made before that release are tracked for maintainers in
|
|
422
|
+
[docs/pre-v0.1.0-api-migration.md](docs/pre-v0.1.0-api-migration.md), not hidden
|
|
423
|
+
behind compatibility aliases.
|
|
424
|
+
|
|
425
|
+
## License
|
|
426
|
+
|
|
427
|
+
Apache 2.0. See [LICENSE](LICENSE).
|