A Python package for rendering files to HTML via an embeddable iframe
JavaScript Jupyter Notebook Java Python CSS Mako HTML
Permalink
Failed to load latest commit information.
docs minor docs update: specify copyright, use en-us for license Feb 3, 2017
mfr Allow same origin in sandboxing to unbreak pdf rendering Nov 14, 2017
tests add closing semicolon to jasp template css Nov 14, 2017
.dockerignore Clean up and update dockerfile [ci skip] Nov 10, 2017
.gitignore add .cache to .gitignore May 12, 2016
.mailmap add contributor .mailmap file Nov 15, 2016
.travis.yml Support coveralls to expose code coverage metrics Oct 20, 2017
AUTHORS.rst Adding documentation for supported filetypes Nov 13, 2017
CHANGELOG bump version & update changelog Nov 10, 2017
CONTRIBUTING.rst Adding documentation for supported filetypes Nov 13, 2017
Dockerfile Clean up and update dockerfile [ci skip] Nov 10, 2017
LICENSE setup cleanup Aug 22, 2014
PULL_REQUEST_TEMPLATE.md Add PR template. Oct 12, 2017
README.md Support coveralls to expose code coverage metrics Oct 20, 2017
constraints.txt Use constraints file to handle conflicts in sub-dependencies Oct 20, 2017
dev-requirements.txt add zip rendering and tests Nov 10, 2017
doc-requirements.txt readthedocs updates May 13, 2016
environment.yml remove unneeded invoke dep from environment.yml Jan 28, 2017
readthedocs.yml Add config files and remove vestigial reference to LaTex files. Jan 24, 2017
requirements.txt Adding support for .psd files to MFR Nov 10, 2017
setup.cfg Support coveralls to expose code coverage metrics Oct 20, 2017
setup.py Add renderer for Jamovi files (.omv) Nov 14, 2017
supportedextensions.md Add renderer for Jamovi files (.omv) Nov 14, 2017
tasks.py Update tasks.py Nov 9, 2017
travis-config.json updates for travis-ci Jun 8, 2015

README.md

MFR (Modular File Renderer)

master Build Status: Build Status

develop Build Status: Build Status

Coverage Status

A Python package for rendering files to HTML via an embeddable iframe.

Compatibility

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

Documentation

Documentation available at: http://modular-file-renderer.readthedocs.io/en/latest/

Setting up

Install the latest version of python3.5.

For MacOSX users:

brew install python3
# optional, needed for some converters
brew install pspp unoconv

For Ubuntu users:

apt-get install python3
# optional, needed for some converters
apt-get install pspp unoconv

After installing python3.5, create the virtual environment with the following commands:

pip install virtualenv
pip install virtualenvwrapper
mkvirtualenv --python=`which python3.5` mfr
pip install setuptools==30.4.0
pip install invoke==0.13.0
invoke install
invoke server

Configuring

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

mkdir ~/.cos

The defaults should suffice for most local testing. If you're running the OSF or WaterButler on something other than http://localhost:5000/ and http://localhost:7777/, you'll need to update the ALLOWED_PROVIDER_DOMAINS settings value. ALLOWED_PROVIDER_DOMAINS is a list formatted as a space-separated string. This allows MFR to be configured via an environment variable (which are always strings), as is done in the OSF's .docker-compose.mfr.env. Example of customized domains:

{
  "SERVER_CONFIG": {
    "ALLOWED_PROVIDER_DOMAINS": "http://my_osf:5001/ http://my_wb:23405/"
  }
}

If you encounter the error message TypeError: throw() takes 2 positional arguments but 4 were given, you've run into a core asyncio bug! This bug is triggered by turning on debugging. You'll need to set the SERVER_CONFIG.DEBUG flag to false:

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

Testing

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

invoke install --develop
invoke test

Known issues

  • Running invoke install -d with setuptools v31 or greater can break MFR. The symptom error message is: "AttributeError: module 'mfr' has no attribute '__version__'". If you encounter this, you will need to remove the file mfr-nspkg.pth from your virtualenv directory, run pip install setuptools==30.4.0, then re-run invoke install -d.

  • The error def create_default_context(purpose=ssl.Purpose.SERVER_AUTH, *, cafile=None, capath=None, cadata=None): SyntaxError: invalid syntax is caused by inadvertently running the wrong version of Python. This can be caused by hashing the alias inv. To fix this run the command hash -d inv then run inv server.

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

Create your own module

Interested in adding support for a new provider or file format? Check out the CONTRIBUTING.rst docs.

License

Copyright 2013-2017 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!