https://github.com/i80and/coding-challenge
https://github.com/i80and/coding-challenge
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/i80and/coding-challenge
- Owner: i80and
- Created: 2016-05-27T22:02:44.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-10-04T19:47:55.000Z (over 9 years ago)
- Last Synced: 2025-10-18T15:23:50.035Z (8 months ago)
- Language: Python
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
The Challenge
=============
Hopps is a simple document history-preserving key-value store built on
top of [MongoDB](https://www.mongodb.com) and
[Python](https://www.python.org).
Your task, should you chose to accept it, is to document the Hopps API
and structure.
Goals
=====
Fill in the file ``docs.txt`` with documentation covering ``hopps.py``.
Use your best judgment! It is deliberately vague and slim.
Setup
=====
To work with Hopps, you will need Python 3.4 or later. On OS X and
Windows, use the installer from
[Python.org](https://www.python.org/downloads/).
Next, you should set up a virtual environment. From within this
repository, run:
pyvenv venv
. venv/bin/activate
pip install tornado motor docopt typing
Ensure that you have MongoDB 3.2 or later installed from the
[MongoDB Download Center](https://www.mongodb.com/download-center).
Start a MongoDB instance:
mkdir data
mongod --dbpath=`pwd`/data --logpath mongod.log --fork
``sample.py`` demonstrates use of ``hopps.py``, and ``cli.py`` provides
a simple prompt interface for saving and retrieving documents.
Start Hopps:
./sample.py
And in a new terminal, run the following:
./cli.py
help
Usage
=====
Once you have started an instance and started the CLI tool, you can begin to
issue commands. For example, run the following command:
save foo '{"_id": "ff36cf3a-fd3b-431e-863e-5dc89d4f075e", "name": "Bob", "n": 42}'
This will save a document into the `foo` collection. Nothing will be printed
until you press return a second time.
To retrieve the document, run the following command and again press return:
get foo ff36cf3a-fd3b-431e-863e-5dc89d4f075e
Project Anatomy
===============
Hopps has the following dependencies:
* docopt: A command line option parsing library.
* tornado: A web server library.
* motor/pymongo: A pair of libraries for communicating with MongoDB.
You should not need to be closely familiar with any these libraries to complete
the challenge.
* docs.txt: Documentation. You'll be writing in here.
* hopps.py: The core Hopps library.
* sample.py: A sample consumer of the Hopps library implementing a server.
* cli.py: A command line interface that communicates with the server
started by sample.py.