Skip to main content

Databases should be Effortless.

Project description

Databases should be Effortless.

Publish Package Run Tests

Effortless has one objective: be the easiest database. It's perfect for beginners, but effortless for anyone.

Quickstart

You can install Effortless easily, if you have pip and Python 3.9 or higher installed.

pip install effortless

Usage

We offer 3 tiers of effort when using our databases. If this is your first time using a database, try out the Effortless usage below. If you are working on a simple project, you should take a look at the Basic usage docs. Overachievers may want to try our Advanced features.

Effortless Usage

from effortless import db

# Add items to the database
db.add({"name": "Alice", "age": 30})
db.add({"name": "Bob", "age": 25})

# Search for items
result = db.search({"name": "Alice"})
print(result)  # Output: {'1': {'name': 'Alice', 'age': 30}}

# Get all items
all_items = db.get_all()
print(all_items)
# Output: {'1': {'name': 'Alice', 'age': 30}, '2': {'name': 'Bob', 'age': 25}}

# Wipe the database
db.wipe()
print(db.get_all())  # Output: {}

Basic Usage

from effortless import EffortlessDB

# Create a new Effortless instance
db = EffortlessDB()

# Add items to the database
db.add({"name": "Charlie", "age": 35})
db.add({"name": "David", "age": 28})

# Search for items
result = db.search({"age": 28})
print(result)  # Output: {'2': {'name': 'David', 'age': 28}}

# Get all items
all_items = db.get_all()
print(all_items)
# Output: {'1': {'name': 'Charlie', 'age': 35}, '2': {'name': 'David', 'age': 28}}

Advanced Usage

from effortless import EffortlessDB, EffortlessConfig

# Create a new Effortless instance with a custom directory
db = EffortlessDB("advanced_db")
db.set_directory("/path/to/custom/directory")

# Add multiple items
db.add({"id": 1, "name": "Eve", "skills": ["Python", "JavaScript"]})
db.add({"id": 2, "name": "Frank", "skills": ["Java", "C++"]})
db.add({"id": 3, "name": "Grace", "skills": ["Python", "Ruby"]})

# Complex search
python_devs = db.search({"skills": "Python"})
print(python_devs)
# Output: {'1': {'id': 1, 'name': 'Eve', 'skills': ['Python', 'JavaScript']},
#          '3': {'id': 3, 'name': 'Grace', 'skills': ['Python', 'Ruby']}}

# Update configuration
new_config = EffortlessConfig()
new_config.readonly = True
db.configure(new_config)

# Test this configuration
db.add({})
# Output: ValueError: Database is in read-only mode

# Wipe the database
db.wipe(wipe_readonly=True)
print(db.get_all())  # Output: {}

Why Effortless?

Not only is storing, retrieving, and managing data is as simple is it can be, Effortless is also:

  • Everywhere

    Effortless DBs work on any device supporting Python and DBs can be copied across devices.

  • Safe

    All DB data is safe, lossless, local, and recoverable by default.

  • Scaling

    Our DBs have deep code support for batch functions.

  • Clear

    We take pride in our documentation, so that learning takes minimal effort.

  • Broad

    All that's required to use Effortless is Python >= 3.9.

  • Compact

    Our code is compact, both in package size, dependencies, and db size.

Lines of Code Package Size Dependencies


Contributing

Writing code takes a lot of effort! Check out CONTRIBUTING for information.

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

effortless-1.0.0.tar.gz (9.1 kB view hashes)

Uploaded Source

Built Distribution

Effortless-1.0.0-py3-none-any.whl (11.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page