stubs
Tools for setting up stubs and mocks.
Decision gist · record as of 2026-08-14
No. While the package is permissively licensed and has zero dependencies, it has been abandoned for over 3574 days with no updates since 2016-10-31. Unless you are maintaining legacy code that already uses stubs, you should choose a currently maintained alternative for new projects.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Package targets Python 3.4 and 3.5; compatibility with modern Python versions is unverified.
- Installation is frictionless with no runtime dependencies.
- However, the package has been abandoned since its only release on 2016-10-31 and has not been updated in over 3574 days, raising concerns about compatibility with modern Python versions.
License · maintenance · safety
Apache 2.0 (permissive) — Licensed under Apache 2.0 (permissive), so you can use, modify, and distribute the package freely in most contexts without restriction.
last release 2016-10-31 (3574 days) · last repo commit 2016-11-17 · 1 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 92,504 downloads/mo, #13,448 on PyPI
Alternatives
Verify before relying
pip install stubs
from stubs import stub
def f(x):
return x * 2
with stub[f](_ >= 3) >> 5:
print(f(3)) # prints 5- Whether the package actually works with Python versions beyond 3.5 given its age and lack of updates
- Whether the matcher syntax and context-manager API remain compatible with current testing frameworks
- Real-world usage patterns and whether this approach is still considered idiomatic in modern Python testing
What it is and what it does
stubs is a lightweight testing utility that lets you temporarily replace a function's behavior using a context manager and matcher expressions. You define conditions (like `_ >= 3`) and specify what the function should return when those conditions are met, then wrap your test code in a `with` block that automatically reverts the stub when done.
The package was designed for Python 3.4 and Python 3.5 and has not been maintained since its initial release in 2016-10-31. It has no external runtime dependencies, making installation trivial, but its age means you should verify compatibility with your current Python version before relying on it.
Use it for
- Isolate a function's behavior in unit tests by returning fixed values when specific argument patterns match
- Test code paths that depend on a function's return value without modifying the function itself
- Verify that your code handles different function outputs correctly by stubbing responses for different input conditions
- Temporarily replace functions during test runs without setting up a full mocking framework
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
No.
While the package is permissively licensed and has zero dependencies, it has been abandoned for over 3574 days with no updates since 2016-10-31. Unless you are maintaining legacy code that already uses stubs, you should choose a currently maintained alternative for new projects.
Install
stubs on PyPI
Before you install
Installation is frictionless with no runtime dependencies. However, the package has been abandoned since its only release on 2016-10-31 and has not been updated in over 3574 days, raising concerns about compatibility with modern Python versions.
Package targets Python 3.4 and 3.5; compatibility with modern Python versions is unverified.
License in practice
Licensed under Apache 2.0 (permissive), so you can use, modify, and distribute the package freely in most contexts without restriction.
Quickstart
pip install stubs
from stubs import stub
def f(x):
return x * 2
with stub[f](_ >= 3) >> 5:
print(f(3)) # prints 5
Verify before relying
- Whether the package actually works with Python versions beyond 3.5 given its age and lack of updates
- Whether the matcher syntax and context-manager API remain compatible with current testing frameworks
- Real-world usage patterns and whether this approach is still considered idiomatic in modern Python testing
Package facts
| License | Apache 2.0 permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Abandoned 3,574 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 92,504 / month, #13,448 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5 |
Evidence: stubs-1.0.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “function stubbing context manager”
- stubsProvides a context-manager syntax for temporarily replacing function…
- pookpook intercepts and mocks HTTP traffic for testing, supporting…
- mockitoMockito is a spying and stubbing framework for Python that lets you…
Give your agent the search over MCP, or paste the wish link into any chat.
More Testing packages
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
virtualenv creates isolated Python environments where packages can be installed independently without affecting the system Python or other projects.
Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.
Install it if you want to measure test completeness or enforce coverage thresholds in your project.
pytest-asyncio is a pytest plugin that enables writing and running async test functions using the asyncio library, allowing developers to await code directly within test cases.
Install it if you write tests for any asyncio-based code.
A pytest plugin that generates test reports in Common Test Report Format (CTRF) as JSON, compatible with pytest-xdist and pytest-playwright for distributed and browser-based testing.
Install it if you need CTRF-formatted test output for CI/CD integration or cross-tool reporting.
See also pretend · pytest-stub · mockito · flexmock · pytest-mock · tempenv · requests-mock · types-mock · django-mock-queries · flake8-mock-spec