Repository navigation
Releases
0.2.0
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 removedEngine.execute, andrequest.is_ajax()on arequest: HttpRequeston Django 4+. Return annotations are followed too:client.get(url).some_removed_method()with-> Response. isinstanceblocks. Insideif isinstance(con, Engine):,conis treated as anEngine.- Dynamic imports.
importlib.import_module("x")and pandas-styleimport_optional_dependency("x")are checked likeimport 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
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 asmodule '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.langchainis a separate distribution that isn't installed, not something another package removed.pipbreak --depsno 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
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 ahasattrearly exit, for the probed object only. - More names are found: namespaces filled at runtime (
torch.ops) and names a module's.pyideclares (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_flagsis 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
Fix found by running pipbreak on pretix:
- Methods from PyO3 extensions no longer lose an argument. pipbreak drops
selffrom a C method's signature before checking a call, but extensions built with PyO3 (css_inline'sCSSInliner.inline) already leaveselfout. pipbreak dropped the real first parameter and reportedinliner.inline(html)as one argument too many. It now drops the first parameter only when it is namedselforcls.
pip install -U pipbreak - the action picks this up through @v0.
0.1.6
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.modelswithout GDAL) fail to import outside the running app. pipbreak used to report them ashas no attribute; now it treats them as unknown. Errors that say a name was moved or removed (pydantic's "BaseSettingshas 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
Fixes found by running pipbreak --deps on Redash's locked environment:
- Namespace packages shared by several distributions (
zope.eventandzope.interfaceunderzope) 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
s2repozeplugins needrepoze.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
Fewer false positives, found by running pipbreak --deps on FlaskBB:
- Import fallbacks that set a name: Flask-Limiter sets
request_ctx = Noneinexcept ImportError:and only usesflask._request_ctx_stackunderif request_ctx is None:. Names assigned in an import fallback now count as version flags. - Changelog notes that aren't deprecations:
attr.scarries a.. deprecated::entry about comparing subclasses, not aboutattr.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
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
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,)orwerkzeug_major < 2now count as guards, likeif np_version >= ...already did. - Parameter deprecations: a deprecation note that names one of the function's parameters (attrs
define's hash, SQLAlchemyorm.join's "onclause") no longer marks the whole function deprecated. - Progress:
--depsshows 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
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