Skip to content

Commit c5adba2

Browse files
Merge branch 'develop' of https://github.com/CenterForOpenScience/modular-file-renderer into feature/markdown-upgrade
2 parents 26e5b64 + 8bb2dd4 commit c5adba2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1656
-84
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.git
22
*.pyc
33
**/*.pyc
4+
Dockerfile

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ language: python
22

33
python:
44
- "3.5"
5+
- "3.6"
56

67
sudo: false
78

@@ -35,3 +36,6 @@ before_cache:
3536

3637
notifications:
3738
flowdock: 0221882cdda034c0e9ac2a0e766053dd
39+
40+
after_success:
41+
coveralls

AUTHORS.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,4 @@ Contributors
3030
- Rafael de Lucena Valle `@rafaeldelucena <https://github.com/rafaeldelucena>`_
3131
- Matthew Keitelman `@zamattiac <https://github.com/zamattiac>`_
3232
- John Tordoff `@Johnetordoff <https://github.com/Johnetordoff>`_
33+
- Addison Schiller `@AddisonSchiller <https://github.com/AddisonSchiller>`_

CHANGELOG

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,25 @@
22
ChangeLog
33
*********
44

5+
0.22.0 (2017-10-10)
6+
===================
7+
- Feature: Added support for rendering ~50 new plain-text file types via codepygments, including
8+
FASTA files, ImageJ macros, and Turtle files. (thanks, @AddisonSchiller!)
9+
- Feature: Add a unique request ID to MFR's response headers to help with tracking down errors.
10+
- Feature: Add a new task to clean the export and render caches. (thanks, @icereval!)
11+
- Fix: Error more gracefully when missing required query parameters.
12+
- Fix: Make scrollbars visible on IE11 when content overflows the iframe.
13+
- Fix: Fix ALLOWED_PROVIDER_DOMAINS example in MFR docs. (thanks, @jonathon-love for reporting!)
14+
- Code: Teach MFR to listen for a SIGTERM signal and exit immediately upon receiving it. This
15+
bypasses the 10 second wait for shutdown when running it in Docker.
16+
- Code: Add code-coverage checking via coveralls.io. (thanks, @abought!)
17+
- Code: Add Python 3.6 to travis testing matrix. (thanks, @abought!)
18+
- Code: Add a Pull Request template for GitHub. (thanks, @cslzchen!)
19+
20+
0.21.2 (2017-09-13)
21+
===================
22+
- Fix: Update jQuery onload invocation to be compatible with jQuery 3. (thanks, @sloria!)
23+
524
0.21.1 (2017-07-20)
625
===================
726
- Fix: Quiet some overly-verbose error logging.

CONTRIBUTING.rst

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ In general
88
- `PEP 8`_, when sensible.
99
- Test ruthlessly. Write docs for new features.
1010
- Even more important than Test-Driven Development--*Human-Driven Development*.
11+
- If you add an extension to setup.py, add it to supportedextensions.md.
1112
- Please update AUTHORS.rst when you contribute.
1213

1314
.. _`PEP 8`: http://www.python.org/dev/peps/pep-0008/
@@ -107,14 +108,12 @@ Manual Local Testing
107108

108109
To make sure a new renderer is functioning properly, it's recommended that you try to render a file of that type locally.
109110

110-
First, change the default provider to HTTP (in `/mfr/server/settings.py`) and update the provider domain whitelist:
111+
First, change the default provider to HTTP (in `/mfr/server/settings.py`), then update the provider domain in the ``ALLOWED_PROVIDER_DOMAINS`` whitelist (a space-separated string):
111112

112113
.. code-block:: python
113114
114115
PROVIDER_NAME = config.get('PROVIDER_NAME', 'http')
115-
ALLOWED_PROVIDER_DOMAINS = config.get('ALLOWED_PROVIDER_DOMAINS', ['http://localhost:8000/'])
116-
117-
116+
ALLOWED_PROVIDER_DOMAINS = config.get('ALLOWED_PROVIDER_DOMAINS', 'http://localhost:8000/')
118117
119118
Because the MFR is passed a url to render, you also need to be running an http server.
120119

@@ -130,15 +129,13 @@ Or for python 3
130129
131130
python3 -m http.server 8000
132131
133-
With both the SimpleHTTPServer the MFR server running, go to
132+
With both the SimpleHTTPServer and the MFR server running, go to
134133

135134
.. code-block:: bash
136135
137136
http://localhost:7778/render?url=http://localhost:8000/[filename].[ext]
138137
139138
140-
141-
142139
Writing A File Format Package
143140
-----------------------------
144141

Dockerfile

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
FROM python:3.5-slim
22

3-
RUN usermod -d /home www-data && chown www-data:www-data /home
3+
# ensure unoconv can locate the uno library
4+
ENV PYTHONPATH=/usr/lib/python3/dist-packages
45

5-
RUN apt-get update \
6+
RUN usermod -d /home www-data \
7+
&& chown www-data:www-data /home \
8+
&& apt-get update \
69
# mfr dependencies
710
&& apt-get install -y \
811
git \
@@ -19,49 +22,39 @@ RUN apt-get update \
1922
libxml2-dev \
2023
libxslt1-dev \
2124
zlib1g-dev \
22-
# unoconv dependencies
23-
&& apt-get install -y \
25+
# unoconv dependencies
2426
unoconv \
25-
# pspp dependencies
26-
&& apt-get install -y \
27+
# pspp dependencies
2728
pspp \
28-
&& apt-get clean \
29-
&& apt-get autoremove -y \
30-
&& rm -rf /var/lib/apt/lists/*
31-
32-
# grab gosu for easy step-down from root
33-
ENV GOSU_VERSION 1.4
34-
RUN apt-get update \
35-
&& apt-get install -y \
29+
# gosu dependencies
3630
curl \
31+
# gosu
32+
&& export GOSU_VERSION='1.10' \
3733
&& gpg --keyserver pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
3834
&& curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
3935
&& curl -o /usr/local/bin/gosu.asc -SL "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \
4036
&& gpg --verify /usr/local/bin/gosu.asc \
4137
&& rm /usr/local/bin/gosu.asc \
4238
&& chmod +x /usr/local/bin/gosu \
39+
# /gosu
4340
&& apt-get clean \
4441
&& apt-get autoremove -y \
4542
curl \
46-
&& rm -rf /var/lib/apt/lists/*
47-
48-
# ensure unoconv can locate the uno library
49-
ENV PYTHONPATH=/usr/lib/python3/dist-packages
43+
&& rm -rf /var/lib/apt/lists/* \
44+
&& pip install -U pip \
45+
&& pip uninstall -y setuptools \
46+
&& rm -f /usr/local/lib/python3.5/site-packages/mfr-nspkg.pth \
47+
&& pip install setuptools==30.4.0 \
48+
&& mkdir -p /code
5049

51-
RUN mkdir -p /code
5250
WORKDIR /code
5351

54-
RUN pip install -U pip
55-
RUN pip uninstall -y setuptools
56-
RUN rm -f /usr/local/lib/python3.5/site-packages/mfr-nspkg.pth
57-
RUN pip install setuptools==30.4.0
58-
59-
COPY ./requirements.txt /code/
52+
COPY ./requirements.txt ./
6053

61-
RUN pip install --no-cache-dir -r /code/requirements.txt
54+
RUN pip install --no-cache-dir -r ./requirements.txt
6255

6356
# Copy the rest of the code over
64-
COPY ./ /code/
57+
COPY ./ ./
6558

6659
ARG GIT_COMMIT=
6760
ENV GIT_COMMIT ${GIT_COMMIT}
@@ -70,4 +63,4 @@ RUN python setup.py develop
7063

7164
EXPOSE 7778
7265

73-
CMD ["gosu", "nobody", "invoke", "server"]
66+
CMD ["gosu", "www-data", "invoke", "server"]

PULL_REQUEST_TEMPLATE.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<!-- Use the following format for the title of the Pull Request:
2+
3+
[Status] [Ticket] Title
4+
5+
- For PR ready for review, no need for status
6+
- For PR in progress, use [WIP]
7+
- For PR on hold, use [HOLD]
8+
-->
9+
10+
<!-- Before submit your Pull Request, make sure you picked the right branch:
11+
12+
- For hotfixes, select "master" as the target branch
13+
- For new features and improvements, select "develop" as the target branch
14+
-->
15+
16+
<!-- For security related tickets, talk with the team lead before submit your PR -->
17+
18+
## Ticket
19+
20+
<!-- Link to JIRA ticket, if applicable e.g. https://openscience.atlassian.net/browse/SVCS-1234 -->
21+
22+
## Purpose
23+
24+
<!-- Describe the purpose of your changes -->
25+
26+
## Changes
27+
28+
<!-- Briefly describe or list your changes -->
29+
30+
## Side effects
31+
32+
<!-- Any possible side effects? -->
33+
34+
## QA Notes
35+
36+
<!-- If applicable, briefly describe how QA should test this ticket/PR -->
37+
38+
## Deployment Notes
39+
40+
<!-- Any special configurations for deployment? -->

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
`develop` Build Status: [![Build Status](https://travis-ci.org/CenterForOpenScience/modular-file-renderer.svg?branch=develop)](https://travis-ci.org/CenterForOpenScience/modular-file-renderer)
66

7+
[![Coverage Status](https://coveralls.io/repos/github/CenterForOpenScience/modular-file-renderer/badge.svg)](https://coveralls.io/github/CenterForOpenScience/modular-file-renderer)
8+
79
A Python package for rendering files to HTML via an embeddable iframe.
810

911
### Compatibility
@@ -53,12 +55,12 @@ MFR configuration is done through a JSON file (`mfr-test.json`) that lives in th
5355
mkdir ~/.cos
5456
```
5557

56-
The defaults should suffice for most local testing. If you're running the OSF on something other than `http://localhost:5000/`, you'll need to update the `ALLOWED_PROVIDER_DOMAINS` settings value:
58+
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:
5759

5860
```json
5961
{
6062
"SERVER_CONFIG": {
61-
"ALLOWED_PROVIDER_DOMAINS": ["http://localhost:9999/"]
63+
"ALLOWED_PROVIDER_DOMAINS": "http://my_osf:5001/ http://my_wb:23405/"
6264
}
6365
}
6466
```

constraints.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## Constraints file for resolving conflicts across packages. Used to resolve issues with sub-dependencies of an actual requirement.
2+
## (eg when python-coveralls indirectly requires a version of requests)
3+
## "Constraints files are requirements files that only control which version of a requirement is installed, not whether it is installed or not."
4+
## See https://pip-python3.readthedocs.org/en/latest/user_guide.html#constraints-files
5+
6+
# Newer version of requests throw an error when using the version of chardet we pin to; this causes issues for python-coveralls
7+
requests==2.14.2

dev-requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
-r requirements.txt
22

33
-e git+https://github.com/centerforopenscience/aiohttpretty.git@0.0.2#egg=aiohttpretty
4+
beautifulsoup4
45
colorlog==2.5.0
56
flake8==3.0.4
67
ipdb
@@ -9,4 +10,5 @@ pydevd==0.0.6
910
pyflakes
1011
pytest==2.8.2
1112
pytest-cov==2.2.0
13+
python-coveralls==2.9.1
1214
pyzmq==14.4.1

0 commit comments

Comments
 (0)