$npx skillfedfor your agent

singleton-decorator

A testable singleton decorator

SkipPyPI TestingReleased Aug 2017542.0K downloads / moGPLv3Source build

Decision gist · record as of 2026-08-14

sdist only — singleton-decorator-1.0.0.tar.gz · builds from source
v1.0.0 · released 2017-08-10

No. The package is under GPLv3 copyleft, which restricts use in proprietary or permissively-licensed projects. More critically, it has been dormant since 2017 with no Python version specification and no updates for modern Python ecosystems. The core functionality is trivial to implement inline (a few lines of code), and the lack of maintenance creates compatibility and security uncertainty. Use only if you are in a GPLv3-compatible codebase and willing to accept the maintenance risk.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • High install friction and dormant maintenance: last release was 2017-08-10 with no updates since, though the repository remains active.
  • No runtime dependencies, but the package has not been maintained for years.

License · maintenance · safety

GPLv3 (copyleft) — Licensed under GPLv3 (copyleft). Any code that imports and uses this package must be distributed under a compatible copyleft license; proprietary or permissive-licensed projects cannot use it without legal review.

last release 2017-08-10 (3291 days) · last repo commit 2023-09-11 · 50 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 541,980 downloads/mo, #6,091 on PyPI

Verify before relying

from singleton_decorator import singleton

@singleton
class MyClass:
    def method(self):
        pass

obj = MyClass()  # creates instance
obj2 = MyClass()  # returns same instance

# In tests, access the class directly:
MyClass.__wrapped__.method(mock_self)
  • Whether the package works with modern Python versions (requires_python is unspecified)
  • Whether GPLv3 copyleft applies to derived works or only to modifications of the package itself
  • Whether the dormant status and lack of updates since 2017 poses compatibility risks with current Python ecosystems
Same gist for agents: .md · .json

What it is and what it does

singleton-decorator is a minimal Python decorator that enforces the singleton pattern—ensuring only one instance of a decorated class exists—while solving a key testing problem. Standard singleton decorators wrap a class in a function, making the class inaccessible for direct method calls in unit tests. This package instead uses a wrapper object that exposes the original class via `__wrapped__`, allowing tests to call class methods in isolation without instantiation.

The decorator is straightforward to use: apply `@singleton` to any class, then instantiate it normally. All calls return the same instance. For unit testing, access `ClassName.__wrapped__` to get the raw class and call its methods with mock objects as `self`, avoiding constructor side effects and test isolation problems.

Use it for

  • Enforce singleton pattern on configuration or service classes that should have exactly one instance across an application.
  • Unit test singleton-decorated classes by calling methods directly on `__wrapped__` with mock objects, avoiding constructor execution.
  • Ensure test isolation by accessing the underlying class without triggering singleton instance creation or initialization logic.
  • Replace hand-written singleton boilerplate with a simple decorator for cleaner, more readable class definitions.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Skip

No.

The package is under GPLv3 copyleft, which restricts use in proprietary or permissively-licensed projects. More critically, it has been dormant since 2017 with no Python version specification and no updates for modern Python ecosystems. The core functionality is trivial to implement inline (a few lines of code), and the lack of maintenance creates compatibility and security uncertainty. Use only if you are in a GPLv3-compatible codebase and willing to accept the maintenance risk.

Install

singleton-decorator on PyPI

Before you install

High install friction and dormant maintenance: last release was 2017-08-10 with no updates since, though the repository remains active. No runtime dependencies, but the package has not been maintained for years.

License in practice

Licensed under GPLv3 (copyleft). Any code that imports and uses this package must be distributed under a compatible copyleft license; proprietary or permissive-licensed projects cannot use it without legal review.

Quickstart

from singleton_decorator import singleton

@singleton
class MyClass:
    def method(self):
        pass

obj = MyClass()  # creates instance
obj2 = MyClass()  # returns same instance

# In tests, access the class directly:
MyClass.__wrapped__.method(mock_self)

Verify before relying

  • Whether the package works with modern Python versions (requires_python is unspecified)
  • Whether GPLv3 copyleft applies to derived works or only to modifications of the package itself
  • Whether the dormant status and lack of updates since 2017 poses compatibility risks with current Python ecosystems

Package facts

LicenseGPLv3 copyleft
Python supportNot specified
Install frictionHigh. Source build required
Runtime dependenciesNone
MaintenanceDormant 3,291 days since the last release
Last repo commit
First released
Downloads541,980 / month, #6,091 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14

Evidence: singleton-decorator-1.0.0.tar.gz

Tags

Capabilities
singleton decorator pythontestable singleton patternsingleton class decoratorunit test singletonsingleton with __wrapped__python singleton implementationdecorator pattern singleton
Topics
singleton-patterntesting-utilities
PyPI keywords
singletondecoratorunittest

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 › “singleton decorator python”

  • singleton-decoratorProvides a decorator that enforces singleton pattern on classes while…
  • solusProvides thread-safe and thread-unsafe singleton type decorators for…
  • montyMonty provides supplementary utility functions and design patterns…

Give your agent the search over MCP, or paste the wish link into any chat.

More Testing packages

pluggy Worth it
PyPI · Libraries · released May 2025

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.

MITpure Python · 3.9+aging
1.3Bdownloads / mo
pytest Worth it
PyPI · Libraries · released Jun 2026

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.

MITpure Python · 3.10+
1.1Bdownloads / mo
virtualenv Worth it
PyPI · Libraries · released Aug 2026

virtualenv creates isolated Python environments where packages can be installed independently without affecting the system Python or other projects.

MITpure Python · 3.9+
532.9Mdownloads / mo
coverage Worth it
PyPI · Testing · released Aug 2026

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.

permissive licensepure Python · 3.10+
335.8Mdownloads / mo
pytest-asyncio Worth it
PyPI · Testing · released May 2026

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.

Apache-2.0pure Python · 3.10+
275.9Mdownloads / mo
pytest-json-ctrf Worth it
PyPI · Testing · released Jul 2026

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.

MITpure Python · 3.8+
273.0Mdownloads / mo

See also monty · pyjon.utils · solus · wrapt · wirerope · undecorated · botoinator · simplegeneric · decopatch · tightwrap