Skip to content

snakazawa/RDM-waterbutler

 
 

Repository files navigation

WaterButler

Documentation Status Code Climate Coverage Status

master Build Status: Build Status

develop Build Status: Build Status

Compatibility

WaterButler is compatible with Python 3.5 (tested up to 3.5.3) and 3.6.

Documentation

Documentation available at https://waterbutler.readthedocs.io/en/latest/

Setting up

In order to run WaterButler, you must create a Python 3.5-based virtualenv for it.

For MacOSX, you can install the latest version of Python3 using:

brew install python3

For Ubuntu users:

apt-get install python3.5

After completing the installation of Python 3.5, you must create a virtual environment. This can be done with the following commands:

pip install virtualenv
pip install virtualenvwrapper
mkvirtualenv --python=python3.5 waterbutler

pip install setuptools=37.0.0
pip install invoke==0.13.0

invoke install
invoke server

The above code will get the virtualenv up and running for the first time. After the initial setup, you can run waterbutler by running:

workon waterbutler
invoke server

Some tasks also require a running celery worker. You will need to install rabbitmq and run a server:

brew install rabbitmq
# on Ubuntu:
# apt-get install rabbitmq-server
rabbitmq-server

Then in your WaterButler virtualenv:

invoke celery

Configuring

WaterButler configuration is done through a JSON file (waterbutler-test.json) that lives in the .cos directory of your home directory. If this is your first time setting up WaterButler or its sister project, MFR, you probably do not have this directory and will need to create it:

mkdir ~/.cos

A minimal config file would be:

{
  "SERVER_CONFIG": {
    "DEBUG": false
  }
}

That flag is necessary because Python 3.5's asyncio has a bug that is triggered by turning on debugging in Tornado. If you are upgrading from the 3.4-based WaterButler, change that setting in your waterbutler-test.json. If you do not, you will encounter this error:

TypeError: throw() takes 2 positional arguments but 4 were given

The data in waterbutler-test.json is used by the many Django-style settings.py files sprinkled about. Most of these files define a top-level key that its specific configuration should be listed under. For instance, if you wanted your local WaterButler server to listen on port 8989 instead of the default 7777, you would check the settings file for waterbutler.server. That file looks for HOST and DOMAIN configuration keys under the SERVER_CONFIG top-level key. Your configuration file would need to be updated to look like this:

{
  "SERVER_CONFIG": {
    "PORT": 8989,
    "DOMAIN": "http://localhost:8989",
    "DEBUG": false
  }
}

If you then wanted to update the GitHub commit message WaterButler submits when deleting files, you would look in waterbutler.providers.github.settings. The DELETE_FILE_MESSAGE parameter should come under the GITHUB_PROVIDER_CONFIG key:

{
  "SERVER_CONFIG": {
    "PORT": 8989,
    "DOMAIN": "http://localhost:8989",
    "DEBUG": false
  },
  "GITHUB_PROVIDER_CONFIG": {
    "DELETE_FILE_MESSAGE": "WaterButler deleted this. You're welcome."
  }
}

Testing

Before running the tests, you will need to install some additional requirements. In your checkout, run:

workon waterbutler
invoke install --develop
invoke test

Known issues

  • Updated, 2018-01-02: WB has been updated to work with setuptools==37.0.0, as of WB release v0.37. The following issue should not happen for new installs, but may occur if you downgrade to an older version. Running invoke install -d with setuptools v31 or greater can break WaterButler. The symptom error message is: "AttributeError: module 'waterbutler' has no attribute '__version__'". If you encounter this, you will need to remove the file waterbutler-nspkg.pth from your virtualenv directory, run pip install setuptools==30.4.0, then re-run invoke install -d.

  • invoke $command results in '$command' did not receive all required positional arguments!: this error message occurs when trying to run WB v0.30.0+ with invoke<0.13.0. Run pip install invoke==0.13.0, then retry your command.

License

Copyright 2013-2018 Center for Open Science

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

COS is hiring!

Want to help save science? Want to get paid to develop free, open source software? Check out our openings!

About

WaterButler is a Python web application for interacting with various file storage services via a single RESTful API, developed at Center for Open Science.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 99.9%
  • Dockerfile 0.1%