Type stubs for singleton_decorator
Project description
types-singleton-decorator
Type stubs for the singleton_decorator package to provide proper type hints and fix Pylance type checking issues.
Problem Solved
When using the singleton_decorator decorator, Pylance shows the error:
Expected class but received "_SingletonWrapper" PylancereportGeneralTypeIssues
This package provides proper type stubs to resolve this issue and ensure your IDE understands that decorated classes remain classes.
Installation
Install using pip:
pip install types-singleton-decorator
Or using uv:
uv add types-singleton-decorator
Usage
Once installed, the type stubs will automatically be picked up by your type checker (Pylance, mypy, etc.). No additional configuration is needed.
Your singleton decorators will now have proper type support:
from singleton_decorator import singleton
@singleton
class MyClass:
def __init__(self, value: str):
self.value = value
def get_value(self) -> str:
return self.value
# This will now have proper type hints
instance = MyClass("hello") # Type: MyClass, not _SingletonWrapper
print(instance.get_value()) # Pylance understands this method exists
What's Included
This package provides type stubs for:
@singletondecoratorSingletonMetametaclass (if used)- Proper preservation of class types and methods
Requirements
- Python >= 3.8
- The original
singleton_decoratorpackage
Contributing
Issues and pull requests are welcome at the GitHub repository.
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file types_singleton_decorator-0.1.0.tar.gz.
File metadata
- Download URL: types_singleton_decorator-0.1.0.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
187909facd76949d88711c3dc80a81170cca23a08adf943f99dba3839ce7f6a4
|
|
| MD5 |
cf22ea1dbe71d981f245de65cadc8355
|
|
| BLAKE2b-256 |
1d492f0a6d450cb7f881c8f1e1d7c4ee306e6100b1062200f65be11beb490218
|
File details
Details for the file types_singleton_decorator-0.1.0-py3-none-any.whl.
File metadata
- Download URL: types_singleton_decorator-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1cb2b28c22546871f0ec624fb13b168d8628460c1d5f37dde960b582a44016ff
|
|
| MD5 |
38eff2348235e7e40e6a6425e2eb4698
|
|
| BLAKE2b-256 |
4cf0d7048b34c88f59f622087f6d9edd47c95235136a4ae03dfbad361c6e335a
|