Skip to main content

Testing Pypi-Upload

Object Bucket

An easy and fun way to store python objects.


Table of contents


Description

Object Bucket is a python package that allows you to store python objects permanently in a more user friendly way.


Installation

The object-bucket package can be installed by using pip.

pip install object-bucket

Usage

  • Creating new bucket.

from object_bucket import Bucket

test_bucket = Bucket("name-of-the-bucket")
  • Adding droplets to the bucket, droplets are considered as objects that you want to save permanently.
test_obj = [1, 2, 3, 4]
test_bucket.add_droplet("droplet-name", test_obj)

Trying to add a droplet with the same name will cause an error.

  • Adding multiple droplets. To add multiple droplets you have to have a dictionary that contains all the names and objects of the droplet. To add the dictionary you can use the add_droplets method.
droplets = {
      "one": 1,
      "two": 2,
      "three": [2, 3, 4]
  }

  test_bucket.add_droplets(droplets)
  • Modifying a droplet

new_obj = {1: "a"}
test_bucket.modify_droplet("droplet-name", new_obj)

Trying to modify a droplet that does not exists will cause an error.

  • Saving a bucket

All the things mentioned above will not be added or saved permanently, to do so it is necessary to save the bucket.

test_bucket.save_bucket()
  • Retrieving values from a bucket.

from object_bucket import Bucket
test_bucket = Bucket("name-of-the-bucket")
a = test.bucker.get_droplet("droplet-name")
print(a)  # {1: "a"}

Trying to get a droplet that does not exists will cause an error.

  • Get all the runtime droplets
drop1 = [1, 2, 3, 4]
drop2 = "Hello"
drop3 = {1: "a", 2: "b"}
test_bucket.add_droplet("drop1", drop1)
test_bucket.add_droplet("drop2", drop2)
test_bucket.add_droplet("drop3", drop3)

# to get all the droplets
a = test_bucket.get_all_droplets()
print(a)

# output
{"drop1": [1, 2, 3, 4], "drop2": "Hello", "drop3": {1: "a", 2: "b"}}
  • Deleting a bucket To delete the bucket and to clear the runtime storage of all the droplets.
test_bucket.delete_bucket()
  • You can also delete a bucket using remove_bucket function
from object_bucket import remove_bucket
remove_bucket("name-of_bucket_to_be_removed")

Using the context manager.

It might be a hastle to remember to save to bucket, so you can use the context manager to avoid using the save_bucket method.

Note: Using Bucket().delete_bucket inside the context manager is useless as at the end the file will be saved automatically.

from object_bucket import Bucket

with Bucket("name-of-the-bucket") as b:
  # code to execute
  b.add_droplet("name", 1)
  # ...etc
  b.delete_bucket()  # wont work as the file will be again saved,
  # but the runtime contents will be cleared

Some more stuff

  • You can use the if statement to check whether a bucket is empty or not
from object_bucket import Bucket
t = Bucket("name")
if t:
  print("Hello")  # -> does not print anything as bucket is empty

t.add_droplet("demo", 1)
if t:
  print("Hello 2")  # -> prints "hello 2" as the bucket has at least one droplet
  • To get the number of droplets in a bucket you can use the len method
from object_bucket import Bucket
t = Bucket("name")
print(len(t)) # -> 0
t.add_droplet("demo", [1, 2, 3])
print(len(t)) # -> 1

Metadata

Release files for object-bucket 1.6.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for object-bucket 1.6.1
File Size Uploaded Provenance
object-bucket-1.6.1.tar.gz 6.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for object-bucket 1.6.1
File Interpreter ABI Platform
object_bucket-1.6.1-py3-none-any.whl Python 3 none any Details

Total release size: 12.2 kB

Release files / object-bucket-1.6.1.tar.gz

Download URL object-bucket-1.6.1.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e2b6c680e3619eb0588e634735c69675ab12e725b3a4bf086f8ef11b0a1390f0
BLAKE2b-256 checksum
How to use checksums
2b04abba1bc8a2d5e6c6dda4dd9846a2633eabd40245349720b8306143be3d22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

Release files / object_bucket-1.6.1-py3-none-any.whl

Download URL object_bucket-1.6.1-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0a6fb4b4a400d6623a7fc118375d7bbec4c4c96c8963cb557eec73928955fdfb
BLAKE2b-256 checksum
How to use checksums
40451ef1bfada5b15bffa16a50e508196a63f5a65ed1bcd401088fe3d63401fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

Security for object-bucket 1.6.1

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page