• Stars
    star
    234
  • Rank 171,630 (Top 4 %)
  • Language
    Python
  • License
    BSD 2-Clause "Sim...
  • Created almost 11 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Python implementation of MimicDB

MimicDB

PyPI Build Status Coverage Status

Python Implementation of MimicDB

The Python implementation of MimicDB works with the Boto library and several different backends including Redis.

Installation

By default, MimicDB requires Redis (although other backends can be used instead).

$ pip install boto
$ pip install redis
$ pip install mimicdb

Quickstart

If you're using Boto already, replace boto imports with mimicdb imports.

Change:

from boto.s3.connection import S3Connection
from boto.s3.key import Key

To:

from mimicdb.s3.connection import S3Connection
from mimicdb.s3.key import Key

Additionally, import the MimicDB object itself, and initiate the backend:

from mimicdb import MimicDB
MimicDB()

After establishing a connection for the first time, sync the connection to save the metadata locally:

conn = S3Connection(KEY, SECRET)
conn.sync()

Or sync only a couple buckets from the connection:

conn.sync('bucket1', 'bucket2')

After that, upload, download and list as you usually would. API calls that can be responded to locally will return instantly without hitting S3 servers. API calls that are made to S3 using MimicDB will be mimicked locally to ensure consistency with the remote servers.

Pass force=True to most functions to force a call to the S3 API. This also updates the local database.

Alternate Backends

Besides the default Redis backend, MimicDB has SQLite and in-memory backends available.

from mimicdb.backends.sqlite import SQLite
MimicDB(SQLite())
from mimicdb.backends.memory import Memory
MimicDB(Memory())

Documentation

mimicdb.readthedocs.org

Contributing

  1. Fork the repo.
  2. Run tests to ensure a clean, working slate.
  3. Improve/fix the code.
  4. Add test cases if new functionality introduced or bug fixed (100% test coverage).
  5. Ensure tests pass.
  6. Push to your fork and submit a pull request to the develop branch.

Tests

Run tests after installing nose and coverage.

$ nosetests --with-coverage --cover-package=mimicdb

Integration testing is provided by Travis-CI at travis-ci.org/nathancahill/mimicdb

Test coverage reporting is provided by Coveralls at coveralls.io/r/nathancahill/mimicdb

Benchmarks

Run benchmarks.py in the root of the repo:

$ python benchmarks.py
Boto Time: 0.338411092758
MimicDB Time: 0.00015789039612
Factor: 2143x faster

License

MimicDB is BSD licensed.

More Repositories

1

split

Unopinionated utilities for resizeable split views
JavaScript
6,091
star
2

Anycomplete

The magic of Google Autocomplete while you're typing. Anywhere.
Lua
1,539
star
3

sveltik

Powerful forms in Svelte, inspired by Formik.
JavaScript
192
star
4

dainte

Painless testing for Svelte components
JavaScript
102
star
5

table-edits

A lightweight jQuery plugin for making table rows editable
JavaScript
59
star
6

Flask-Edits

Editable Content in Flask
CSS
54
star
7

flask-inputs

Incoming request data validation
Python
53
star
8

CleanMaps

Cleaner Google Maps
JavaScript
52
star
9

skeleton-tabs

Tab navigation for Skeleton
HTML
31
star
10

pipeup

Unix Pipes to the Web
HTML
24
star
11

snippets

Python
22
star
12

ImageJS

Simple library for loading images in Javascript
JavaScript
17
star
13

rollup-plugin-collect-sass

Collect Sass, then compile
JavaScript
16
star
14

prioritize-url

Prioritize URLs in Firefox autocomplete dropdown
CSS
15
star
15

aws-serverless-micro

Deploy Micro functions on AWS Lambda
JavaScript
13
star
16

skeleton-alerts

Alerts for Skeleton
CSS
12
star
17

github-time-travel

Easily browse commit history on Github
JavaScript
11
star
18

gittip-button

Gittip Button for Github
JavaScript
11
star
19

video-freqtimeupdate

Frequent Time Update for HTML5 video elements
JavaScript
8
star
20

Flask-Logging

Filter requests from Flask logs
Python
8
star
21

tile-proxy-bing

Cloudflare Worker proxy for consuming Bing Maps tiles as slippy tiles.
JavaScript
8
star
22

docker-firefox-headless

JavaScript
7
star
23

eminent

A DOM assertions library with Emmet syntax for JavaScript testing
JavaScript
6
star
24

flask-oauth-example

Barebones example of integrating an OAuth login system with a Flask app
Python
6
star
25

skeleton-fontawesome-buttons

Font Awesome icon buttons for Skeleton
CSS
6
star
26

fuck-w3schools

Fuck W3Schools
HTML
5
star
27

werkzeug-raw

Werkzeug meets Raw HTTP
Python
5
star
28

pikaday-skeleton

The refreshing JavaScript Datepicker, styled for Skeleton
CSS
5
star
29

applescripts

Objective-C
4
star
30

python-growl

Improved Python implementation of the Growl (GNTP) protocol.
Python
4
star
31

gif2fb

Post gifs to Facebook
Python
4
star
32

shp-postgis-schema

Creates a Postgres table from an shapefile
Python
3
star
33

clearbit-intercom

Clearbit - Intercom.io Integration
Python
3
star
34

Pikaday2

A refreshing JavaScript Datepicker — lightweight, no dependencies, modular CSS
JavaScript
2
star
35

reply-now

Change Gmail timestamps to display relative times.
JavaScript
2
star
36

wkb-raster

Read WKB rasters to Numpy
Python
2
star
37

duo-cli

Python
2
star
38

wkb

Read WKB rasters to Go data structures
Go
2
star
39

rollup-multiple

Obsolute, merged to Rollup core
JavaScript
2
star
40

splitjs-bower

Bower repo for backwards compatibility
JavaScript
1
star
41

vercel-sns-integration

Subscribe Vercel deployments to AWS SNS
Svelte
1
star
42

nathancahill.github.com

JavaScript
1
star
43

create-rollup-app

Create Rollup React apps with no build configuration.
1
star
44

now-postgrest

Deploy PostgREST to Now
TypeScript
1
star
45

dotfiles

...
Shell
1
star
46

stackoverflow-header

Brings back the gray header bar in StackOverflow
CSS
1
star
47

test

HTML
1
star
48

scripts

Perl
1
star
49

pipeup-hosted

JavaScript
1
star