Crumbly Library is a Python library designed to provide a versatile and user-friendly way of storing and managing multiple variables within a single object. This library offers the Crumb
class, which acts as a container for various key-value pairs, akin to a dictionary. The library aims to simplify the management of data and provide easy-to-use methods for manipulation, conversion, and serialization.
Oh yeah also this was the first name that came to mind, and it kinda.... sucks. Can't think of a better one tho
-
Flexible Storage:
Crumb
objects allow you to store multiple variables using key-value pairs, similar to a dictionary, providing a convenient way to organize related data. -
Easy Access: With intuitive methods such as
__getattr__
, accessing values stored in aCrumb
is seamless, reducing the need for verbose code. -
Dynamic Attributes: Accessing attributes of a
Crumb
object is done by simply using attribute notation, making the code more readable and concise. -
Dynamic Modification: The library provides methods for adding, modifying, and deleting key-value pairs within the
Crumb
object, allowing for dynamic data manipulation. -
Serialization:
Crumb
objects can be converted into JSON format using themakeJSON
method, and vice versa using thecrumbFromJSON
class method, facilitating data serialization and deserialization. -
Convenience Methods: The library includes various convenient methods for retrieving keys, values, items, copying, checking for key existence, and more.
To use the Crumbly Library, you can download it off of PyPI using pip install crumbly
Or,
Download the provided ZIP file in the Releases page (crumbly_vXXXX_XX_XX.zip
) and include the crumbly.py
file from inside the ZIP in your project directory. Then, simply import the Crumb
class into your Python code.
Download crumbly.py
from the Code section of this page, and include it in your project directory. Then, simply import the Crumb
class into your Python code.
from crumbly import Crumb
To create a Crumb
object, you can initialize it with key-value pairs as arguments:
my_crumb = Crumb(name="Alice", age=30, city="Wonderland")
Values stored in a Crumb
object can be accessed using attribute notation:
print(my_crumb.name) # Output: Alice
print(my_crumb.age) # Output: 30
You can modify existing values or add new key-value pairs using the addData
method:
my_crumb.addData("job", "Adventurer")
my_crumb.age = 31
To delete a key-value pair:
del my_crumb.city
You can convert a Crumb
object into a JSON string using the makeJSON
method:
json_data = my_crumb.makeJSON()
And deserialize a JSON string back into a Crumb
object using the crumbFromJSON
class method:
restored_crumb = Crumb.crumbFromJSON(json_data)
len(my_crumb)
: Get the number of key-value pairs in theCrumb
object.my_crumb.keys()
: Get a list of keys in theCrumb
object.my_crumb.values()
: Get a list of values in theCrumb
object.my_crumb.items()
: Get a list of key-value tuples in theCrumb
object.my_crumb.copy()
: Create a copy of theCrumb
object.my_crumb.has_key("name")
: Check if a key exists in theCrumb
object.my_crumb.clear()
: Remove all key-value pairs from theCrumb
object.
Contributions to the Crumbly Library are welcome! If you find any issues or have suggestions for improvements, feel free to submit a pull request or open an issue on the GitHub repository.
This library is provided under the MIT License. See the LICENSE file for more details.
Disclaimer: The "Crumbly Library" is intended for educational and experimental purposes and might not be suitable for production use. Use it at your own discretion.
No, YOU used ChatGPT to make this readme
I did change the installation part from the generated version quite a bit though