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 no pypi. gh actions is being really stupid and I don't know why it's not working. please, PLEASE dm me on discord at @noodledx if you know whypip install crumbly
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-0.1.tar.gz
.
File metadata
- Download URL: crumbly-0.1.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f70626625bacb552078d347195c5eb632f00d66a9f694c421580d28a8387acf9 |
|
MD5 | 47c9970b8ee84137f963ea4f57416bb5 |
|
BLAKE2b-256 | c6f685474f66697f192d20b8a2ead59316e9201830515b0b07ee19e24097b497 |
File details
Details for the file crumbly-0.1-py3-none-any.whl
.
File metadata
- Download URL: crumbly-0.1-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7051ce02c4b7ab5c5289897870f716a3979023de7c240ccb4613bda2cf5da93e |
|
MD5 | a195bee9c84b7a0a124ac6b976955ca0 |
|
BLAKE2b-256 | dfbab4a8780502f3ffca2c407d2ec2e2ca14c82e47c903d18a2eedb0f5b988ae |