pubkit 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.
- pubkit-0.1.0/.gitignore +8 -0
- pubkit-0.1.0/CHANGELOG.md +45 -0
- pubkit-0.1.0/LICENSE +202 -0
- pubkit-0.1.0/NOTICE +7 -0
- pubkit-0.1.0/PKG-INFO +291 -0
- pubkit-0.1.0/README.md +241 -0
- pubkit-0.1.0/docs/ADAPTERS.md +140 -0
- pubkit-0.1.0/docs/ARCHITECTURE.md +178 -0
- pubkit-0.1.0/docs/FAILURE-MODES.md +222 -0
- pubkit-0.1.0/docs/QUICKSTART.md +124 -0
- pubkit-0.1.0/examples/inside-ai-infra/img/part1-01-model-sizes.png +0 -0
- pubkit-0.1.0/examples/inside-ai-infra/img/part1-02-cpu-vs-gpu-ANIMATED.gif +0 -0
- pubkit-0.1.0/examples/inside-ai-infra/img/part1-03-starving-cores-ANIMATED.gif +0 -0
- pubkit-0.1.0/examples/inside-ai-infra/img/part1-04-gpu-comparison.png +0 -0
- pubkit-0.1.0/examples/inside-ai-infra/img/part2-01-one-token-one-read-ANIMATED.gif +0 -0
- pubkit-0.1.0/examples/inside-ai-infra/img/part2-02-decode-ceilings.png +0 -0
- pubkit-0.1.0/examples/inside-ai-infra/img/part2-03-prefill-vs-decode.png +0 -0
- pubkit-0.1.0/examples/inside-ai-infra/img/part2-04-kv-cache-cost.png +0 -0
- pubkit-0.1.0/examples/inside-ai-infra/img/part2-05-batching-ANIMATED.gif +0 -0
- pubkit-0.1.0/examples/inside-ai-infra/img/part2-06-vram-budget.png +0 -0
- pubkit-0.1.0/examples/inside-ai-infra/img/part2-07-throughput-latency.png +0 -0
- pubkit-0.1.0/examples/inside-ai-infra/img/part3-01-interconnect.png +0 -0
- pubkit-0.1.0/examples/inside-ai-infra/img/part3-02-llmd-request-path.png +0 -0
- pubkit-0.1.0/examples/inside-ai-infra/img/part3-03-llmd-objects.png +0 -0
- pubkit-0.1.0/examples/inside-ai-infra/img/part3-04-slos.png +0 -0
- pubkit-0.1.0/examples/inside-ai-infra/part-1.md +300 -0
- pubkit-0.1.0/examples/inside-ai-infra/part-2.md +415 -0
- pubkit-0.1.0/examples/inside-ai-infra/part-3.md +566 -0
- pubkit-0.1.0/pyproject.toml +74 -0
- pubkit-0.1.0/src/pubkit/__init__.py +14 -0
- pubkit-0.1.0/src/pubkit/__main__.py +7 -0
- pubkit-0.1.0/src/pubkit/adapters/__init__.py +2 -0
- pubkit-0.1.0/src/pubkit/adapters/api_base.py +67 -0
- pubkit-0.1.0/src/pubkit/adapters/devto.py +195 -0
- pubkit-0.1.0/src/pubkit/adapters/medium.py +184 -0
- pubkit-0.1.0/src/pubkit/adapters/substack.py +136 -0
- pubkit-0.1.0/src/pubkit/adapters/x.py +216 -0
- pubkit-0.1.0/src/pubkit/browserctl.py +78 -0
- pubkit-0.1.0/src/pubkit/cli.py +306 -0
- pubkit-0.1.0/src/pubkit/core/__init__.py +2 -0
- pubkit-0.1.0/src/pubkit/core/adapter.py +206 -0
- pubkit-0.1.0/src/pubkit/core/anchors.py +89 -0
- pubkit-0.1.0/src/pubkit/core/auth.py +209 -0
- pubkit-0.1.0/src/pubkit/core/browser.py +426 -0
- pubkit-0.1.0/src/pubkit/core/capabilities.py +256 -0
- pubkit-0.1.0/src/pubkit/core/checks.py +344 -0
- pubkit-0.1.0/src/pubkit/core/ir.py +240 -0
- pubkit-0.1.0/src/pubkit/core/loader.py +278 -0
- pubkit-0.1.0/src/pubkit/core/runner.py +268 -0
- pubkit-0.1.0/src/pubkit/core/state.py +213 -0
- pubkit-0.1.0/src/pubkit/core/transport.py +170 -0
- pubkit-0.1.0/src/pubkit/py.typed +0 -0
- pubkit-0.1.0/src/pubkit/registry.py +81 -0
- pubkit-0.1.0/src/pubkit/render/__init__.py +2 -0
- pubkit-0.1.0/src/pubkit/render/html.py +221 -0
- pubkit-0.1.0/src/pubkit/scaffold.py +271 -0
- pubkit-0.1.0/src/pubkit/workflows/__init__.py +2 -0
- pubkit-0.1.0/src/pubkit/workflows/airflow.py +115 -0
- pubkit-0.1.0/tests/test_core.py +423 -0
pubkit-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
4
|
+
Versioning is [semantic](https://semver.org/); adapters may change behaviour on
|
|
5
|
+
a minor bump when a platform changes underneath them.
|
|
6
|
+
|
|
7
|
+
## [0.1.0] — 2026-09-11
|
|
8
|
+
|
|
9
|
+
First release. Extracted from a real, painful publishing run: a 15,000-word
|
|
10
|
+
illustrated three-part series to Medium that surfaced 21 distinct failure modes,
|
|
11
|
+
all catalogued in `docs/FAILURE-MODES.md`.
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- **Post IR** — a canonical, platform-agnostic document model with a
|
|
16
|
+
content-addressed id used as the idempotency key everywhere.
|
|
17
|
+
- **Capability negotiation** — adapters declare what they support; the planner
|
|
18
|
+
emits explicit, printable degradations. `pubkit plan` shows them before
|
|
19
|
+
anything is sent.
|
|
20
|
+
- **Check pipeline** — placeholders, numeric assertions, cross-references,
|
|
21
|
+
number drift, assets, budget, structure. Pluggable via `pubkit.checks`.
|
|
22
|
+
- **Verified chunked transport** — per-chunk rolling-hash verification, probed
|
|
23
|
+
size ceilings, single-member gzip.
|
|
24
|
+
- **Browser adapter toolkit** — paste-based document replace with a block-count
|
|
25
|
+
assertion, reload-then-fingerprint verification, caption-anchored `File`
|
|
26
|
+
image insertion, Unicode-folding anchor resolution, tag-chip post-conditions.
|
|
27
|
+
- **Adapters** — Medium, Substack (browser); X, Dev.to, Hashnode (API).
|
|
28
|
+
- **Runner** — six resumable steps per (document, platform), sqlite state store,
|
|
29
|
+
two-phase publish for series, hash-pinned `--confirm` gate, per-platform rate
|
|
30
|
+
limiting and jittered retry.
|
|
31
|
+
- **CLI** — `init`, `validate`, `plan`, `publish`, `status`, `platforms`,
|
|
32
|
+
`doctor`, `auth login|logout|list`.
|
|
33
|
+
- **Workflows** — GitHub Actions examples and Airflow operators.
|
|
34
|
+
- **Extension points** — `pubkit.adapters`, `pubkit.renderers`, `pubkit.checks`,
|
|
35
|
+
`pubkit.hooks`, plus per-platform transforms.
|
|
36
|
+
|
|
37
|
+
### Known limitations
|
|
38
|
+
|
|
39
|
+
- Browser adapter selectors will need patching when a platform redesigns its
|
|
40
|
+
editor. They are isolated in one `EditorSelectors` dataclass per adapter
|
|
41
|
+
precisely so that is a small change.
|
|
42
|
+
- Table→image rendering requires the `render` extra; without it, tables degrade
|
|
43
|
+
to lists on platforms that lack table support.
|
|
44
|
+
- X media upload uses the v1.1 endpoint, which is what the v2 API still
|
|
45
|
+
requires.
|
pubkit-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 Arun Singh and the pubkit Authors
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
pubkit-0.1.0/NOTICE
ADDED
pubkit-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: pubkit
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Publish one source to many platforms, safely. Medium, Substack, X, Dev.to, Hashnode.
|
|
5
|
+
Project-URL: Homepage, https://github.com/arunsingh/pubkit
|
|
6
|
+
Project-URL: Issues, https://github.com/arunsingh/pubkit/issues
|
|
7
|
+
Project-URL: Documentation, https://github.com/arunsingh/pubkit#readme
|
|
8
|
+
Project-URL: Changelog, https://github.com/arunsingh/pubkit/blob/main/CHANGELOG.md
|
|
9
|
+
Project-URL: Failure modes, https://github.com/arunsingh/pubkit/blob/main/docs/FAILURE-MODES.md
|
|
10
|
+
Author: Arun Singh
|
|
11
|
+
License-Expression: Apache-2.0
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
License-File: NOTICE
|
|
14
|
+
Keywords: automation,content,devto,hashnode,medium,publishing,substack,twitter,x
|
|
15
|
+
Classifier: Development Status :: 4 - Beta
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
22
|
+
Classifier: Topic :: Text Processing :: Markup
|
|
23
|
+
Classifier: Typing :: Typed
|
|
24
|
+
Requires-Python: >=3.11
|
|
25
|
+
Requires-Dist: httpx>=0.27
|
|
26
|
+
Requires-Dist: pydantic>=2.6
|
|
27
|
+
Requires-Dist: pyyaml>=6.0
|
|
28
|
+
Requires-Dist: rich>=13.7
|
|
29
|
+
Requires-Dist: typer>=0.12
|
|
30
|
+
Provides-Extra: airflow
|
|
31
|
+
Requires-Dist: apache-airflow>=2.9; extra == 'airflow'
|
|
32
|
+
Provides-Extra: all
|
|
33
|
+
Requires-Dist: cryptography>=42.0; extra == 'all'
|
|
34
|
+
Requires-Dist: keyring>=25.0; extra == 'all'
|
|
35
|
+
Requires-Dist: pillow>=10.0; extra == 'all'
|
|
36
|
+
Requires-Dist: playwright>=1.44; extra == 'all'
|
|
37
|
+
Provides-Extra: browser
|
|
38
|
+
Requires-Dist: playwright>=1.44; extra == 'browser'
|
|
39
|
+
Provides-Extra: dev
|
|
40
|
+
Requires-Dist: mypy>=1.10; extra == 'dev'
|
|
41
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
|
|
42
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
43
|
+
Requires-Dist: ruff>=0.4; extra == 'dev'
|
|
44
|
+
Provides-Extra: keychain
|
|
45
|
+
Requires-Dist: cryptography>=42.0; extra == 'keychain'
|
|
46
|
+
Requires-Dist: keyring>=25.0; extra == 'keychain'
|
|
47
|
+
Provides-Extra: render
|
|
48
|
+
Requires-Dist: pillow>=10.0; extra == 'render'
|
|
49
|
+
Description-Content-Type: text/markdown
|
|
50
|
+
|
|
51
|
+
# pubkit
|
|
52
|
+
|
|
53
|
+
**Publish one source to many platforms, safely.**
|
|
54
|
+
Medium · Substack · X · Dev.to · Hashnode — and whatever you add next.
|
|
55
|
+
|
|
56
|
+
[](https://pypi.org/project/pubkit/)
|
|
57
|
+
[](https://pypi.org/project/pubkit/)
|
|
58
|
+
[](LICENSE)
|
|
59
|
+
[](https://github.com/arunsingh/pubkit/actions/workflows/ci.yml)
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Why this exists
|
|
64
|
+
|
|
65
|
+
I published a 15,000-word, three-part illustrated series to Medium. It took far
|
|
66
|
+
longer than writing it, and not for any reason I could have predicted.
|
|
67
|
+
|
|
68
|
+
A 12,368-character payload arrived with exactly **one byte** changed, and
|
|
69
|
+
nothing reported an error. Pasting a document replaced 2 of 169 paragraphs and
|
|
70
|
+
silently appended the rest, producing a scrambled duplicate. A delete that
|
|
71
|
+
visibly worked was back after a reload. Link hrefs set in the DOM reverted every
|
|
72
|
+
time. Every image — `data:` URI and `https://` URL alike — was stripped out of
|
|
73
|
+
pasted HTML, and it took eight dead ends to find the one insertion path that
|
|
74
|
+
works. A scripted check of 32 numeric claims found 5 that were wrong, including
|
|
75
|
+
two ratios transposed in an edit that no amount of re-reading had caught. And
|
|
76
|
+
the automation bridge dropped eight times, so everything had to be re-runnable.
|
|
77
|
+
|
|
78
|
+
None of that is Medium being unusual. It is what automating *any* rich-text
|
|
79
|
+
editor looks like. pubkit is that knowledge, extracted and made reusable.
|
|
80
|
+
|
|
81
|
+
[`docs/FAILURE-MODES.md`](docs/FAILURE-MODES.md) catalogues all of it — every
|
|
82
|
+
entry names the component that answers it.
|
|
83
|
+
|
|
84
|
+
## Install
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
pip install "pubkit[all]"
|
|
88
|
+
playwright install chromium # Medium and Substack only
|
|
89
|
+
pubkit doctor # confirms your environment before you start
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Thirty seconds to something real:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
pubkit init my-blog && cd my-blog
|
|
96
|
+
pubkit validate content/
|
|
97
|
+
pubkit plan content/ --to medium,devto
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Use it
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# 0. Scaffold a content repo that validates on the first try.
|
|
104
|
+
pubkit init my-blog && cd my-blog
|
|
105
|
+
|
|
106
|
+
# 1. Check the content. No network, no browser, no side effects.
|
|
107
|
+
pubkit validate content/series/
|
|
108
|
+
|
|
109
|
+
# 2. See exactly what each platform will get — including every degradation.
|
|
110
|
+
pubkit plan content/series/ --to medium,devto,x
|
|
111
|
+
|
|
112
|
+
# 3. Sign in. pubkit never accepts a password.
|
|
113
|
+
pubkit auth login medium # opens a window; you sign in; it keeps the session
|
|
114
|
+
pubkit auth login devto # API token → OS keychain
|
|
115
|
+
|
|
116
|
+
# 4. Drafts everywhere. Safe to re-run; a dropped connection costs one step.
|
|
117
|
+
pubkit publish content/series/ --to medium,devto,x
|
|
118
|
+
|
|
119
|
+
# 5. Go live.
|
|
120
|
+
pubkit publish content/series/ --to medium,devto,x --confirm
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
`plan` output on a real series:
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
medium: part-1 (bf9abfe78ce4)
|
|
127
|
+
· images_via_browser 4 image(s) uploaded through the editor's own paste path
|
|
128
|
+
— remote URLs and data: URIs are stripped by this platform
|
|
129
|
+
· code_flattened 4 code block(s) lose syntax highlighting
|
|
130
|
+
|
|
131
|
+
devto: part-1 (bf9abfe78ce4)
|
|
132
|
+
· tags_trimmed keeping 4 of 5
|
|
133
|
+
|
|
134
|
+
x: part-1 (bf9abfe78ce4)
|
|
135
|
+
· split_into_thread promo thread: 12 posts — hook, key claims, link to the full article
|
|
136
|
+
· tags_trimmed 5 tag(s) dropped — platform has no tags
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Nothing is a surprise at publish time. That is the whole design goal.
|
|
140
|
+
|
|
141
|
+
## Write once
|
|
142
|
+
|
|
143
|
+
````markdown
|
|
144
|
+
---
|
|
145
|
+
id: part-1
|
|
146
|
+
title: "Inside AI Infrastructure, Part 1: The Hardware"
|
|
147
|
+
subtitle: Why a GPU is fast, and why it turns out to be a memory problem.
|
|
148
|
+
tags: [AI Infrastructure, GPU, SRE]
|
|
149
|
+
series: {id: inside-ai, index: 1, of: 3}
|
|
150
|
+
budget: {words: 3500}
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
# What is behind the box you type into
|
|
154
|
+
|
|
155
|
+
<!-- pubkit:define nvlink = 900 -->
|
|
156
|
+
<!-- pubkit:define pcie5 = 128 -->
|
|
157
|
+
|
|
158
|
+
NVLink is 7× wider than PCIe Gen5. <!-- pubkit:assert 7x = nvlink/pcie5 ±10% -->
|
|
159
|
+
|
|
160
|
+
| Model | FP16 size |
|
|
161
|
+
| :--- | ---: |
|
|
162
|
+
| 70B | 140 GB |
|
|
163
|
+
*What the weights actually cost*
|
|
164
|
+
|
|
165
|
+

|
|
166
|
+
*Every token costs one full read of the model out of VRAM.*
|
|
167
|
+
|
|
168
|
+
Continued in [Part 2](${series.part2.url}).
|
|
169
|
+
````
|
|
170
|
+
|
|
171
|
+
That one file becomes: a Medium draft with the table rendered as a styled image
|
|
172
|
+
and the GIF uploaded through the editor's own path; a Dev.to article with a
|
|
173
|
+
native table and a fenced code block; a 12-post promo thread on X with a link
|
|
174
|
+
back. The cross-link resolves itself during a two-phase publish.
|
|
175
|
+
|
|
176
|
+
## What it actually guards against
|
|
177
|
+
|
|
178
|
+
| Guard | What it prevents |
|
|
179
|
+
|---|---|
|
|
180
|
+
| Hash-verified chunked transport | a silently corrupted payload |
|
|
181
|
+
| Probed chunk ceiling | undocumented per-call size limits |
|
|
182
|
+
| `replace_document()` with a block-count assert | a paste that appends instead of replacing |
|
|
183
|
+
| Reload-then-fingerprint verification | edits the editor showed you but never saved |
|
|
184
|
+
| Caption-anchored `File` paste | images stripped out of pasted HTML |
|
|
185
|
+
| Unicode-folding anchor resolution | an em dash breaking a text match |
|
|
186
|
+
| Tag-chip post-condition | one 40-character invalid tag instead of five good ones |
|
|
187
|
+
| `pubkit:assert` arithmetic | a transposed ratio reaching print |
|
|
188
|
+
| Two-phase series publish | `URL-PART-2` going live as a link |
|
|
189
|
+
| Content-addressed state store | a re-run creating a second draft |
|
|
190
|
+
| Plan hash + `--confirm` | publishing something other than what you reviewed |
|
|
191
|
+
|
|
192
|
+
## Architecture in one paragraph
|
|
193
|
+
|
|
194
|
+
A canonical **Post IR** sits between your source and every platform. Adapters
|
|
195
|
+
declare **capabilities**; the planner intersects the two and emits explicit
|
|
196
|
+
**degradations**. A **runner** executes six steps per (document, platform) —
|
|
197
|
+
auth, draft, content, media, verify, publish — recording each in a sqlite state
|
|
198
|
+
store so a re-run resumes rather than restarts. Browser adapters inherit a DOM
|
|
199
|
+
toolkit that encodes everything above; API adapters inherit rate limiting and
|
|
200
|
+
retries. [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) has the diagram.
|
|
201
|
+
|
|
202
|
+
## Add a platform
|
|
203
|
+
|
|
204
|
+
```python
|
|
205
|
+
from pubkit.core.browser import BrowserAdapter, EditorSelectors
|
|
206
|
+
from pubkit.core.capabilities import Capabilities
|
|
207
|
+
|
|
208
|
+
class GhostAdapter(BrowserAdapter):
|
|
209
|
+
name = "ghost"
|
|
210
|
+
capabilities = Capabilities(tables=True, image_upload="browser_paste")
|
|
211
|
+
selectors = EditorSelectors(
|
|
212
|
+
editable=".koenig-editor__editor",
|
|
213
|
+
content_roots=".koenig-editor__editor", # ALL roots, not the first
|
|
214
|
+
block="[data-kg='editor'] > *",
|
|
215
|
+
figure="figure", figure_img="figure img", link="a",
|
|
216
|
+
publish_button=".gh-publishmenu-trigger",
|
|
217
|
+
)
|
|
218
|
+
async def ensure_draft(self, doc, ctx): ...
|
|
219
|
+
async def publish(self, doc, ref, ctx): ...
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Register it from your own package — no fork required:
|
|
223
|
+
|
|
224
|
+
```toml
|
|
225
|
+
[project.entry-points."pubkit.adapters"]
|
|
226
|
+
ghost = "my_pubkit_ghost:GhostAdapter"
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Five extension points, all first-class: `pubkit.adapters`, `pubkit.renderers`,
|
|
230
|
+
`pubkit.checks`, `pubkit.hooks`, and per-platform `transforms:` in config.
|
|
231
|
+
|
|
232
|
+
## Fit it into a workflow
|
|
233
|
+
|
|
234
|
+
**GitHub Actions** — plan on every PR, publish on merge:
|
|
235
|
+
|
|
236
|
+
```yaml
|
|
237
|
+
- run: pubkit validate content/ --strict
|
|
238
|
+
- run: pubkit plan content/ --to medium,devto >> $GITHUB_STEP_SUMMARY
|
|
239
|
+
- run: pubkit publish content/ --to medium,devto --confirm
|
|
240
|
+
if: github.ref == 'refs/heads/main'
|
|
241
|
+
env:
|
|
242
|
+
PUBKIT_VAULT_KEY: ${{ secrets.PUBKIT_VAULT_KEY }}
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
**Airflow** — one task per (document, platform), so retries and alerting belong
|
|
246
|
+
to Airflow:
|
|
247
|
+
|
|
248
|
+
```python
|
|
249
|
+
validate = PubkitValidateOperator(task_id="validate", path="content/series/")
|
|
250
|
+
validate >> PubkitPublishOperator.expand_fanout(
|
|
251
|
+
path="content/series/", platforms=["medium", "devto", "x"], confirm=True,
|
|
252
|
+
)
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
**Library** — `from pubkit import Pipeline` for everything else.
|
|
256
|
+
|
|
257
|
+
## Security
|
|
258
|
+
|
|
259
|
+
- **pubkit never accepts a password.** Browser platforms use an interactive
|
|
260
|
+
login you perform; pubkit persists only the session, encrypted at rest.
|
|
261
|
+
- API tokens live in the OS keychain, or an encrypted vault for CI.
|
|
262
|
+
- Secrets are stripped from logs by a filter, not by discipline.
|
|
263
|
+
- Adapters receive credentials for their own platform and nothing else.
|
|
264
|
+
- Every public write needs `--confirm`, against a hash-pinned plan.
|
|
265
|
+
|
|
266
|
+
## Status
|
|
267
|
+
|
|
268
|
+
v0.1. The core, the checks, the planner and the state machine are tested (32
|
|
269
|
+
tests) and exercised end-to-end against a real published series in
|
|
270
|
+
`examples/inside-ai-infra/`. The browser adapters encode techniques verified by
|
|
271
|
+
hand against live editors; selectors are the part most likely to need a patch
|
|
272
|
+
when a platform ships a redesign, which is exactly why they are isolated in one
|
|
273
|
+
dataclass per adapter.
|
|
274
|
+
|
|
275
|
+
## Docs
|
|
276
|
+
|
|
277
|
+
| | |
|
|
278
|
+
|---|---|
|
|
279
|
+
| [QUICKSTART.md](docs/QUICKSTART.md) | five minutes, one platform |
|
|
280
|
+
| [FAILURE-MODES.md](docs/FAILURE-MODES.md) | the 21 ways publishing quietly goes wrong |
|
|
281
|
+
| [ARCHITECTURE.md](docs/ARCHITECTURE.md) | how it fits together |
|
|
282
|
+
| [ADAPTERS.md](docs/ADAPTERS.md) | add a platform |
|
|
283
|
+
| [SECURITY.md](SECURITY.md) | threat model and credential handling |
|
|
284
|
+
|
|
285
|
+
Contributions welcome — especially new adapters and new checks. The one hard
|
|
286
|
+
rule: a bug fix adds a row to `docs/FAILURE-MODES.md` and a test named after the
|
|
287
|
+
failure. See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
288
|
+
|
|
289
|
+
## Licence
|
|
290
|
+
|
|
291
|
+
Apache 2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
|