KwargsMeta
KwargsMeta is a Python package that provides a metaclass to automatically handle keyword arguments (kwargs) from methods. This metaclass allows you to set values of keyword arguments from methods in the __init__ method without explicitly specifying them, making your code cleaner and more maintainable.
Features
- Automatically injects keyword arguments into the
__init__method. - Simplifies the initialization of classes with many keyword arguments.
- Reduces boilerplate code.
- Allows to set keyword arguments from methods in the
__init__method.
Installation
You can install KwargsMeta using pip:
pip install likiskwargsmeta
Usage
Here is an example of how to use KwargsMeta:
from likiskwargsmeta import KwargsMeta
class MyClass(metaclass = KwargsMeta):
def __init__(self, a, b = 12):
self.a = a
self.b = b
def method1(self, b = 3, c = 12):
print(f"{b = }, {c = }")
MyClass(1).method1() # will print b = 12, c = 12
MyClass(12, b = 3).method1(c = 1) # will print b = 3, c = 1
MyClass(1, b = None).method1() # will print b = 3, c = 12
License
This project is licensed under the MIT License. See the LICENSE file for details.
Contributing
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
Metadata
Release files for likiskwargsmeta 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| likiskwargsmeta-0.1.0.tar.gz | 3.7 kB | Without provenance | Details for likiskwargsmeta-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| likiskwargsmeta-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for likiskwargsmeta-0.1.0-py3-none-any.whl |
Total release size: 8.0 kB
Release files / likiskwargsmeta-0.1.0.tar.gz
| Download URL | likiskwargsmeta-0.1.0.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eeba9b9f874fecea8e1421a0fcbad4c30a47b17a7ac9dc0c4624b582be0ca33f
|
|
BLAKE2b-256 checksum How to use checksums |
d79d1b9ce7a1f86f285d1dc107eb1247ccc03d9deaa1e3922489c595a3d72995
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.9
|
Release files / likiskwargsmeta-0.1.0-py3-none-any.whl
| Download URL | likiskwargsmeta-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c8a44d0526aec37944e930f0e5a6c0f518e3822fff1fc6c685b391af05c0252b
|
|
BLAKE2b-256 checksum How to use checksums |
13daba0185262aaa9e6fb37e816c4f3a7236e00d265ff932f5324b9d5bfabc38
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.9
|
Security for likiskwargsmeta 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.