depdelta-cli 0.1.0__tar.gz → 0.3.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.
Files changed (46) hide show
  1. {depdelta_cli-0.1.0 → depdelta_cli-0.3.0}/.github/workflows/release.yml +0 -1
  2. {depdelta_cli-0.1.0 → depdelta_cli-0.3.0}/.gitignore +1 -0
  3. depdelta_cli-0.3.0/PKG-INFO +363 -0
  4. depdelta_cli-0.3.0/README.md +341 -0
  5. {depdelta_cli-0.1.0 → depdelta_cli-0.3.0}/pyproject.toml +14 -3
  6. {depdelta_cli-0.1.0 → depdelta_cli-0.3.0}/src/depdelta_cli/__init__.py +3 -2
  7. {depdelta_cli-0.1.0 → depdelta_cli-0.3.0}/src/depdelta_cli/api.py +17 -2
  8. depdelta_cli-0.3.0/src/depdelta_cli/azure.py +108 -0
  9. depdelta_cli-0.3.0/src/depdelta_cli/bitbucket.py +96 -0
  10. depdelta_cli-0.3.0/src/depdelta_cli/env.py +307 -0
  11. depdelta_cli-0.3.0/src/depdelta_cli/forgejo.py +89 -0
  12. {depdelta_cli-0.1.0 → depdelta_cli-0.3.0}/src/depdelta_cli/git.py +13 -0
  13. {depdelta_cli-0.1.0 → depdelta_cli-0.3.0}/src/depdelta_cli/main.py +125 -15
  14. {depdelta_cli-0.1.0 → depdelta_cli-0.3.0}/src/depdelta_cli/manifests.py +7 -0
  15. {depdelta_cli-0.1.0 → depdelta_cli-0.3.0}/tests/test_api.py +28 -0
  16. depdelta_cli-0.3.0/tests/test_azure.py +122 -0
  17. depdelta_cli-0.3.0/tests/test_bitbucket.py +117 -0
  18. depdelta_cli-0.3.0/tests/test_env.py +363 -0
  19. depdelta_cli-0.3.0/tests/test_forgejo.py +139 -0
  20. {depdelta_cli-0.1.0 → depdelta_cli-0.3.0}/tests/test_git.py +19 -0
  21. depdelta_cli-0.3.0/tests/test_main.py +608 -0
  22. {depdelta_cli-0.1.0 → depdelta_cli-0.3.0}/tests/test_manifests.py +7 -0
  23. {depdelta_cli-0.1.0 → depdelta_cli-0.3.0}/uv.lock +1 -1
  24. depdelta_cli-0.1.0/PKG-INFO +0 -166
  25. depdelta_cli-0.1.0/README.md +0 -145
  26. depdelta_cli-0.1.0/src/depdelta_cli/env.py +0 -116
  27. depdelta_cli-0.1.0/tests/test_env.py +0 -102
  28. depdelta_cli-0.1.0/tests/test_main.py +0 -258
  29. {depdelta_cli-0.1.0 → depdelta_cli-0.3.0}/.dockerignore +0 -0
  30. {depdelta_cli-0.1.0 → depdelta_cli-0.3.0}/.github/workflows/ci.yml +0 -0
  31. {depdelta_cli-0.1.0 → depdelta_cli-0.3.0}/Dockerfile +0 -0
  32. {depdelta_cli-0.1.0 → depdelta_cli-0.3.0}/LICENSE +0 -0
  33. {depdelta_cli-0.1.0 → depdelta_cli-0.3.0}/Makefile +0 -0
  34. {depdelta_cli-0.1.0 → depdelta_cli-0.3.0}/src/depdelta_cli/__main__.py +0 -0
  35. {depdelta_cli-0.1.0 → depdelta_cli-0.3.0}/src/depdelta_cli/check.py +0 -0
  36. {depdelta_cli-0.1.0 → depdelta_cli-0.3.0}/src/depdelta_cli/gerrit.py +0 -0
  37. {depdelta_cli-0.1.0 → depdelta_cli-0.3.0}/src/depdelta_cli/gitlab.py +0 -0
  38. {depdelta_cli-0.1.0 → depdelta_cli-0.3.0}/src/depdelta_cli/usage.py +0 -0
  39. {depdelta_cli-0.1.0 → depdelta_cli-0.3.0}/src/depdelta_cli/web.py +0 -0
  40. {depdelta_cli-0.1.0 → depdelta_cli-0.3.0}/tests/conftest.py +0 -0
  41. {depdelta_cli-0.1.0 → depdelta_cli-0.3.0}/tests/helpers.py +0 -0
  42. {depdelta_cli-0.1.0 → depdelta_cli-0.3.0}/tests/test_check.py +0 -0
  43. {depdelta_cli-0.1.0 → depdelta_cli-0.3.0}/tests/test_gerrit.py +0 -0
  44. {depdelta_cli-0.1.0 → depdelta_cli-0.3.0}/tests/test_gitlab.py +0 -0
  45. {depdelta_cli-0.1.0 → depdelta_cli-0.3.0}/tests/test_usage.py +0 -0
  46. {depdelta_cli-0.1.0 → depdelta_cli-0.3.0}/tests/test_web.py +0 -0
@@ -60,7 +60,6 @@ jobs:
60
60
  tags: |
61
61
  type=semver,pattern={{version}}
62
62
  type=semver,pattern={{major}}.{{minor}}
63
- type=raw,value=latest
64
63
  labels: |
65
64
  org.opencontainers.image.licenses=MIT
66
65
  - uses: docker/build-push-action@v7
@@ -6,3 +6,4 @@ __pycache__/
6
6
  .ruff_cache/
7
7
  dist/
8
8
  .claude/
9
+ .idea/
@@ -0,0 +1,363 @@
1
+ Metadata-Version: 2.5
2
+ Name: depdelta-cli
3
+ Version: 0.3.0
4
+ Summary: DepDelta for CI: review a change's dependency updates on Gerrit, GitLab, Forgejo or Gitea.
5
+ Project-URL: Homepage, https://depdelta.com
6
+ Project-URL: Documentation, https://depdelta.com/ci
7
+ Project-URL: Source, https://github.com/mbobiosio/depdelta-cli
8
+ Project-URL: Issues, https://github.com/mbobiosio/depdelta-cli/issues
9
+ Author: Mbuodile Obiosio
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: breaking-changes,ci,codeberg,dependencies,forgejo,gerrit,gitea,gitlab,renovate
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Topic :: Software Development :: Build Tools
19
+ Classifier: Topic :: Software Development :: Quality Assurance
20
+ Requires-Python: >=3.11
21
+ Description-Content-Type: text/markdown
22
+
23
+ # depdelta-cli
24
+
25
+ [![PyPI](https://img.shields.io/pypi/v/depdelta-cli)](https://pypi.org/project/depdelta-cli/)
26
+ [![CI](https://github.com/mbobiosio/depdelta-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/mbobiosio/depdelta-cli/actions/workflows/ci.yml)
27
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
28
+
29
+ Know what a dependency update breaks before you merge, on Gerrit, GitLab,
30
+ Forgejo and Gitea (Codeberg included), Bitbucket Cloud and Azure DevOps.
31
+
32
+ [DepDelta](https://depdelta.com) reads every release's notes, security
33
+ advisories and published API between two versions of a package, and says
34
+ what changed and what will break: see
35
+ [eslint 8.57.0 → 9.0.0](https://depdelta.com/npm/eslint/compare/8.57.0...9.0.0)
36
+ for an example. `depdelta` brings that review to your CI. On every change that
37
+ updates a dependency (from Renovate or anyone) it posts the breaking changes,
38
+ security fixes, removed APIs and where your code uses them, right on the
39
+ change.
40
+
41
+ On GitHub, the [DepDelta GitHub app](https://depdelta.com/github-app) does
42
+ this with no CI job. Setup guide, example review and FAQ:
43
+ **[depdelta.com/ci](https://depdelta.com/ci)**.
44
+
45
+ ## How it works
46
+
47
+ On every change that touches a manifest or lockfile, `depdelta`:
48
+
49
+ 1. sends the changed manifests and lockfiles (both ends) to DepDelta. Source
50
+ code is never sent;
51
+ 2. gets back each update's verdict and, for npm and Maven, the declarations
52
+ it removes or changes;
53
+ 3. looks for those declarations in the checkout, and sends only the hits
54
+ (path, line, symbol);
55
+ 4. posts the review: a Gerrit change message (no vote), or one GitLab merge
56
+ request note, Forgejo/Gitea or Bitbucket pull request comment, or Azure
57
+ DevOps pull request thread that later runs edit in place. Each update
58
+ links to its full comparison on depdelta.com.
59
+
60
+ Beyond each update, the review says what the change does to your lockfiles:
61
+ packages before and after, new and removed direct dependencies (dev or
62
+ production, and what each pulls in), and packages that newly run code at
63
+ install time (an npm install script, a Python package built from source, a
64
+ Composer plugin, a Cargo build script).
65
+
66
+ Nine ecosystems: npm, PyPI, Maven, Composer, Cargo, RubyGems, pub.dev,
67
+ NuGet and Go. For Android and other Gradle builds that means
68
+ `build.gradle(.kts)`, `settings.gradle(.kts)`, version catalogs
69
+ (`gradle/libs.versions.toml`, libraries and plugins) and
70
+ `gradle.lockfile`; plugins count as updates too (AGP, Kotlin, KSP, Hilt).
71
+ Needs Python 3.11+ and git, nothing else.
72
+
73
+ ```
74
+ docker pull ghcr.io/mbobiosio/depdelta-cli:latest
75
+ # or
76
+ pip install depdelta-cli
77
+ ```
78
+
79
+ ## API key
80
+
81
+ Sign in at [depdelta.com](https://depdelta.com) with GitHub or Google,
82
+ make a key in [Settings → API keys for CI](https://depdelta.com/settings),
83
+ and store it in your CI's secrets as `DEPDELTA_API_KEY`. Each key gets 240
84
+ reviews an hour, waiting on release notes included.
85
+
86
+ ## Jenkins with Gerrit Trigger
87
+
88
+ The job runs on `patchset-created`. Gerrit Trigger sets `GERRIT_PROJECT`,
89
+ `GERRIT_CHANGE_NUMBER`, `GERRIT_PATCHSET_REVISION` and `GERRIT_CHANGE_URL`.
90
+ The review is posted with a Gerrit account's HTTP password: a service
91
+ account works best.
92
+
93
+ The checkout needs the patch set's parent: don't clone with depth 1 (or let
94
+ `depdelta` fetch it; it does when the parent is missing).
95
+
96
+ ```groovy
97
+ pipeline {
98
+ agent { docker { image 'ghcr.io/mbobiosio/depdelta-cli:latest' } }
99
+ stages {
100
+ stage('DepDelta') {
101
+ steps {
102
+ withCredentials([
103
+ string(credentialsId: 'depdelta-api-key', variable: 'DEPDELTA_API_KEY'),
104
+ usernamePassword(credentialsId: 'gerrit-http',
105
+ usernameVariable: 'GERRIT_HTTP_USER',
106
+ passwordVariable: 'GERRIT_HTTP_PASSWORD'),
107
+ ]) {
108
+ // A DepDelta outage shouldn't fail the build.
109
+ catchError(buildResult: 'SUCCESS', stageResult: 'UNSTABLE') {
110
+ sh 'depdelta'
111
+ }
112
+ }
113
+ }
114
+ }
115
+ }
116
+ }
117
+ ```
118
+
119
+ Without Docker: `pip install depdelta-cli` on the agent, then the same
120
+ `sh 'depdelta'`.
121
+
122
+ `DEPDELTA_GERRIT_URL` overrides Gerrit's address when `GERRIT_CHANGE_URL`
123
+ isn't the REST root (a proxy, a different host name for agents).
124
+
125
+ Messages carry the tag `autogenerated:depdelta`, so Gerrit folds older patch
126
+ sets' reviews away, and notify only the change owner.
127
+
128
+ ## GitLab CI
129
+
130
+ Runs in merge request pipelines. `CI_JOB_TOKEN` can't write notes: give the
131
+ job a project access token with the `api` scope (Reporter role is enough) as
132
+ `GITLAB_TOKEN`.
133
+
134
+ ```yaml
135
+ depdelta:
136
+ image: ghcr.io/mbobiosio/depdelta-cli:latest
137
+ rules:
138
+ - if: $CI_PIPELINE_SOURCE == "merge_request_event"
139
+ changes:
140
+ - "**/package.json"
141
+ - "**/package-lock.json"
142
+ - "**/pom.xml"
143
+ - "**/requirements*.txt"
144
+ - "**/pyproject.toml"
145
+ - "**/*.lock"
146
+ - "**/go.mod"
147
+ variables:
148
+ GIT_DEPTH: 0
149
+ script:
150
+ - depdelta
151
+ allow_failure: true
152
+ ```
153
+
154
+ Uses link to the files at the merge request's head commit.
155
+
156
+ ## Forgejo and Gitea
157
+
158
+ Codeberg, self-hosted Forgejo and Gitea share one API, so one setup covers
159
+ them: Forgejo Actions, Gitea Actions, or Woodpecker CI. The review is one
160
+ pull request comment that later runs edit in place. The token comes from
161
+ `FORGEJO_TOKEN`, else `GITEA_TOKEN`, else `GITHUB_TOKEN`.
162
+
163
+ ### Forgejo Actions and Gitea Actions
164
+
165
+ The workflow's own token can comment on pull requests from branches of the
166
+ same repository. On a pull request from a fork it is read-only (and secrets
167
+ are not passed), so the review can't be posted there.
168
+
169
+ ```yaml
170
+ # .forgejo/workflows/depdelta.yml (Gitea: .gitea/workflows/depdelta.yml)
171
+ on: pull_request
172
+
173
+ jobs:
174
+ depdelta:
175
+ runs-on: docker
176
+ steps:
177
+ - uses: actions/checkout@v4
178
+ with:
179
+ fetch-depth: 0
180
+ - name: DepDelta
181
+ # A DepDelta outage shouldn't fail the pull request.
182
+ continue-on-error: true
183
+ env:
184
+ DEPDELTA_API_KEY: ${{ secrets.DEPDELTA_API_KEY }}
185
+ FORGEJO_TOKEN: ${{ github.token }}
186
+ run: |
187
+ curl -LsSf https://astral.sh/uv/install.sh | sh
188
+ ~/.local/bin/uvx --from depdelta-cli depdelta
189
+ ```
190
+
191
+ The job needs Python 3.11+ and git; the lines above fetch Python with
192
+ [uv](https://docs.astral.sh/uv/). With Python on the runner,
193
+ `pip install depdelta-cli && depdelta` does the same. A pull request that
194
+ touches no manifests or lockfiles ends at once with nothing to review.
195
+
196
+ ### Woodpecker CI
197
+
198
+ For a Forgejo or Gitea forge (`CI_FORGE_TYPE` is `forgejo` or `gitea`).
199
+ Woodpecker has no token for the forge: make an access token with the
200
+ `write:issue` and `read:repository` scopes (a bot account works best) and
201
+ store it as a secret. Woodpecker hides secrets from pull requests until
202
+ you allow the `pull_request` event on each one.
203
+
204
+ ```yaml
205
+ # .woodpecker/depdelta.yaml
206
+ when:
207
+ - event: pull_request
208
+
209
+ steps:
210
+ - name: depdelta
211
+ image: ghcr.io/mbobiosio/depdelta-cli:latest
212
+ commands:
213
+ - depdelta
214
+ environment:
215
+ DEPDELTA_API_KEY:
216
+ from_secret: depdelta_api_key
217
+ FORGEJO_TOKEN:
218
+ from_secret: forgejo_token
219
+ failure: ignore
220
+ ```
221
+
222
+ Woodpecker names only the target branch, so `depdelta` asks the forge for
223
+ the pull request's merge base, and fetches it when the clone is shallow.
224
+ Uses link to the files at the pull request's head commit.
225
+
226
+ ## Bitbucket Pipelines
227
+
228
+ Bitbucket Cloud, in a pull request pipeline. Pipelines has no token that can
229
+ comment: make a repository access token with the `pullrequest:write` scope
230
+ (Repository settings → Access tokens) and store it as a secured repository
231
+ variable `BITBUCKET_ACCESS_TOKEN`, next to `DEPDELTA_API_KEY`. An Atlassian
232
+ API token works too: set `BITBUCKET_EMAIL` and `BITBUCKET_API_TOKEN`.
233
+
234
+ ```yaml
235
+ # bitbucket-pipelines.yml
236
+ pipelines:
237
+ pull-requests:
238
+ "**":
239
+ - step:
240
+ name: DepDelta
241
+ image: ghcr.io/mbobiosio/depdelta-cli:latest
242
+ clone:
243
+ depth: full
244
+ script:
245
+ # A DepDelta outage shouldn't fail the pull request.
246
+ - depdelta || true
247
+ ```
248
+
249
+ Bitbucket shows HTML as text, so the review comes as plain Markdown, one
250
+ section per update. Bitbucket names only the destination's tip, so
251
+ `depdelta` asks Bitbucket for the pull request's merge base. Uses link to
252
+ the lines at the pull request's head commit. To fail the build with
253
+ `--fail-on`, drop the `|| true`.
254
+
255
+ ## Azure Pipelines
256
+
257
+ Azure Repos pull requests, run as build validation: add the pipeline to the
258
+ target branch's policies (Branch policies → Build validation). Give the
259
+ build service permission to comment: Project settings → Repositories → your
260
+ repository → Security → "*Project* Build Service" → Contribute to pull
261
+ requests: Allow. The job's token reaches `depdelta` only when mapped into
262
+ the step's environment:
263
+
264
+ ```yaml
265
+ # azure-pipelines.yml
266
+ trigger: none
267
+
268
+ pool:
269
+ vmImage: ubuntu-latest
270
+
271
+ steps:
272
+ - checkout: self
273
+ fetchDepth: 0
274
+ - script: pipx run --spec depdelta-cli depdelta
275
+ displayName: DepDelta
276
+ # A DepDelta outage shouldn't fail the pull request.
277
+ continueOnError: true
278
+ env:
279
+ DEPDELTA_API_KEY: $(DEPDELTA_API_KEY)
280
+ SYSTEM_ACCESSTOKEN: $(System.AccessToken)
281
+ ```
282
+
283
+ A personal access token with Code: Read & write works too, as
284
+ `AZURE_DEVOPS_TOKEN`. The review is one pull request thread that later
285
+ builds edit in place; it starts active, so it can be resolved like any
286
+ comment. The build checks out a merge commit, so `depdelta` asks Azure
287
+ DevOps where the pull request starts. Repositories on GitHub built in Azure
288
+ Pipelines aren't covered: use the GitHub app.
289
+
290
+ ## Options
291
+
292
+ ```
293
+ depdelta [--repo .] [--base REV --head REV] [--print]
294
+ [--format markdown|commonmark|text] [--wait 300]
295
+ [--fail-on never|breaking|review|unknown|safe]
296
+ [--api-url URL]
297
+ ```
298
+
299
+ - `--print` prints the review instead of posting it. With `--base` and
300
+ `--head` (outside CI) it always prints:
301
+ `depdelta --base origin/main --head HEAD`.
302
+ - `--wait` is how long to wait for DepDelta to read release notes it hasn't
303
+ seen yet. After that the review posts as it stands, saying what is still
304
+ being read.
305
+ - `--fail-on breaking` exits 1 when an update is breaking, to fail the job.
306
+
307
+ Exit status: 0 posted (or nothing to review), 1 the `--fail-on` verdict was
308
+ met or `.depdelta.yml` blocks new install-time code, 2 it couldn't review or
309
+ post.
310
+
311
+ ## .depdelta.yml
312
+
313
+ An optional file at the repository root, read at the change's head commit.
314
+ The GitHub app reads the same file.
315
+
316
+ ```yaml
317
+ install_scripts: warn # off | warn (default) | block
318
+ allow_install_scripts: # never flagged
319
+ - esbuild
320
+ - sharp
321
+ ```
322
+
323
+ - `warn` flags each package that newly runs code at install.
324
+ - `block` flags them too, and `depdelta` exits 1, so the job fails until the
325
+ package is allowed or removed.
326
+ - `off` leaves install-time code out of the review.
327
+
328
+ `depdelta` sends the file as it is; DepDelta reads it. A file it can't read
329
+ falls back to the defaults, and the review says why.
330
+
331
+ ## Privacy
332
+
333
+ Only the changed manifests and lockfiles leave CI, plus, for updates with
334
+ removed or changed APIs, the path, line and symbol of each use found. The
335
+ source code stays in CI. Forge credentials (Gerrit, GitLab, Forgejo, Gitea,
336
+ Bitbucket, Azure DevOps) are sent only to that forge. The [privacy policy](https://depdelta.com/privacy) has the
337
+ details.
338
+
339
+ ## Links
340
+
341
+ - Website: [depdelta.com](https://depdelta.com)
342
+ - CI setup guide: [depdelta.com/ci](https://depdelta.com/ci)
343
+ - GitHub app: [depdelta.com/github-app](https://depdelta.com/github-app)
344
+ - Check a whole project's dependencies: [depdelta.com/report](https://depdelta.com/report)
345
+ - Issues: [github.com/mbobiosio/depdelta-cli/issues](https://github.com/mbobiosio/depdelta-cli/issues)
346
+
347
+ ## Development
348
+
349
+ ```
350
+ uv sync
351
+ make check format test
352
+ ```
353
+
354
+ `src/depdelta_cli/usage.py` is the same usage matcher the DepDelta service
355
+ and GitHub app run, and `manifests.py` uses the same manifest names: changes
356
+ to either start in the service, then are copied here.
357
+
358
+ Releases: bump `version` in `pyproject.toml`, then tag `v<version>` and
359
+ push the tag. GitHub Actions publishes to PyPI and GHCR.
360
+
361
+ ## License
362
+
363
+ MIT