Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[![Go Reference](https://pkg.go.dev/badge/github.com/patch-it-dev/patch-it-plugins.svg)](https://pkg.go.dev/github.com/patch-it-dev/patch-it-plugins)
[![Go version](https://img.shields.io/github/go-mod/go-version/patch-it-dev/patch-it-plugins)](go.mod)
[![License: Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-3f5bf0)](LICENSE)
[![Plugins](https://img.shields.io/badge/plugins-21-3f5bf0)](docs/plugins.md)
[![Plugins](https://img.shields.io/badge/plugins-22-3f5bf0)](docs/plugins.md)
[![Docs](https://img.shields.io/badge/docs-docs.patch--it.dev-3f5bf0)](https://docs.patch-it.dev)
[![Discussions](https://img.shields.io/github/discussions/patch-it-dev/patch-it-plugins)](https://github.com/patch-it-dev/patch-it-plugins/discussions)

Expand Down
12 changes: 11 additions & 1 deletion docs/plugins.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"_comment": "Generated from the plugin registry and docs/plugins.md by `make plugins-json` (go run ./cmd/list-plugins). Don't edit by hand.",
"$schema": "./plugins.schema.json",
"count": 21,
"count": 22,
"plugins": [
{
"id": "algolia-ingestion",
Expand Down Expand Up @@ -143,6 +143,16 @@
"status": "live",
"provider_page": "providers/openai-models.md"
},
{
"id": "posthog",
"provider": "PostHog",
"layer": "sdk",
"watches": "Members removed in the posthog Python SDK 8.0.0",
"format": "removedmembers",
"source_url": "https://github.com/PostHog/posthog-python/blob/posthog-v8.0.0/docs/migration-7.x-to-8.0.md",
"status": "live",
"provider_page": "providers/posthog.md"
},
{
"id": "redis",
"provider": "Redis",
Expand Down
5 changes: 3 additions & 2 deletions docs/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ The table between the `plugins:start` and `plugins:end` markers is also publishe
| [`vertex-ai-models`](https://github.com/patch-it-dev/patch-it-plugins/blob/main/providers/vertex-ai-models.md) | Google | AI models | Generative AI model deprecations on Vertex AI | `feed` | [Vertex AI generative AI release notes (Atom)](https://docs.cloud.google.com/feeds/generative-ai-on-vertex-ai-release-notes.xml) | live |
| [`redis`](https://github.com/patch-it-dev/patch-it-plugins/blob/main/providers/redis.md) | Redis | runtime | Commands removed entirely from Redis's own command catalog between two snapshots | `catalog` | [redis/redis-doc `commands.json`](https://github.com/redis/redis-doc/blob/master/commands.json) | live |
| [`cloudflare`](https://github.com/patch-it-dev/patch-it-plugins/blob/main/providers/cloudflare.md) | Cloudflare | API | REST API operations Cloudflare deprecates, breaking on their end-of-life date when it gives one | `feed` | [Cloudflare API deprecations (RSS)](https://developers.cloudflare.com/fundamentals/api/reference/deprecations/index.xml) | live |
| [`posthog`](https://github.com/patch-it-dev/patch-it-plugins/blob/main/providers/posthog.md) | PostHog | SDK | Members removed in the posthog Python SDK 8.0.0 | `removedmembers` | [posthog-python 7.x to 8.0 migration guide](https://github.com/PostHog/posthog-python/blob/posthog-v8.0.0/docs/migration-7.x-to-8.0.md) | live |
<!-- plugins:end -->

## The columns
Expand All @@ -40,8 +41,8 @@ The table between the `plugins:start` and `plugins:end` markers is also publishe
| Provider | Whose API, SDK or package it is. |
| Layer | Which kind of dependency it covers: `API`, `SDK`, `package`, `runtime`, `CI` or `AI models`. |
| What it watches | The kind of change it reports, in a few words. |
| Format plugin | Which shared reader it is built on: `openapi` (a spec per release, diffed), `retirements` (a deprecations page), `migrationguide` (an SDK's migration guide), `removedmembers` (a package's table of removed members), `changelog` (a release changelog file), `feed` (an RSS or Atom feed), `catalog` (a structured JSON catalog of names, diffed between two snapshots), `apichangelog` (a vendor's machine-readable API changelog, in JSON). |
| Format plugin | Which shared reader it is built on: `openapi` (a spec per release, diffed), `retirements` (a deprecations page), `migrationguide` (an SDK's migration guide), `removedmembers` (a package's table of removed members, in RST or Markdown), `changelog` (a release changelog file), `feed` (an RSS or Atom feed), `catalog` (a structured JSON catalog of names, diffed between two snapshots), `apichangelog` (a vendor's machine-readable API changelog, in JSON). |
| Source | The provider's own public page or file the plugin reads. Every event links back to it. |
| Status | `live`: in the code on `main`. patch-it's hosted ingestion service runs it daily from the next release, which is cut automatically. `planned`: accepted, not written yet. `paused`: in the code but deliberately switched off, with the reason in the row. |

Some plugins read one pinned release (`anthropic` 1.0.0, `numpy` 2.0.0, `textual` 0.86.0, `urllib3` 2.0.0): a newer release of the same package is a new entry in that plugin, not a new row, unless it changes the format.
Some plugins read one pinned release (`anthropic` 1.0.0, `numpy` 2.0.0, `posthog` 8.0.0, `textual` 0.86.0, `urllib3` 2.0.0): a newer release of the same package is a new entry in that plugin, not a new row, unless it changes the format.
2 changes: 1 addition & 1 deletion docs/writing-a-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Write the numbers on the provider page, as `providers/vercel.md` does for its sp
| `plugins/openapi` | An OpenAPI spec per release, diffed with `diff/` and turned into events by `normalize/` | An `adapter.Adapter` in `adapter/` (latest tag, fetch a tag's spec) and a `plugin.Register(Plugin{Adapter: …})` line |
| `plugins/retirements` | A model provider's deprecations page (a table of date, model, replacement) | A `retire.Page` in `retire/providers.go` |
| `plugins/migrationguide` | An SDK's migration guide at a release tag (removed request parameters) | A `sdkguide.Guide` in `sdkguide/` |
| `plugins/removedmembers` | A package's table of removed members at a release tag | A `removedmembers.Guide` |
| `plugins/removedmembers` | A package's table of removed members at a release tag (an RST simple table or a Markdown pipe table) | A `removedmembers.Guide` |
| `plugins/changelog` | A `CHANGELOG.md` / `CHANGES.rst` / `HISTORY.rst` at a release tag | A `changelog.File` |
| `plugins/feed` | An RSS or Atom feed | A `feed.Feed` with a reader for that vendor's entries |
| `plugins/catalog` | A flat JSON catalog, one entry per name, with no release tags to pin — a commit SHA stands in | A `catalog.Catalog`, diffed between two snapshots for names that disappeared entirely |
Expand Down
203 changes: 203 additions & 0 deletions plugins/removedmembers/markdown.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
package removedmembers

import (
"fmt"
"regexp"
"slices"
"strings"
)

var (
codeSpan = regexp.MustCompile("`([^`]+)`")
ident = regexp.MustCompile(`^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)*$`)
// A cell that is only a list of code spans: "§", "§, §", "§ and §",
// "§, §, and §" (each § a code span).
nameList = regexp.MustCompile(`^§(?:(?:,| and|, and| or|, or) §)*$`)
delimCell = regexp.MustCompile(`^:?-{3,}:?$`)
)

// parseMarkdown reads a Markdown pipe table: the first one under the heading
// g.Section, before the next heading. Its first column is what was removed, its
// second what to use instead.
//
// A row becomes one Removal per name in its first cell, but only when that
// cell is nothing but code spans naming members ("`A`, `B`"). A cell of prose
// ("The `backoff` dependency") or a span that isn't a name code writes
// ("`gzip=True`") drops the whole row; a name in g.EnvVars drops that name. The replacement is the second cell
// only when it's exactly one code span naming a member.
func parseMarkdown(page []byte, g Guide) ([]Removal, error) {
lines := strings.Split(strings.ReplaceAll(string(page), "\r\n", "\n"), "\n")
inFence := false
// heading reports a line's heading text, outside fenced code (a "# 7.x.x"
// comment in a Python block isn't a heading).
heading := func(l string) (string, bool) {
if strings.HasPrefix(strings.TrimSpace(l), "```") {
inFence = !inFence
return "", false
}
if inFence {
return "", false
}
t := strings.TrimLeft(l, "#")
if n := len(l) - len(t); n == 0 || n > 6 || !strings.HasPrefix(t, " ") {
return "", false
}
return strings.TrimSpace(strings.TrimRight(strings.TrimSpace(t), "#")), true
}
start := -1
for i, l := range lines {
if h, ok := heading(l); ok && h == g.Section {
start = i
break
}
}
if start < 0 {
return nil, fmt.Errorf("no %q section: the guide's shape may have changed", g.Section)
}
table := -1
for i := start + 1; i+1 < len(lines); i++ {
if _, ok := heading(lines[i]); ok {
break
}
if !inFence && isRow(lines[i]) && isDelimiter(lines[i+1]) {
table = i
break
}
}
if table < 0 {
return nil, fmt.Errorf("no table under %q", g.Section)
}
header := pipeCells(lines[table])
if len(header) < 2 || !strings.EqualFold(header[0], g.header()) {
return nil, fmt.Errorf("the table under %q isn't the removed members: %q", g.Section, lines[table])
}
head := g.Section + "\n" + lines[table] + "\n" + lines[table+1]
var out []Removal
for i := table + 2; i < len(lines) && isRow(lines[i]); i++ {
cells := pipeCells(lines[i])
excerpt := head + "\n" + lines[i]
if len(cells) != len(header) {
out = append(out, Removal{Member: lines[i], Excerpt: excerpt,
Dropped: fmt.Sprintf("%d cells, the header has %d", len(cells), len(header))})
continue
}
guideline := header[1] + ": " + cells[1]
names, why := memberNames(cells[0], g.Module)
if why != "" {
out = append(out, Removal{Member: cells[0], Guideline: guideline, Excerpt: excerpt, Dropped: why})
continue
}
repl := soleName(cells[1], g.Module)
for _, n := range names {
r := Removal{Member: n, Guideline: guideline, Excerpt: excerpt}
if p, ok := g.Paths[n]; ok {
r.Member = p
}
switch {
case slices.Contains(g.EnvVars, n):
r.Dropped = "an environment variable, not a member of the package"
case g.StillWork[n] != "":
r.Dropped = g.StillWork[n]
case repl != "" && repl != n:
r.Replacement = repl
}
out = append(out, r)
}
}
if len(out) == 0 {
return nil, fmt.Errorf("the removed members table under %q is empty", g.Section)
}
return out, nil
}

func isRow(l string) bool {
return strings.HasPrefix(strings.TrimSpace(l), "|")
}

func isDelimiter(l string) bool {
if !isRow(l) {
return false
}
cells := pipeCells(l)
for _, c := range cells {
if !delimCell.MatchString(c) {
return false
}
}
return len(cells) > 0
}

// pipeCells splits a table row on the pipes outside code spans, each cell
// trimmed. An escaped pipe (\|) is part of its cell.
func pipeCells(row string) []string {
row = strings.TrimSpace(row)
row = strings.TrimPrefix(row, "|")
if strings.HasSuffix(row, "|") && !strings.HasSuffix(row, `\|`) {
row = row[:len(row)-1]
}
var cells []string
var cur strings.Builder
inCode := false
for i := 0; i < len(row); i++ {
c := row[i]
switch {
case c == '\\' && i+1 < len(row) && row[i+1] == '|':
cur.WriteByte('|')
i++
case c == '`':
inCode = !inCode
cur.WriteByte(c)
case c == '|' && !inCode:
cells = append(cells, strings.TrimSpace(cur.String()))
cur.Reset()
default:
cur.WriteByte(c)
}
}
return append(cells, strings.TrimSpace(cur.String()))
}

// memberNames reads a first cell that is only a list of code spans, each a
// name as code writes it after importing the package (the package's own
// prefix, "posthog.", stripped, as the changelog plugin does). why says why a
// cell isn't one.
func memberNames(cell, module string) (names []string, why string) {
spans := codeSpan.FindAllStringSubmatch(cell, -1)
if len(spans) == 0 {
return nil, "no code span: not a member's name"
}
rest := strings.Join(strings.Fields(codeSpan.ReplaceAllString(cell, "§")), " ")
if !nameList.MatchString(rest) {
return nil, "prose around the names, not a list of members (a parameter, a dependency…)"
}
for _, s := range spans {
n, ok := cleanName(s[1], module)
if !ok {
return nil, fmt.Sprintf("`%s` isn't a name code writes", s[1])
}
names = append(names, n)
}
return names, ""
}

// soleName is the cell's one name when the cell is exactly one code span
// naming a member, or "".
func soleName(cell, module string) string {
m := codeSpan.FindStringSubmatch(cell)
if m == nil || m[0] != strings.TrimSpace(cell) {
return ""
}
n, ok := cleanName(m[1], module)
if !ok {
return ""
}
return n
}

func cleanName(s, module string) (string, bool) {
s = strings.TrimSuffix(strings.TrimSpace(s), "()")
if module != "" {
s = strings.TrimPrefix(s, module+".")
}
return s, ident.MatchString(s) && s != module
}
80 changes: 80 additions & 0 deletions plugins/removedmembers/posthog.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
package removedmembers

// PostHog8 is the posthog Python SDK's guide to 8.0.0,
// docs/migration-7.x-to-8.0.md at tag posthog-v8.0.0 (commit
// 6edff41425188056e48f6119457dc9bc0669ca99), and its "Fix removed APIs"
// table: "8.x.x removes these options and APIs". The guide isn't in the repo
// at posthog-v7.91.4, the release before, and is unchanged at posthog-v8.0.2.
// Checked 2026-11-19.
//
// The table is Markdown, | Removed | Use instead |. Names are kept as code
// writes them after `import posthog` or a `from posthog.<module> import`:
// `posthog.` is stripped (`posthog.capture_v1` is `capture_v1`), as the
// changelog plugin and NumPy's `np.` do; other prefixes are kept
// (`request.batch_post`). One event per name, as NumPy has one per member. Its
// 7 rows, each checked against the code at posthog-v7.91.4 and posthog-v8.0.0:
//
// - `capture_mode`, `CaptureMode`, `POSTHOG_CAPTURE_MODE` | Nothing:
// removed_symbol for CaptureMode (the enum; posthog.CaptureMode is an
// alias of posthog.capture_mode.CaptureMode). capture_mode is dropped
// (StillWork): the guide's own "Rename deprecated settings" table says
// `posthog.capture_mode` "still work[s] or ha[s] no effect in 8.x.x",
// and the name also covers a Client argument and a module, which the row
// doesn't tell apart. POSTHOG_CAPTURE_MODE is the environment variable
// capture_mode read (EnvVars): no code imports it.
// - `gzip=True` | `capture_compression`: dropped. It's an argument value, of
// a call the row doesn't name (Client's gzip argument, per the code); a
// removed_parameter needs the call, and guessing it isn't reading the
// guide.
// - `CaptureV1Error` | `CaptureError`: removed_symbol capture_v1.CaptureV1Error
// (its module, Paths), with CaptureError
// in the migration hint, not a renamed_symbol (NewReplacements):
// CaptureError is new in 8.0.0, so a renamed import fails on 7.x, and the
// module changes too, from posthog.capture_v1 to posthog, which renaming
// the name alone wouldn't fix. The row doesn't say so; the guide does a
// few paragraphs below ("Replace `from posthog.capture_v1 import
// CaptureV1Error` with `from posthog import CaptureError`. There is no
// alias.").
// - `posthog.capture_v1` | `posthog.capture_event` and
// `posthog.capture_send`: removed_symbol capture_v1 (the module; two
// replacements, so no rename).
// - `request.batch_post`, `async_batch_post`, `EVENTS_ENDPOINT`,
// `AI_EVENTS_ENDPOINT` | Send events through a client: four removed_symbol
// (advice, not a name). The cell spells the module out only for the
// first: EVENTS_ENDPOINT and AI_EVENTS_ENDPOINT are posthog.request's and
// async_batch_post is the private posthog._async_request's, never
// top-level (Paths, checked against references/public_api_snapshot.txt
// and the code at posthog-v7.91.4).
// - The `gzip` parameter of `request.post` and `request.flags` | Nothing:
// dropped, prose. Not a removed_parameter either: both take **kwargs in
// 8.0.0, so gzip= raises nothing and is sent in the request body, as the
// guide says.
// - The `backoff` dependency | Your own requirements…: dropped, prose, and a
// dependency rather than a member.
//
// 7 events. The guide's other tables (endpoints, AI lane arguments, error
// fields, retries, dropped events, options, and "Rename deprecated settings",
// whose old names still work) aren't under the heading, so they're never read.
var PostHog8 = Guide{
Package: "posthog",
Module: "posthog",
Release: "8.0.0",
Tag: "posthog-v8.0.0",
Repo: "PostHog/posthog-python",
Path: "docs/migration-7.x-to-8.0.md",
Section: "Fix removed APIs",
Format: FormatMarkdown,
Header: "Removed",
EnvVars: []string{"POSTHOG_CAPTURE_MODE"},
Paths: map[string]string{
"CaptureV1Error": "capture_v1.CaptureV1Error",
"async_batch_post": "_async_request.async_batch_post",
"EVENTS_ENDPOINT": "request.EVENTS_ENDPOINT",
"AI_EVENTS_ENDPOINT": "request.AI_EVENTS_ENDPOINT",
},
StillWork: map[string]string{
"capture_mode": `the guide's "Rename deprecated settings" table: posthog.capture_mode still works or has no effect in 8.x.x`,
},
// Every replacement in the table is new in 8.0.0.
NewReplacements: true,
}
Loading
Loading