A Python library for versatile and user-friendly data storage and management.
Project description
Crumbly
Introduction
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
Features
-
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.
Installation
To use the Crumbly Library, you can download it off of PyPI using pip install crumbly
Or,
Stable release
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.
Unstable release
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.
Importing
from crumbly import Crumb
Usage
Creating a Crumb
Object
To create a Crumb
object, you can initialize it with key-value pairs as arguments:
my_crumb = Crumb(name="Alice", age=30, city="Wonderland")
Accessing Values
Values stored in a Crumb
object can be accessed using attribute notation:
print(my_crumb.name) # Output: Alice
print(my_crumb.age) # Output: 30
Modifying and Deleting Values
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
Serialization
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)
Other Useful Methods
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
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.
License
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
Project details
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
File details
Details for the file crumbly-1.2.2.tar.gz
.
File metadata
- Download URL: crumbly-1.2.2.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e22e4b4363773b3ee7c9bb397bbd8ace92aefe35c3049c5764573618d592948 |
|
MD5 | bca98df287e6642385edb687c7fe89dd |
|
BLAKE2b-256 | 07b11621d6d017fd7aba4eacf035c1a576453445b8526721c6338d826286c2d8 |
File details
Details for the file crumbly-1.2.2-py3-none-any.whl
.
File metadata
- Download URL: crumbly-1.2.2-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5cd37b4b4d07a50b45a31f7a11f62556251182f704bab0dad515bc0b136a8f00 |
|
MD5 | 8b9c617b8067c0a8d79bbad849c273d9 |
|
BLAKE2b-256 | 57dbacd1a33a13eff51bcd4d284711138665bd1fda57f57fc60663db2dcaf208 |