Skip to main content

SKY-SCA-API001 · Supply chain and agent configuration

Your line uses API a dependency upgrade removed

Medium

A pull request changes a locked Python version, and a line of your code uses a public name, module, method or keyword argument that exists in the old release and not in the new one. For example, MarkupSafe 2.1.0 removed soft_unicode, so a pull request that only bumps the pin can break a file it never touched.

Languages
Python lockfiles, requirements*.txt pins
Turned on by
skylos . --sca --review-upgrades --diff origin/main on a pull request; the workflow skylos setup writes turns this on
Quality gate
Full scan: not checked. Diff scan: listed, not counted by the gate. Advice only: neither the built-in gate nor a Skylos Cloud gate counts it, and it is not uploaded to Cloud.
Finding type
review
Wrong result? Report itA false positive, a missed case or a confusing message: it goes privately to the founder.

Why it matters

Python has no compile step, so CI only catches a removed API if a test happens to run that line. Teams often leave dependency pull requests open because they can't tell which ones are safe to merge. This names the lines to read.

What Skylos flags

A change: the first version of these files is committed, then the edit below is made without committing, and Skylos reviews it as a diff scan (--diff).

requirements.txt · Text · changed
Removed: markupsafe==2.0.1Added: markupsafe==2.1.0
app.py · Python · changed
import markupsafe as ms print(ms.soft_unicode("x"))

What Skylos leaves alone

A change: the first version of these files is committed, then the edit below is made without committing, and Skylos reviews it as a diff scan (--diff).

requirements.txt · Text · changed
Removed: markupsafe==2.0.1Added: markupsafe==2.1.0
app.py · Python · changed
from markupsafe import escape print(escape("x"))

Why Skylos leaves it alone

escape exists in both releases.

How Skylos decides

  1. For each changed version in a lockfile or a requirements*.txt == pin, it downloads both releases through ca9.artifacts and reads them with ast. It never installs, imports or runs them, because the new release is untrusted.
  2. It builds each release's public surface: modules, names, classes, methods and parameters, following __all__, re-exports and star imports. Names starting with an underscore are not public.
  3. It finds where your code uses the package, following import aliases, from imports, attribute access and keyword arguments. A local function or variable with the same name doesn't count.
  4. Anything it cannot read says "could not check" instead of reporting a clean result: names behind a module __getattr__, a computed __all__, compiled modules with no .pyi, and failed downloads.
  5. The pull request comment says either "Review these N call sites" or "No API-level impact found in N call sites (behaviour changes not checked)". It never says an upgrade is safe.

How to fix it

Move to what the release notes name as the replacement, or stay on the old version until you can.

app.py · Python · the fix, against the flagged file
Removed: import markupsafe as msAdded: from markupsafe import soft_str Removed: print(ms.soft_unicode("x"))Added: print(soft_str("x"))

When it can be wrong

  • It searches the whole repository, so a monorepo with two services on different versions can name a line in the other service.
  • "N call sites" counts references, including import lines, not only calls.
  • It does not see behaviour changes, changed defaults or return types, positional argument shifts, newly required parameters, methods reached through self.x or a return value, or string references such as Django settings.
  • If the old and new signatures both pass a keyword through **kwargs and it can't be followed, the site counts as compared. The receipt's keywords_not_followed count shows how many.
  • Only Python is compared. npm bumps say so.

Seeing a case that isn't listed here? Report the wrong result so the rule can be fixed. Don't paste company code: describe the shape of it.

How to silence it

  • On the line, with the reason. It hides that line only, and each line that uses the name is reported separately:

    Python
    print(ms.soft_unicode("x"))  # skylos: ignore[SKY-SCA-API001] migrating
  • [tool.skylos] ignore = ["SKY-SCA-API001"] turns the rule off for the project.

From the Skylos rule handbook, Skylos 5.8.0 (commit 5b880b0). All rules.