lockly 0.1.0__py3-none-any.whl

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.
lockly/render.py ADDED
@@ -0,0 +1,250 @@
1
+ """Text, Markdown and JSON renderings of a Diff."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ import os
7
+ import sys
8
+ from dataclasses import asdict
9
+
10
+ from . import __version__
11
+ from .diff import CHANGE_KINDS, Change, Diff
12
+
13
+ # The Action finds its earlier comment by this, to update it in place.
14
+ COMMENT_MARKER = "<!-- lockly -->"
15
+
16
+ CHANGE_TITLES = {
17
+ "added": "Added", "removed": "Removed", "upgraded": "Upgraded",
18
+ "downgraded": "Downgraded", "changed": "Changed in place",
19
+ }
20
+
21
+ FINDING_TITLES = {
22
+ "hash": "Integrity",
23
+ "install-script": "Install script",
24
+ "publisher": "Publisher",
25
+ "provenance": "Provenance",
26
+ "source": "Source",
27
+ "new-package": "New package",
28
+ "young": "Fresh release",
29
+ "vulnerable": "Vulnerable",
30
+ "deprecated": "Deprecated",
31
+ "copyleft": "Copyleft",
32
+ "license": "Licence",
33
+ }
34
+
35
+
36
+ def plural(n: int, word: str, many: str = "") -> str:
37
+ return f"{n} {word if n == 1 else (many or word + 's')}"
38
+
39
+
40
+ def summary(d: Diff) -> str:
41
+ if not d.changes:
42
+ return "No dependency changes."
43
+ parts = [f"{d.count(k)} {k}" for k in CHANGE_KINDS if d.count(k)]
44
+ return ", ".join(parts) + "."
45
+
46
+
47
+ def gating(d: Diff) -> list:
48
+ return [f for f in d.findings if f.gating]
49
+
50
+
51
+ def fixed_total(d: Diff) -> int:
52
+ return len({v for f in d.files for ids in f.fixed.values() for v in ids})
53
+
54
+
55
+ def _where(c: Change) -> str:
56
+ if c.direct is True:
57
+ return "direct, dev" if c.dev else "direct"
58
+ if c.direct is False:
59
+ return "dev" if c.dev else ""
60
+ return "dev" if c.dev else ""
61
+
62
+
63
+ def _versions(c: Change) -> tuple[str, str]:
64
+ return c.old_version, c.new_version
65
+
66
+
67
+ # ── JSON ──────────────────────────────────────────────────────────────
68
+
69
+ def _change_json(c: Change) -> dict:
70
+ doc = {"kind": c.kind, "ecosystem": c.ecosystem, "name": c.name,
71
+ "from": c.old_version or None, "to": c.new_version or None,
72
+ "direct": c.direct, "dev": c.dev}
73
+ for side, meta in (("fromMeta", c.old_meta), ("toMeta", c.new_meta)):
74
+ if meta is not None:
75
+ doc[side] = {k: v for k, v in asdict(meta).items() if v not in ("", None, [], {})}
76
+ return doc
77
+
78
+
79
+ def to_json(d: Diff, fail_on: set[str] | None = None) -> str:
80
+ doc: dict = {
81
+ "tool": {"name": "lockly", "version": __version__},
82
+ "summary": {**{k: d.count(k) for k in CHANGE_KINDS},
83
+ "findings": len(gating(d)), "fixedVulnerabilities": fixed_total(d)},
84
+ "lockfiles": [{
85
+ "path": f.path, "type": f.kind, "ecosystem": f.ecosystem, "unchanged": f.unchanged,
86
+ "changes": [_change_json(c) for c in f.changes],
87
+ "findings": [asdict(x) for x in f.findings],
88
+ "fixed": f.fixed,
89
+ } for f in d.files],
90
+ "notes": d.notes,
91
+ }
92
+ if fail_on is not None:
93
+ doc["failOn"] = {"categories": sorted(fail_on), "triggered": d.triggered(fail_on)}
94
+ return json.dumps(doc, indent=2, ensure_ascii=False) + "\n"
95
+
96
+
97
+ # ── Terminal ──────────────────────────────────────────────────────────
98
+
99
+ # Closest terminal colours to the Full-Stack-Spectrum palette: blue for new,
100
+ # bright blue for upgrades, 256-colour 209 for orange, red only for the
101
+ # findings that most often mean a compromise.
102
+ _COLOURS = {
103
+ "added": "34", "removed": "2", "upgraded": "94", "downgraded": "38;5;209", "changed": "33",
104
+ "hash": "31;1", "install-script": "31;1", "publisher": "31;1", "provenance": "38;5;209",
105
+ "source": "38;5;209", "new-package": "38;5;209", "young": "33", "vulnerable": "38;5;209",
106
+ "deprecated": "33", "copyleft": "38;5;209", "license": "33", "good": "34",
107
+ "dim": "2", "bold": "1",
108
+ }
109
+
110
+
111
+ def use_colour(stream=None) -> bool:
112
+ stream = stream or sys.stdout
113
+ if os.environ.get("NO_COLOR"):
114
+ return False
115
+ if os.environ.get("FORCE_COLOR"):
116
+ return True
117
+ return hasattr(stream, "isatty") and stream.isatty()
118
+
119
+
120
+ def to_text(d: Diff, colour: bool = False, limit: int = 25) -> str:
121
+ def c(style: str, text: str) -> str:
122
+ return f"\033[{_COLOURS[style]}m{text}\033[0m" if colour and text else text
123
+
124
+ # One column for finding types and change kinds, wide enough for both.
125
+ width = max([len(FINDING_TITLES[f.kind]) for f in d.findings] + [len("downgraded")])
126
+ lines = [c("dim", "// ") + c("bold", "lockly") + c("dim", " " + plural(len(d.files), "lockfile")),
127
+ "", summary(d)]
128
+ flagged = gating(d)
129
+ if flagged:
130
+ lines[-1] += " " + c("bold", plural(len(flagged), "finding") + " to review.")
131
+
132
+ for fd in d.files:
133
+ if not fd.changes:
134
+ continue
135
+ counts = ", ".join(f"{fd.count(k)} {k}" for k in CHANGE_KINDS if fd.count(k))
136
+ lines += ["", c("dim", "// ") + c("bold", fd.path) + c("dim", f" {fd.ecosystem} · {counts}")]
137
+ for f in fd.findings[:limit]:
138
+ tag = c(f.kind if f.gating else "dim", f"{FINDING_TITLES[f.kind].lower():<{width}}")
139
+ note = "" if f.gating else c("dim", " (info)")
140
+ lines.append(f" {tag} {f.name} {c('dim', f.version)} {f.message}{note}")
141
+ if len(fd.findings) > limit:
142
+ lines.append(c("dim", f" … and {len(fd.findings) - limit} more findings"))
143
+ if fd.fixed:
144
+ n = len({v for ids in fd.fixed.values() for v in ids})
145
+ label = c("good", "fixed".ljust(width))
146
+ lines.append(f" {label} {plural(n, 'known vulnerability', 'known vulnerabilities')} fixed by "
147
+ + ", ".join(sorted(fd.fixed)[:4]) + (" …" if len(fd.fixed) > 4 else ""))
148
+ direct = [ch for ch in fd.changes if ch.direct and ch.kind != "removed"]
149
+ for ch in direct[:limit]:
150
+ old, new = _versions(ch)
151
+ version = new if ch.kind == "added" else f"{old} → {new}"
152
+ lines.append(f" {c(ch.kind, f'{ch.kind:<{width}}')} {ch.name} {c('dim', version)}" + c("dim", " direct"))
153
+ rest = len(fd.changes) - len(direct)
154
+ if rest > 0:
155
+ lines.append(c("dim", f" … {plural(rest, 'transitive change')} not listed (see --markdown, --json or --html)"))
156
+
157
+ for note in d.notes:
158
+ lines += ["", c("dim", "note: " + note)]
159
+ return "\n".join(lines) + "\n"
160
+
161
+
162
+ # ── Markdown ──────────────────────────────────────────────────────────
163
+
164
+ MARKDOWN_BUDGET = 60_000
165
+
166
+
167
+ def _md(text: str) -> str:
168
+ """Escape the characters that would break a table cell or inject markup."""
169
+ for ch in ("\\", "|", "`", "*", "_", "[", "]", "<", ">"):
170
+ text = text.replace(ch, "\\" + ch)
171
+ return text.replace("\n", " ")
172
+
173
+
174
+ def _code(text: str) -> str:
175
+ # GitHub splits table cells on '|' even inside a code span, so it still
176
+ # needs escaping there; a backtick would end the span early.
177
+ if not text:
178
+ return "—"
179
+ text = " ".join(text.split()).replace("`", "").replace("|", "\\|")
180
+ return f"`{text}`"
181
+
182
+
183
+ def to_markdown(d: Diff, limit: int = 100, title: str = "") -> str:
184
+ out: list[str] = [COMMENT_MARKER, f"### {_md(title) if title else 'Lockfile review'}", ""]
185
+ flagged = gating(d)
186
+ headline = f"{plural(len(d.files), 'lockfile')} changed · {_md(summary(d).rstrip('.'))}"
187
+ if flagged:
188
+ headline += f" · **{plural(len(flagged), 'finding')} to review**"
189
+ elif d.changes:
190
+ headline += " · nothing flagged"
191
+ out += [headline, ""]
192
+
193
+ size = sum(len(line) + 1 for line in out)
194
+ truncated = False
195
+
196
+ def block(lines: list[str]) -> bool:
197
+ nonlocal size, truncated
198
+ cost = sum(len(x) + 1 for x in lines)
199
+ if size + cost > MARKDOWN_BUDGET:
200
+ truncated = True
201
+ return False
202
+ out.extend(lines)
203
+ size += cost
204
+ return True
205
+
206
+ if flagged or any(not f.gating for f in d.findings):
207
+ rows = ["| | Package | Version | Detail |", "|---|---|---|---|"]
208
+ for f in d.findings[:limit]:
209
+ label = FINDING_TITLES[f.kind] + ("" if f.gating else " (info)")
210
+ where = f" <sub>{_md(f.lockfile)}</sub>" if len(d.files) > 1 else ""
211
+ rows.append(f"| {label} | {_md(f.name)}{where} | {_code(f.version)} | {_md(f.message)} |")
212
+ if len(d.findings) > limit:
213
+ rows.append(f"| | _… {len(d.findings) - limit} more in the JSON or HTML report_ | | |")
214
+ block(rows + [""])
215
+
216
+ fixed = fixed_total(d)
217
+ if fixed:
218
+ names = sorted({k for f in d.files for k in f.fixed})
219
+ block([f"These changes fix {plural(fixed, 'known vulnerability', 'known vulnerabilities')} "
220
+ f"({_md(', '.join(names[:6]))}{' …' if len(names) > 6 else ''}).", ""])
221
+
222
+ for fd in d.files:
223
+ if not fd.changes:
224
+ continue
225
+ counts = ", ".join(f"{fd.count(k)} {k}" for k in CHANGE_KINDS if fd.count(k))
226
+ rows = [f"<details><summary><code>{_md(fd.path)}</code> · {fd.ecosystem} · {counts}</summary>", "",
227
+ "| Change | Package | From | To | |", "|---|---|---|---|---|"]
228
+ # Direct dependencies first: those are the ones someone chose.
229
+ ordered = sorted(fd.changes, key=lambda ch: (not ch.direct, CHANGE_KINDS.index(ch.kind), ch.name.lower()))
230
+ shown = 0
231
+ for ch in ordered[:limit]:
232
+ old, new = _versions(ch)
233
+ row = f"| {CHANGE_TITLES[ch.kind]} | {_md(ch.name)} | {_code(old)} | {_code(new)} | {_where(ch)} |"
234
+ if size + sum(len(x) + 1 for x in rows) + len(row) > MARKDOWN_BUDGET - 500:
235
+ truncated = True
236
+ break
237
+ rows.append(row)
238
+ shown += 1
239
+ if shown < len(ordered):
240
+ rows += ["", f"_… {len(ordered) - shown} more in the JSON or HTML report._"]
241
+ rows += ["", "</details>", ""]
242
+ block(rows)
243
+
244
+ for note in d.notes:
245
+ block([f"> {_md(note)}", ""])
246
+ if truncated:
247
+ out += ["_This comment was shortened to fit GitHub's size limit._", ""]
248
+ out.append(f"<sub>Generated by [Lockly](https://github.com/fullstackspectrum/lockly) {__version__}</sub>")
249
+ return "\n".join(out) + "\n"
250
+
lockly/versions.py ADDED
@@ -0,0 +1,57 @@
1
+ """Ordering versions across ecosystems, well enough to call a change an
2
+ upgrade or a downgrade. Adapted from Sbomly."""
3
+
4
+ from __future__ import annotations
5
+
6
+ import re
7
+
8
+ _TOKEN = re.compile(r"\d+|[a-zA-Z]+")
9
+ _OPAQUE = re.compile(r"^[0-9a-f]{7,64}$", re.I)
10
+
11
+
12
+ def _tokens(version: str) -> tuple[int, list[int | str]]:
13
+ version = version.strip().removeprefix("v").removeprefix("V")
14
+ # Drop build metadata (1.2.3+build.5, Cargo's 0.1.0+wasi): it never orders.
15
+ version = version.split("+", 1)[0]
16
+ epoch = 0
17
+ match = re.match(r"^(\d+)!(.+)$", version) # PEP 440 epochs: 1!2.0 sorts after 9.9
18
+ if match:
19
+ epoch, version = int(match.group(1)), match.group(2)
20
+ return epoch, [int(t) if t.isdigit() else t.lower() for t in _TOKEN.findall(version)]
21
+
22
+
23
+ def compare(a: str, b: str) -> int | None:
24
+ """-1, 0 or 1 like cmp(); None when the versions can't be ordered (commit SHAs)."""
25
+ if a == b:
26
+ return 0
27
+ if not a or not b or _OPAQUE.match(a) or _OPAQUE.match(b):
28
+ return None
29
+ epoch_a, ta = _tokens(a)
30
+ epoch_b, tb = _tokens(b)
31
+ if epoch_a != epoch_b:
32
+ return -1 if epoch_a < epoch_b else 1
33
+ if not ta or not tb:
34
+ return None
35
+ for x, y in zip(ta, tb):
36
+ if x == y:
37
+ continue
38
+ if isinstance(x, int) and isinstance(y, int):
39
+ return -1 if x < y else 1
40
+ if isinstance(x, str) and isinstance(y, str):
41
+ return -1 if x < y else 1
42
+ # A number beats a word in the same slot: 1.0.1 > 1.0.beta.
43
+ return 1 if isinstance(x, int) else -1
44
+ if len(ta) == len(tb):
45
+ return 0
46
+ # One is a prefix of the other. A trailing word marks a pre-release
47
+ # (1.0.0rc1 < 1.0.0); a trailing number is a later release (1.0 < 1.0.1).
48
+ longer, sign = (ta, 1) if len(ta) > len(tb) else (tb, -1)
49
+ nxt = longer[min(len(ta), len(tb))]
50
+ return -sign if isinstance(nxt, str) else sign
51
+
52
+
53
+ def sort_key(version: str):
54
+ """For sorting lists of versions; unorderable ones sort as text, last."""
55
+ import functools
56
+
57
+ return functools.cmp_to_key(lambda a, b: compare(a, b) or (a > b) - (a < b))(version)
@@ -0,0 +1,179 @@
1
+ Metadata-Version: 2.4
2
+ Name: lockly
3
+ Version: 0.1.0
4
+ Summary: Explain lockfile changes in a pull request: what moved, and which changes deserve a look (install scripts, new publishers, fresh releases, vulnerabilities)
5
+ Author-email: Colin Moynes <dev@fullstackspectrum.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/fullstackspectrum/lockly
8
+ Project-URL: Issues, https://github.com/fullstackspectrum/lockly/issues
9
+ Keywords: lockfile,dependencies,supply-chain,security,npm,pypi,cargo,go,pull-request,code-review
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: System Administrators
14
+ Classifier: Operating System :: OS Independent
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: Programming Language :: Python :: 3.14
20
+ Classifier: Topic :: Security
21
+ Classifier: Topic :: Software Development :: Quality Assurance
22
+ Classifier: Typing :: Typed
23
+ Requires-Python: >=3.11
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Provides-Extra: dev
27
+ Requires-Dist: pytest>=7.0; extra == "dev"
28
+ Dynamic: license-file
29
+
30
+ [![Lockly: what changed in the lockfile, and why it matters.](https://raw.githubusercontent.com/fullstackspectrum/lockly/main/docs/brand/readme-banner.png)](https://github.com/fullstackspectrum/lockly)
31
+
32
+ [![CI](https://img.shields.io/github/actions/workflow/status/fullstackspectrum/lockly/build.yml?branch=main&style=for-the-badge&logo=githubactions&logoColor=white&label=CI&color=4f8cff&labelColor=10151d)](https://github.com/fullstackspectrum/lockly/actions/workflows/build.yml)
33
+ [![PyPI](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fpypi.org%2Fpypi%2Flockly%2Fjson&query=%24.info.version&prefix=v&label=pypi&style=for-the-badge&logo=pypi&logoColor=white&color=8fb4ff&labelColor=10151d)](https://pypi.org/project/lockly/)
34
+ [![Python](https://img.shields.io/badge/python-3.11%2B-f5c84c?style=for-the-badge&logo=python&logoColor=white&labelColor=10151d)](https://pypi.org/project/lockly/)
35
+ [![License](https://img.shields.io/badge/license-Apache--2.0-646f7f?style=for-the-badge&labelColor=10151d)](https://github.com/fullstackspectrum/lockly/blob/main/LICENSE)
36
+
37
+ # Lockly
38
+
39
+ **What changed in the lockfile, and why it matters.**
40
+
41
+ A dependency bump can change a few lines of `package.json` and thousands of lines of `package-lock.json`. Nobody reviews the second part. Lockly does: it reads the lockfile before and after a change, lists what moved, and flags the changes a reviewer should actually stop for:
42
+
43
+ - **Install scripts:** a package that now runs code when it's installed, the most common route for npm malware.
44
+ - **A new publisher:** a release published by an account new to the package, or no longer through trusted publishing. That's what an account takeover looks like.
45
+ - **Lost provenance:** the release before had a provenance attestation, this one doesn't.
46
+ - **Fresh releases and packages:** a version published in the last few days, or a package that's only weeks old. Most malicious releases are caught and pulled within days.
47
+ - **Changed contents or sources:** the same version with a different hash, or a package suddenly coming from git, a URL or another registry.
48
+ - **Known vulnerabilities** in the new versions, from [OSV](https://osv.dev), and the ones an upgrade fixes.
49
+ - **Deprecations, yanks and licence changes**, including new copyleft terms.
50
+
51
+ It reads **npm, Yarn (classic and Berry), pnpm, uv, Poetry, Pipenv, Go modules and Cargo** lockfiles, and runs on every pull request as a single comment that updates in place.
52
+
53
+ Lockly has no runtime dependencies and needs Python 3.11 or later.
54
+
55
+ > Lockly is a sibling of [Vulnly](https://github.com/fullstackspectrum/Vulnly), [Sbomly](https://github.com/fullstackspectrum/sbomly) and [Basely](https://github.com/fullstackspectrum/basely), and part of [Full-Stack-Spectrum](https://fullstackspectrum.com/): small open-source tools that turn noisy supply chain data into decisions.
56
+
57
+ ![Terminal output from lockly diff](https://raw.githubusercontent.com/fullstackspectrum/lockly/main/docs/screenshots/terminal.png)
58
+
59
+ ## On every pull request
60
+
61
+ ```yaml
62
+ name: Lockfile review
63
+ on: pull_request
64
+
65
+ permissions:
66
+ contents: read
67
+ pull-requests: write # to post the comment
68
+
69
+ jobs:
70
+ lockly:
71
+ runs-on: ubuntu-latest
72
+ steps:
73
+ - uses: actions/checkout@v4
74
+ - uses: fullstackspectrum/lockly@v0
75
+ with:
76
+ fail-on: install-script,publisher,hash
77
+ ```
78
+
79
+ The Action compares the pull request with its base, posts the review as one comment, and edits that comment on every push instead of adding new ones. It also writes the review to the job summary. Pull requests from forks get a read-only token, so there the comment is skipped with a warning and the job summary still has everything.
80
+
81
+ | Input | Default | |
82
+ | --- | --- | --- |
83
+ | `fail-on` | | finding types that fail the check (see below) |
84
+ | `base` | the PR's base commit | git ref to compare against |
85
+ | `paths` | whole repository | space-separated paths to look for lockfiles in |
86
+ | `offline` | `false` | `true` skips registry and OSV lookups |
87
+ | `min-age` | `3` | flag versions published less than this many days ago |
88
+ | `comment` | `true` | post the PR comment |
89
+ | `html`, `markdown`, `json` | `lockly-*` | where to write the reports, e.g. for an artifact upload |
90
+
91
+ ## Install
92
+
93
+ ```bash
94
+ pipx install lockly # or: pip install lockly
95
+ brew install fullstackspectrum/lockly/lockly
96
+ ```
97
+
98
+ There's also a container image for comparing two lockfile files. It has no git, so for `--base` use pip, Homebrew or the Action:
99
+
100
+ ```bash
101
+ docker run --rm -t -v "$PWD:/data" fullstackspectrum/lockly diff old/package-lock.json package-lock.json
102
+ ```
103
+
104
+ ## Usage
105
+
106
+ Compare every lockfile changed on your branch:
107
+
108
+ ```bash
109
+ lockly diff --base origin/main
110
+ ```
111
+
112
+ Lockly compares against the merge base, as a pull request does, so changes that landed on `main` since you branched don't show up. Without `--head` it reads the working tree, including lockfiles you haven't committed yet.
113
+
114
+ Or compare two files:
115
+
116
+ ```bash
117
+ lockly diff old/uv.lock uv.lock
118
+ ```
119
+
120
+ Write reports, and gate CI:
121
+
122
+ ```bash
123
+ lockly diff --base main --markdown comment.md --html report.html --json review.json
124
+ lockly diff --base main --fail-on install-script,publisher,hash
125
+ ```
126
+
127
+ ![Lockly HTML report](https://raw.githubusercontent.com/fullstackspectrum/lockly/main/docs/screenshots/report.png)
128
+
129
+ ## Lockfiles
130
+
131
+ | File | Ecosystem | Notes |
132
+ | --- | --- | --- |
133
+ | `package-lock.json`, `npm-shrinkwrap.json` | npm | lockfile v1 to v3; records licences and install scripts |
134
+ | `yarn.lock` | npm | Yarn classic and Berry; reads `package.json` to tell direct dependencies |
135
+ | `pnpm-lock.yaml` | npm | pnpm 5.4 to 9 (pnpm 10's two-document files too) |
136
+ | `uv.lock` | PyPI | records upload times, so release age needs no lookup |
137
+ | `poetry.lock` | PyPI | reads `pyproject.toml` to tell direct dependencies |
138
+ | `Pipfile.lock` | PyPI | reads `Pipfile` to tell direct dependencies |
139
+ | `go.mod` | Go | Go's lockfile in effect since 1.17; reads `go.sum` for hashes and follows `replace` directives |
140
+ | `Cargo.lock` | crates.io | |
141
+
142
+ ## Findings
143
+
144
+ | Type | Flags | Needs lookups |
145
+ | --- | --- | --- |
146
+ | `hash` | same version, different contents (compared only within one hash algorithm) | |
147
+ | `install-script` | a package that runs a script at install time, new or newly | npm lockfiles record it; other npm formats look it up |
148
+ | `publisher` | a release by an account new to the package, or that left trusted publishing | npm, crates.io |
149
+ | `provenance` | the previous release had a provenance attestation; this one doesn't | npm |
150
+ | `source` | a package from git, a URL, a path or another registry, or a changed source | |
151
+ | `new-package` | an added package first published less than `--new-package-days` (30) ago | yes |
152
+ | `young` | a version published less than `--min-age` (3) days ago | yes, except uv |
153
+ | `vulnerable` | the new version has known vulnerabilities | OSV |
154
+ | `deprecated` | deprecated (npm) or yanked (PyPI, crates.io) | yes |
155
+ | `copyleft` | a licence that brings in copyleft terms | npm lockfiles have licences; others look them up |
156
+ | `license` | a licence changed between copyleft and permissive terms (other changes are shown as info) | as above |
157
+
158
+ Publisher findings compare a release with **the release just before it in the registry**, not with whatever version you were on. A maintainer of the previous release taking a turn isn't flagged; an account new to the package is. Moving to trusted publishing is shown as information, since it's an improvement.
159
+
160
+ `--fail-on` takes any of these, or `any`. Exit codes: `0` passed, `1` a `--fail-on` type was found, `2` bad usage, or a lockfile or git ref that can't be read.
161
+
162
+ ## Network use
163
+
164
+ **By default Lockly looks things up**: the npm registry, PyPI, crates.io, the Go module proxy and OSV, for the packages that changed and nothing else. Responses are cached for a day in `~/.cache/lockly` (or `$LOCKLY_CACHE_DIR`), each request gives up after 5 seconds without a response, and crates.io's limit of one request a second is respected. If a lookup fails, the review still runs and says what it couldn't check.
165
+
166
+ `--offline` (or `LOCKLY_OFFLINE=1`) makes no requests at all: you get the diff, hashes, install scripts and licences the lockfile records, sources, and uv's release dates. The HTML report itself never makes network requests.
167
+
168
+ ## Development
169
+
170
+ ```bash
171
+ uv venv -p 3.14 && uv pip install -e ".[dev]"
172
+ .venv/bin/python -m pytest -q # offline: no test reaches a registry
173
+ .venv/bin/python docs/screenshots/src/render.py # README screenshots (network, Chrome)
174
+ ./docs/brand/src/render.sh # README banner and social preview
175
+ ```
176
+
177
+ ## License
178
+
179
+ Apache-2.0. The embedded Space Grotesk and JetBrains Mono fonts are under the SIL Open Font License 1.1; their licence files are in `lockly/assets/`. The CVSS 4.0 scoring tables are from FIRST's reference calculator (BSD-2-Clause), credited in `lockly/cvss4_data.py`.
@@ -0,0 +1,30 @@
1
+ lockly/__init__.py,sha256=A6KrD1FW0XdWmtWifekQ5JujmsKjfFgNdN1ouU3vWQE,168
2
+ lockly/__main__.py,sha256=Cm3Kjsw_GCEDGrxutNkvAdMS6SDOfmCrdR5zl84b9bo,32
3
+ lockly/cli.py,sha256=BqJrcfUw5XbhjAk6yksjRmeQ8pMIrgVoK8eMb85BlqA,15293
4
+ lockly/cvss.py,sha256=x73BHP72LnIzGcJpS8hXzSYYn_SObBluASt9nYoaXnk,8456
5
+ lockly/cvss4_data.py,sha256=O2DkrkSHj_BS97qqKlNt55CdVJJwPCcM6p3P3ABlPss,6990
6
+ lockly/diff.py,sha256=IwiFds9_9l1YBRJu5kmQZ1gt9SaIDapWjOpt-vtavYA,14490
7
+ lockly/enrich.py,sha256=T2Dtt1VNNcKmYDUY4DLQ-7r7zzOyCvaADXVGj_E0TR0,15896
8
+ lockly/git.py,sha256=2FXLjxjcZtlkK6vTNvS7DVqudyaK-SEaSJj_OFfKyc8,3880
9
+ lockly/html.py,sha256=S7o_dTnfRVx7hbtpsFWd4lyTKp3OI5cM_FzwdkXoHxQ,7984
10
+ lockly/licenses.py,sha256=uxfJihBAB-rlNmxaxGnAb230A9w5-mxc932REOG5mDg,5300
11
+ lockly/miniyaml.py,sha256=SD22Qee7J_10qM9RwhHu43Ski7pYlObGlnwt5W-t4fI,5962
12
+ lockly/model.py,sha256=FOONfppdIPZpT59ozLUQcQk_GQtCBaWNeFHkFh9BTn8,1720
13
+ lockly/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
+ lockly/render.py,sha256=ilitp1C9k_BN4DNatdUf-6vROjwclR0QFecfnvSkm7s,10307
15
+ lockly/versions.py,sha256=4QtrNgaOUSpm5t5pFpC9Pcr1MPdjAOKqcxbkBIIDoyw,2125
16
+ lockly/assets/jetbrains-mono-LICENSE.txt,sha256=p2q_ACxJCX0UboZ0CjEFpdAEULFZLoIKEQmoxWgM1pc,4399
17
+ lockly/assets/jetbrains-mono-var.woff2,sha256=2BiGAIRvQQCsxycwwFdtirypeug3wtvxiDYt8vp4XYI,39912
18
+ lockly/assets/report.html,sha256=TEM1BulhrqyWOI0Y5kX5LUUVMB74bO7kc6FZF49OE2s,20850
19
+ lockly/assets/space-grotesk-LICENSE.txt,sha256=VkzlZcNxxeW78oYAZWWnyapVqfVufKWNVuBdZJ3WGnI,4495
20
+ lockly/assets/space-grotesk-var.woff2,sha256=fXBxcs6FbEzlQTuprbNUgxBqLxrZtP3ShfOxVAy09-Q,22284
21
+ lockly/parsers/__init__.py,sha256=_jP2KNnKZ8d55n1GAs1DYj0urEa6d2L_EzaxfkP80Zg,2805
22
+ lockly/parsers/native.py,sha256=jRkDNu0HK6IZLGN1d2lNJQpoVKYSHj7njp-4WkXwvyE,4821
23
+ lockly/parsers/npm.py,sha256=AeZHFP9wN8r3tF5ID4l6JzWe7lzJqkEWH5WGrR3vw-U,10728
24
+ lockly/parsers/python.py,sha256=ZS59Nh5reZ4uyEzwKpu8Qlyt1z2kGUgxh1TPSKbRbMs,7420
25
+ lockly-0.1.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
26
+ lockly-0.1.0.dist-info/METADATA,sha256=M4ULTo9cqiIBvq80i0HZvvOfPWENFAxv8ByUg761PGc,10202
27
+ lockly-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
28
+ lockly-0.1.0.dist-info/entry_points.txt,sha256=R82SiEbOrVCvuTYiTVa2AejR6U8FqulqzmjrwiUR3OQ,39
29
+ lockly-0.1.0.dist-info/top_level.txt,sha256=VWLN61WMDUO_jyYiw4pvvscgJ64sZiKGW97TDsG4pkE,7
30
+ lockly-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ lockly = lockly:main