postloop 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.
postloop-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Winnie
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,197 @@
1
+ Metadata-Version: 2.4
2
+ Name: postloop
3
+ Version: 0.1.0
4
+ Summary: Plan, check and learn from your community's social media posts.
5
+ Author: Winnie
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/winniepopu/postloop
8
+ Project-URL: Source, https://github.com/winniepopu/postloop
9
+ Project-URL: Issues, https://github.com/winniepopu/postloop/issues
10
+ Keywords: community,social media,post calendar,automation,meta business suite,linkedin
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Topic :: Office/Business
14
+ Requires-Python: >=3.11
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: tzdata; sys_platform == "win32"
18
+ Provides-Extra: xlsx
19
+ Requires-Dist: openpyxl>=3.1; extra == "xlsx"
20
+ Provides-Extra: xls
21
+ Requires-Dist: xlrd>=2.0; extra == "xls"
22
+ Provides-Extra: sheets
23
+ Requires-Dist: gspread>=6.0; extra == "sheets"
24
+ Provides-Extra: all
25
+ Requires-Dist: openpyxl>=3.1; extra == "all"
26
+ Requires-Dist: xlrd>=2.0; extra == "all"
27
+ Requires-Dist: gspread>=6.0; extra == "all"
28
+ Provides-Extra: dev
29
+ Requires-Dist: pytest>=8; extra == "dev"
30
+ Requires-Dist: openpyxl>=3.1; extra == "dev"
31
+ Dynamic: license-file
32
+
33
+ # postloop
34
+
35
+ **Plan, check and learn from your community's social media posts.**
36
+
37
+ Community organizers plan social media posts in a spreadsheet, then post them by
38
+ hand. Afterwards nobody goes back to update the sheet: statuses stay at
39
+ "drafting", the "published at" column stays empty, and nobody notices the post
40
+ that went out twice or the one that never went out. And next year, nobody
41
+ remembers which posts worked. postloop does those boring parts, and closes the
42
+ loop: plan, post, learn, plan again.
43
+
44
+ | You have | Run | You get |
45
+ |---|---|---|
46
+ | a post calendar and your platform exports | `postloop --plan ... --posts ...` | what went out, what didn't, what the sheet got wrong |
47
+ | only your platform exports | `postloop report --posts ...` | what worked: top posts, ads vs organic, gaps |
48
+ | last year's exports and a new event date | `postloop bootstrap --posts ...` | a draft calendar for this year |
49
+
50
+ ## Check the calendar
51
+
52
+ You need two things you already have:
53
+
54
+ 1. **your post calendar**: any spreadsheet with a date and a title per post
55
+ 2. **your platform exports**: the CSV/Excel files Meta Business Suite and
56
+ LinkedIn let you download. No API keys, no data pipeline.
57
+
58
+ ```bash
59
+ pip install "postloop[xlsx]"
60
+
61
+ postloop --plan calendar.xlsx --posts facebook.csv instagram.csv linkedin.xls
62
+ ```
63
+
64
+ ```
65
+ Calendar: 54 planned posts (date: 'Date', title: 'Post')
66
+ Posts: facebook.csv → Meta Business Suite (Facebook), 45 posts
67
+ Posts: instagram.csv → Meta Business Suite (Instagram), 38 posts
68
+
69
+ 📅 Post calendar check
70
+ Matched 36 published posts
71
+ ✍️ Cells that can be filled in: 70
72
+
73
+ 🟡 Posted, but status not updated
74
+ • 09/02 Conference guide (Drafting → facebook 09-02 21:00)
75
+ 🔴 Date passed, no post found
76
+ • 10/19 Sprints sponsor thanks
77
+ ❓ Posts missing from the calendar
78
+ • 09/15 [facebook] Sponsor spotlight ...
79
+ ♊ Possibly posted twice
80
+ • 09/13 20:31 [facebook] Only 2 days left for tickets!
81
+ ```
82
+
83
+ It fills in **facts** (when each post went out, and its link) and never makes
84
+ **decisions**: a status that looks out of date is reported, not changed.
85
+
86
+ ## Your calendar
87
+
88
+ Only a **date** and a **title** column are required. postloop finds columns by
89
+ name, in English or Chinese (`Date`/`日期`/`預計發布日`, `Title`/`Post`/`發文主題`
90
+ ...), and skips notes above the header. Optional columns it understands:
91
+
92
+ | What | Recognized as |
93
+ |---|---|
94
+ | where it is posted | checkbox columns named `FB`, `IG`, `LinkedIn`, `X`, `Threads`... or one `Platforms` column like `FB, IG` |
95
+ | status | `Status` / `狀態` |
96
+ | published at | `Published at` / `實際發佈日期與時間` (postloop fills it in) |
97
+ | link | `URL` / `Link` / `網址` (postloop fills it in) |
98
+
99
+ No calendar yet? Start from [`templates/post-calendar.csv`](https://github.com/winniepopu/postloop/blob/main/templates/post-calendar.csv).
100
+ Different column names? `--date-col "When" --title-col "What"`.
101
+
102
+ ## Your posts
103
+
104
+ | Platform | Where to download |
105
+ |---|---|
106
+ | Facebook | Meta Business Suite → Insights → Content → **Export data** → Facebook |
107
+ | Instagram | the same, choose Instagram |
108
+ | LinkedIn | your page → Analytics → Content → **Export** |
109
+ | anything else | a CSV with `platform, created_at, message, reactions` (+ `comments, shares, url`) |
110
+
111
+ The format is detected automatically. Meta allows 92 days per export; pass as
112
+ many files as you like, overlapping posts are counted once.
113
+
114
+ > **Gotcha we hit:** Meta writes publish times in **US Pacific time**, whatever
115
+ > your page's timezone. A post published at 10:10 in Taipei appears as 19:10 the
116
+ > evening before. postloop converts it; set your own zone with `--timezone`.
117
+
118
+ ## Writing results back
119
+
120
+ ```bash
121
+ postloop --plan calendar.xlsx --posts fb.csv --write # saves calendar_filled.xlsx
122
+ postloop --plan calendar.xlsx --posts fb.csv --report out.csv # one line per post, all platforms
123
+ ```
124
+
125
+ With a Google Sheet (`pip install "postloop[sheets]"`), `--sheet-id ID --write`
126
+ fills the live sheet, and `--discord` posts the summary to `$DISCORD_WEBHOOK`.
127
+ Run both every morning with GitHub Actions: see
128
+ [`examples/pycontw/daily-check.yml`](https://github.com/winniepopu/postloop/blob/main/examples/pycontw/daily-check.yml).
129
+
130
+ ## No calendar yet?
131
+
132
+ Start from what you already posted:
133
+
134
+ ```bash
135
+ postloop report --posts facebook.csv instagram.csv --timezone Asia/Seoul
136
+ ```
137
+
138
+ For each platform: the typical post (median, so one viral post doesn't skew it),
139
+ the top posts by **organic** views (Meta exports say how many views came from
140
+ ads), boosted posts, post types, posts per month and the longest stretches with
141
+ no posts. It saves `post_report.md` and a CSV with every post.
142
+
143
+ ## Plan next year from last year
144
+
145
+ A yearly event posts much the same things each year. Turn last year's posts into
146
+ a draft calendar:
147
+
148
+ ```bash
149
+ postloop bootstrap --posts facebook.csv instagram.csv --timezone Asia/Seoul \
150
+ --event-date 2026-10-17 --next-event 2027-10-16
151
+ ```
152
+
153
+ Each post is placed the same number of days before the next event, on the same
154
+ weekday, with the year in its title updated and last year's numbers next to it.
155
+ A post that went out on several platforms becomes one row. The draft is a
156
+ starting point: if a deadline moved this year (early bird, proposals), move those
157
+ rows by hand.
158
+
159
+ ## How matching works
160
+
161
+ Dates alone are unreliable: posts go out late, and several share a day. Each
162
+ calendar row and post pair gets a score from:
163
+
164
+ - **text similarity**: character pairs of the title found in the start of the
165
+ post, weighted by rarity, so "PyCon" (in every post) counts little and a
166
+ speaker's name counts a lot. Works for Chinese and English without a tokenizer.
167
+ - **sequence numbers**: "Part 2", "#2", "Day 2" and "第二天" must agree
168
+ - **lateness**: a small penalty per day late
169
+
170
+ Pairs are assigned best-first, one post per row. Low-confidence matches are
171
+ listed for a human to check.
172
+
173
+ Teach postloop your community's words in a config file (`--config postloop.toml`):
174
+
175
+ ```toml
176
+ [synonyms]
177
+ shorts = "interview" # the calendar says "shorts", the post says "interview"
178
+ ```
179
+
180
+ On PyCon Taiwan's 2026 calendar it matched 32 of 36 Facebook posts with no
181
+ configuration, and 35 of 36 with no wrong matches once given ten synonyms.
182
+
183
+ ## Examples
184
+
185
+ [`examples/pycontw/`](https://github.com/winniepopu/postloop/tree/main/examples/pycontw/) is how PyCon Taiwan runs it every
186
+ morning: their config, their GitHub Actions workflow, and how to feed postloop
187
+ from your own database instead of from exports.
188
+
189
+ ## Development
190
+
191
+ ```bash
192
+ pip install -e ".[dev]"
193
+ pytest
194
+ ```
195
+
196
+ Releases are published to PyPI by `.github/workflows/publish.yml` when a GitHub
197
+ release is created.
@@ -0,0 +1,165 @@
1
+ # postloop
2
+
3
+ **Plan, check and learn from your community's social media posts.**
4
+
5
+ Community organizers plan social media posts in a spreadsheet, then post them by
6
+ hand. Afterwards nobody goes back to update the sheet: statuses stay at
7
+ "drafting", the "published at" column stays empty, and nobody notices the post
8
+ that went out twice or the one that never went out. And next year, nobody
9
+ remembers which posts worked. postloop does those boring parts, and closes the
10
+ loop: plan, post, learn, plan again.
11
+
12
+ | You have | Run | You get |
13
+ |---|---|---|
14
+ | a post calendar and your platform exports | `postloop --plan ... --posts ...` | what went out, what didn't, what the sheet got wrong |
15
+ | only your platform exports | `postloop report --posts ...` | what worked: top posts, ads vs organic, gaps |
16
+ | last year's exports and a new event date | `postloop bootstrap --posts ...` | a draft calendar for this year |
17
+
18
+ ## Check the calendar
19
+
20
+ You need two things you already have:
21
+
22
+ 1. **your post calendar**: any spreadsheet with a date and a title per post
23
+ 2. **your platform exports**: the CSV/Excel files Meta Business Suite and
24
+ LinkedIn let you download. No API keys, no data pipeline.
25
+
26
+ ```bash
27
+ pip install "postloop[xlsx]"
28
+
29
+ postloop --plan calendar.xlsx --posts facebook.csv instagram.csv linkedin.xls
30
+ ```
31
+
32
+ ```
33
+ Calendar: 54 planned posts (date: 'Date', title: 'Post')
34
+ Posts: facebook.csv → Meta Business Suite (Facebook), 45 posts
35
+ Posts: instagram.csv → Meta Business Suite (Instagram), 38 posts
36
+
37
+ 📅 Post calendar check
38
+ Matched 36 published posts
39
+ ✍️ Cells that can be filled in: 70
40
+
41
+ 🟡 Posted, but status not updated
42
+ • 09/02 Conference guide (Drafting → facebook 09-02 21:00)
43
+ 🔴 Date passed, no post found
44
+ • 10/19 Sprints sponsor thanks
45
+ ❓ Posts missing from the calendar
46
+ • 09/15 [facebook] Sponsor spotlight ...
47
+ ♊ Possibly posted twice
48
+ • 09/13 20:31 [facebook] Only 2 days left for tickets!
49
+ ```
50
+
51
+ It fills in **facts** (when each post went out, and its link) and never makes
52
+ **decisions**: a status that looks out of date is reported, not changed.
53
+
54
+ ## Your calendar
55
+
56
+ Only a **date** and a **title** column are required. postloop finds columns by
57
+ name, in English or Chinese (`Date`/`日期`/`預計發布日`, `Title`/`Post`/`發文主題`
58
+ ...), and skips notes above the header. Optional columns it understands:
59
+
60
+ | What | Recognized as |
61
+ |---|---|
62
+ | where it is posted | checkbox columns named `FB`, `IG`, `LinkedIn`, `X`, `Threads`... or one `Platforms` column like `FB, IG` |
63
+ | status | `Status` / `狀態` |
64
+ | published at | `Published at` / `實際發佈日期與時間` (postloop fills it in) |
65
+ | link | `URL` / `Link` / `網址` (postloop fills it in) |
66
+
67
+ No calendar yet? Start from [`templates/post-calendar.csv`](https://github.com/winniepopu/postloop/blob/main/templates/post-calendar.csv).
68
+ Different column names? `--date-col "When" --title-col "What"`.
69
+
70
+ ## Your posts
71
+
72
+ | Platform | Where to download |
73
+ |---|---|
74
+ | Facebook | Meta Business Suite → Insights → Content → **Export data** → Facebook |
75
+ | Instagram | the same, choose Instagram |
76
+ | LinkedIn | your page → Analytics → Content → **Export** |
77
+ | anything else | a CSV with `platform, created_at, message, reactions` (+ `comments, shares, url`) |
78
+
79
+ The format is detected automatically. Meta allows 92 days per export; pass as
80
+ many files as you like, overlapping posts are counted once.
81
+
82
+ > **Gotcha we hit:** Meta writes publish times in **US Pacific time**, whatever
83
+ > your page's timezone. A post published at 10:10 in Taipei appears as 19:10 the
84
+ > evening before. postloop converts it; set your own zone with `--timezone`.
85
+
86
+ ## Writing results back
87
+
88
+ ```bash
89
+ postloop --plan calendar.xlsx --posts fb.csv --write # saves calendar_filled.xlsx
90
+ postloop --plan calendar.xlsx --posts fb.csv --report out.csv # one line per post, all platforms
91
+ ```
92
+
93
+ With a Google Sheet (`pip install "postloop[sheets]"`), `--sheet-id ID --write`
94
+ fills the live sheet, and `--discord` posts the summary to `$DISCORD_WEBHOOK`.
95
+ Run both every morning with GitHub Actions: see
96
+ [`examples/pycontw/daily-check.yml`](https://github.com/winniepopu/postloop/blob/main/examples/pycontw/daily-check.yml).
97
+
98
+ ## No calendar yet?
99
+
100
+ Start from what you already posted:
101
+
102
+ ```bash
103
+ postloop report --posts facebook.csv instagram.csv --timezone Asia/Seoul
104
+ ```
105
+
106
+ For each platform: the typical post (median, so one viral post doesn't skew it),
107
+ the top posts by **organic** views (Meta exports say how many views came from
108
+ ads), boosted posts, post types, posts per month and the longest stretches with
109
+ no posts. It saves `post_report.md` and a CSV with every post.
110
+
111
+ ## Plan next year from last year
112
+
113
+ A yearly event posts much the same things each year. Turn last year's posts into
114
+ a draft calendar:
115
+
116
+ ```bash
117
+ postloop bootstrap --posts facebook.csv instagram.csv --timezone Asia/Seoul \
118
+ --event-date 2026-10-17 --next-event 2027-10-16
119
+ ```
120
+
121
+ Each post is placed the same number of days before the next event, on the same
122
+ weekday, with the year in its title updated and last year's numbers next to it.
123
+ A post that went out on several platforms becomes one row. The draft is a
124
+ starting point: if a deadline moved this year (early bird, proposals), move those
125
+ rows by hand.
126
+
127
+ ## How matching works
128
+
129
+ Dates alone are unreliable: posts go out late, and several share a day. Each
130
+ calendar row and post pair gets a score from:
131
+
132
+ - **text similarity**: character pairs of the title found in the start of the
133
+ post, weighted by rarity, so "PyCon" (in every post) counts little and a
134
+ speaker's name counts a lot. Works for Chinese and English without a tokenizer.
135
+ - **sequence numbers**: "Part 2", "#2", "Day 2" and "第二天" must agree
136
+ - **lateness**: a small penalty per day late
137
+
138
+ Pairs are assigned best-first, one post per row. Low-confidence matches are
139
+ listed for a human to check.
140
+
141
+ Teach postloop your community's words in a config file (`--config postloop.toml`):
142
+
143
+ ```toml
144
+ [synonyms]
145
+ shorts = "interview" # the calendar says "shorts", the post says "interview"
146
+ ```
147
+
148
+ On PyCon Taiwan's 2026 calendar it matched 32 of 36 Facebook posts with no
149
+ configuration, and 35 of 36 with no wrong matches once given ten synonyms.
150
+
151
+ ## Examples
152
+
153
+ [`examples/pycontw/`](https://github.com/winniepopu/postloop/tree/main/examples/pycontw/) is how PyCon Taiwan runs it every
154
+ morning: their config, their GitHub Actions workflow, and how to feed postloop
155
+ from your own database instead of from exports.
156
+
157
+ ## Development
158
+
159
+ ```bash
160
+ pip install -e ".[dev]"
161
+ pytest
162
+ ```
163
+
164
+ Releases are published to PyPI by `.github/workflows/publish.yml` when a GitHub
165
+ release is created.
@@ -0,0 +1,41 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "postloop"
7
+ version = "0.1.0"
8
+ description = "Plan, check and learn from your community's social media posts."
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = "MIT"
12
+ authors = [{ name = "Winnie" }]
13
+ keywords = ["community", "social media", "post calendar", "automation", "meta business suite", "linkedin"]
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "Operating System :: OS Independent",
17
+ "Topic :: Office/Business",
18
+ ]
19
+ # CSV in, CSV out needs nothing beyond the standard library.
20
+ dependencies = ["tzdata; sys_platform == 'win32'"] # time zone data Windows lacks
21
+
22
+ [project.urls]
23
+ Homepage = "https://github.com/winniepopu/postloop"
24
+ Source = "https://github.com/winniepopu/postloop"
25
+ Issues = "https://github.com/winniepopu/postloop/issues"
26
+
27
+ [project.optional-dependencies]
28
+ xlsx = ["openpyxl>=3.1"] # .xlsx calendars and LinkedIn exports saved as .xlsx
29
+ xls = ["xlrd>=2.0"] # LinkedIn's legacy .xls export
30
+ sheets = ["gspread>=6.0"] # read and fill a live Google Sheet
31
+ all = ["openpyxl>=3.1", "xlrd>=2.0", "gspread>=6.0"]
32
+ dev = ["pytest>=8", "openpyxl>=3.1"]
33
+
34
+ [project.scripts]
35
+ postloop = "postloop.cli:main"
36
+
37
+ [tool.setuptools.packages.find]
38
+ where = ["src"]
39
+
40
+ [tool.pytest.ini_options]
41
+ testpaths = ["tests"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,38 @@
1
+ """postloop: plan, check and learn from your community's social media posts."""
2
+
3
+ from importlib.metadata import PackageNotFoundError, version
4
+
5
+ from .adapters import load_many, load_posts
6
+ from .bootstrap import draft_calendar
7
+ from .config import Config, load_config
8
+ from .insights import analyze
9
+ from .matching import match_posts
10
+ from .models import Match, PlannedPost, PublishedPost
11
+ from .notify import format_summary, send_discord
12
+ from .plan import Calendar, load_calendar, rows_to_calendar
13
+ from .reconcile import Report, reconcile
14
+
15
+ try:
16
+ __version__ = version("postloop") # the one version number lives in pyproject.toml
17
+ except PackageNotFoundError: # running from a source checkout that was never installed
18
+ __version__ = "0.0.0"
19
+
20
+ __all__ = [
21
+ "Calendar",
22
+ "Config",
23
+ "Match",
24
+ "PlannedPost",
25
+ "PublishedPost",
26
+ "Report",
27
+ "analyze",
28
+ "draft_calendar",
29
+ "format_summary",
30
+ "load_calendar",
31
+ "load_config",
32
+ "load_many",
33
+ "load_posts",
34
+ "match_posts",
35
+ "reconcile",
36
+ "rows_to_calendar",
37
+ "send_discord",
38
+ ]