Skip to content

Releases

0.2.0

Choose a tag to compare

@youssef-elaasri youssef-elaasri released this 13 Nov 21:18

Checks methods on values whose type the code declares:

  • Type hints and return annotations. def run(engine: Engine): engine.execute(...) is now reported on SQLAlchemy 2, which removed Engine.execute, and request.is_ajax() on a request: HttpRequest on Django 4+. Return annotations are followed too: client.get(url).some_removed_method() with -> Response.
  • isinstance blocks. Inside if isinstance(con, Engine):, con is treated as an Engine.
  • Dynamic imports. importlib.import_module("x") and pandas-style import_optional_dependency("x") are checked like import x.

These are warnings (new code API006), because a declared type may be a subclass with more methods. Only method calls are checked, not data attributes, since frameworks attach those to instances from outside the class (Django's request.user).

Also fixed: classes deriving from typing.Generic (SQLAlchemy's Engine, many modern libraries) were skipped by the missing-attribute checks on Python 3.12+, because Generic has no source to read.

No new noise on real environments: the 12-case benchmark gives the same verdicts as 0.1.9, and NetBox, CTFd, redash, FlaskBB, healthchecks, pretix and paperless-ngx give exactly the same results. About 5% slower.

pip install -U pipbreak - the action picks this up through @v0.

0.1.9

Choose a tag to compare

@youssef-elaasri youssef-elaasri released this 01 Nov 13:28

Fix found by testing a fresh install on Linux:

  • Same results on every OS. When several distributions share a namespace package (llama_index), pipbreak picked the owner in filesystem order, which differs across operating systems. On Linux that produced false errors such as module 'llama_index.llms.langchain' does not exist in llama-index-embeddings-openai-like. The owner is now chosen independently of that order.
  • An uninstalled piece of a namespace package counts as an optional extra. llama_index.llms.langchain is a separate distribution that isn't installed, not something another package removed. pipbreak --deps no longer reports it; checking your own code still tells you it isn't installed.

paperless-ngx went from 10 errors to 7 on Linux. Its Windows results, and those of CTFd, healthchecks, NetBox, redash and FlaskBB, are unchanged.

pip install -U pipbreak - the action picks this up through @v0.

0.1.8

Choose a tag to compare

@youssef-elaasri youssef-elaasri released this 01 Nov 13:28

Fixes found by running pipbreak on paperless-ngx, which went from 59 errors to 8 on Windows. It mostly cuts false positives on ML stacks (torch, transformers, llama-index):

  • More guards are recognised: is_*_available() checks, membership tests on API listings (if "_arg2scope" in cs_fields), and the fallback after a hasattr early exit, for the probed object only.
  • More names are found: namespaces filled at runtime (torch.ops) and names a module's .pyi declares (alembic.context.config).
  • Imports inside a function now bind only in that function.
  • No signature checks on placeholder methods (nn.Module.forward), compiled classes that report (self), or a model's own __init__(**data).
  • Fewer false deprecation warnings: notes about a behaviour rather than the API (sympy), and aliases made by wrapping the real function (torch.accelerator).
  • Speed: feature_flags is no longer quadratic on very large files.

CTFd, redash and NetBox are unchanged: their real findings are still reported.

pip install -U pipbreak - the action picks this up through @v0.

0.1.7

Choose a tag to compare

@youssef-elaasri youssef-elaasri released this 31 Oct 15:58

Fix found by running pipbreak on pretix:

  • Methods from PyO3 extensions no longer lose an argument. pipbreak drops self from a C method's signature before checking a call, but extensions built with PyO3 (css_inline's CSSInliner.inline) already leave self out. pipbreak dropped the real first parameter and reported inliner.inline(html) as one argument too many. It now drops the first parameter only when it is named self or cls.

pip install -U pipbreak - the action picks this up through @v0.

0.1.6

Choose a tag to compare

@youssef-elaasri youssef-elaasri released this 31 Oct 14:26

Fix found by running pipbreak on wastd, a Django app:

  • Imports that need setup no longer count as missing APIs. Django modules that need settings (django.contrib.auth.models, nested_admin) and submodules that need a system library (django.contrib.gis.db.models without GDAL) fail to import outside the running app. pipbreak used to report them as has no attribute; now it treats them as unknown. Errors that say a name was moved or removed (pydantic's "BaseSettings has been moved…") are still reported.

wastd went from 23 errors to 0. CTFd, Redash and FlaskBB are unchanged: the four real breaks are still found.

pip install -U pipbreak - the action picks this up through @v0.

pipbreak 0.1.5

Choose a tag to compare

@youssef-elaasri youssef-elaasri released this 31 Oct 11:53

Fixes found by running pipbreak --deps on Redash's locked environment:

  • Namespace packages shared by several distributions (zope.event and zope.interface under zope) are now told apart by their full dotted path - for labels, for which code counts as a package's own, and for --uses. Before, findings could name the wrong distribution, and calls between them could be missed.
  • Modules that need a missing optional extra can't be imported in that environment, so their other findings are dropped (pysaml2's s2repoze plugins need repoze.who).
  • Quiet output: warnings that packages emit while being inspected (cryptography's deprecations, SyntaxWarnings from old code) no longer clutter the output.

Redash now reports 2 errors, both real: pysaml2 7.5.5 requires pyopenssl>=26 but calls crypto.X509Req and crypto.load_certificate_request, which pyOpenSSL removed. CTFd, FlaskBB and healthchecks are unchanged.

pip install -U pipbreak - the action picks this up through @v0.

pipbreak 0.1.4

Choose a tag to compare

@youssef-elaasri youssef-elaasri released this 31 Oct 11:22

Fewer false positives, found by running pipbreak --deps on FlaskBB:

  • Import fallbacks that set a name: Flask-Limiter sets request_ctx = None in except ImportError: and only uses flask._request_ctx_stack under if request_ctx is None:. Names assigned in an import fallback now count as version flags.
  • Changelog notes that aren't deprecations: attr.s carries a .. deprecated:: entry about comparing subclasses, not about attr.s. A note now marks the object deprecated only if it says what to do instead (removed, instead, in favor of, legacy, ...) or contains only a version.

FlaskBB now checks with 0 errors and 11 real deprecations - including click-repl's use of click.MultiCommand (removed in Click 9) and WTForms-SQLAlchemy's DateTimeField (removed in WTForms 3.4). CTFd and healthchecks are unchanged.

pip install -U pipbreak - the action picks this up through @v0.

pipbreak 0.1.3

Choose a tag to compare

@youssef-elaasri youssef-elaasri released this 31 Oct 11:03

Removes a false positive almost every environment hit: cffi 2.1.1's _workaround_for_static_import_finders() imports pycparser.yacctab and pycparser.lextab (removed in pycparser 3) only so freezers like cx_Freeze can see them - it is never called. cffi comes with cryptography, so most pipbreak --deps runs showed these two errors.

Functions that only import things and that nothing in their module references (by name, attribute or __all__) are now treated as import hints and skipped. Found on healthchecks, which now checks clean: 1,566 files, 0 findings.

pip install -U pipbreak - the action picks this up through @v0.

pipbreak 0.1.2

Choose a tag to compare

@youssef-elaasri youssef-elaasri released this 31 Oct 10:34

Fewer false positives on real projects, found by running pipbreak --deps on CTFd's environment: it now reports only CTFd's 2 real breaks (Flask-Migrate 2.5.3 vs alembic 1.16, Flask-Script 2.0.6 vs Flask 2.1) and 5 real deprecations, down from 4 errors and 11 warnings.

  • Version checks written as _vers >= (2,) or werkzeug_major < 2 now count as guards, like if np_version >= ... already did.
  • Parameter deprecations: a deprecation note that names one of the function's parameters (attrs define's hash, SQLAlchemy orm.join's "onclause") no longer marks the whole function deprecated.
  • Progress: --deps shows which package it is checking when run in a terminal. A whole environment takes a minute or more and used to look frozen.

pip install -U pipbreak - the action picks this up through @v0.

pipbreak 0.1.1

Choose a tag to compare

@youssef-elaasri youssef-elaasri released this 30 Oct 20:00

Shortens the action's description to fit the GitHub Marketplace limit (under 125 characters). No change to the package itself - see 0.1.0 for what pipbreak does.

- uses: youssef-elaasri/pipbreak@v0