Skip to content

Commit

Permalink
Update for Django 1.11 and Python 3
Browse files Browse the repository at this point in the history
Update docs, tests and demo. Port changes from develop branch (#34).
  • Loading branch information
nigma committed Apr 19, 2017
1 parent ed89911 commit ded00c8
Show file tree
Hide file tree
Showing 39 changed files with 440 additions and 224 deletions.
40 changes: 40 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Created by .ignore support plugin (hsz.mobi)
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
*.manifest
*.spec
pip-log.txt
pip-delete-this-directory.txt
htmlcov/
.tox/
*.mo
*.pot
*.log
docs/_build/
.env
.idea
/docs
.dockerignore
.gitattributes
.gitignore
docker-compose.yml
Dockerfile
18 changes: 9 additions & 9 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ little bit helps, and credit will always be given.
You can contribute in many ways:

Types of Contributions
----------------------
======================

Report Bugs
~~~~~~~~~~~
-----------

Report bugs at https://github.com/nigma/django-easy-pdf/issues.

Expand All @@ -22,26 +22,26 @@ If you are reporting a bug, please include:
* Detailed steps to reproduce the bug.

Fix Bugs
~~~~~~~~
--------

Look through the GitHub issues for bugs. Anything tagged with "bug"
is open to whoever wants to implement it.

Implement Features
~~~~~~~~~~~~~~~~~~
------------------

Look through the GitHub issues for features. Anything tagged with "feature"
is open to whoever wants to implement it.

Write Documentation
~~~~~~~~~~~~~~~~~~~
-------------------

django-easy-pdf could always use more documentation, whether as part of the
official django-easy-pdf docs, in docstrings, or even on the web in blog posts,
articles, and such.

Submit Feedback
~~~~~~~~~~~~~~~
---------------

The best way to send feedback is to file an issue at https://github.com/nigma/django-easy-pdf/issues.

Expand All @@ -53,7 +53,7 @@ If you are proposing a feature:
are welcome :)

Get Started!
------------
============

Ready to contribute? Here's how to set up `django-easy-pdf` for local development.

Expand Down Expand Up @@ -89,14 +89,14 @@ To get flake8, just pip install them into your virtualenv.
7. Submit a pull request through the GitHub website.

Pull Request Guidelines
-----------------------
=======================

Before you submit a pull request, check that it meets these guidelines:

1. If the pull request adds functionality, the docs should be updated. Put
your new functionality into a function with a docstring, and add the
feature to the list in README.rst.
2. The pull request should work for Python 2.7, and 3.3 (if there are compatible
2. The pull request should work for Python 2.7, and 3.4+ (if there are compatible
3rd party packages available). Check
https://travis-ci.org/nigma/django-easy-pdf/pull_requests
and make sure that the tests pass for all supported Python versions.
37 changes: 37 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM python:3.6

LABEL github="https://github.com/nigma/django-easy-pdf"

ENV PYTHONUNBUFFERED 1
ENV LANG=en_US.UTF-8
ENV PIP_NO_CACHE_DIR off
ENV PIP_DISABLE_PIP_VERSION_CHECK on

RUN mkdir -p /app /app/docs
WORKDIR /app

RUN set -eux \
&& DEPS=' \
bash \
gettext \
' \
&& apt-get update \
&& apt-get install -y --no-install-recommends $DEPS \
&& rm -rf /var/lib/apt/lists/*

COPY requirements.txt /app/
COPY requirements-dev.txt /app/
COPY docs/requirements.txt /app/docs/

RUN set -eux \
&& pip3 install --no-cache-dir -U pip setuptools wheel

RUN set -eux \
pip3 install --no-cache-dir --timeout 1000 -r requirements.txt -r requirements-dev.txt \
&& pip3 install --no-cache-dir --timeout 1000 -r docs/requirements.txt

COPY . /app/

EXPOSE 8000

CMD ["python", "demo.py"]
5 changes: 5 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
History
-------

0.1.1 (2017-04-19)
++++++++++++++++++

* Update for Django 1.11 and Python 3

0.1.0 (2014-01-24)
++++++++++++++++++

Expand Down
76 changes: 76 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
.PHONY: all help clean clean-build clean-pyc demo lint mypy test test-all docs release sdist dist upload docker-build docker-demo docker-shell

all: docker-demo

help:
@echo "clean-build - remove build artifacts"
@echo "clean-pyc - remove Python file artifacts"
@echo "lint - check style with flake8"
@echo "mypy - check types with mypy"
@echo "test - run tests quickly with the default Python"
@echo "testall - run tests on every Python version with tox"
@echo "docs - generate Sphinx HTML documentation, including API docs"
@echo "sdist - package"
@echo "dist - package sdist and wheel"
@echo "upload - upload to PyPI"
@echo "release - package and upload a release"
@echo "docker-demo - build and run demo using Docker image"

clean: clean-build clean-pyc

clean-build:
rm -fr build/
rm -fr dist/
rm -fr *.egg-info

clean-pyc:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +

lint:
flake8 easy_pdf tests

mypy:
mypy --ignore-missing-imports --strict-optional easy_pdf tests --verbose

test:
python tests/manage.py test

test-all:
tox

docs:
$(MAKE) -C docs clean
$(MAKE) -C docs html
sphinx-build -b linkcheck ./docs _build/
sphinx-build -b html ./docs _build/

release: lint test docs clean dist upload

sdist: clean
python setup.py sdist
ls -l dist

dist: clean
python setup.py sdist bdist_wheel

upload:
twine upload -s dist/*

demo:
python demo.py

# Docker workflow

docker-build:
docker build -t django-easy-pdf .

docker-demo: docker-build
docker run --rm -it -p 8000:8000 -v `pwd`/easy_pdf:/app/easy_pdf -v `pwd`/docs:/app/docs -v `pwd`/dist:/app/dist -v `pwd`/tests:/app/tests django-easy-pdf make demo

docker-shell: docker-build
docker run --rm -it -v `pwd`/easy_pdf:/app/easy_pdf -v `pwd`/docs:/app/docs -v `pwd`/dist:/app/dist -v `pwd`/tests:/app/tests django-easy-pdf bash

docker-%: docker-build
docker run --rm -it -v `pwd`/easy_pdf:/app/easy_pdf -v `pwd`/docs:/app/docs -v `pwd`/dist:/app/dist -v `pwd`/tests:/app/tests django-easy-pdf make $*
40 changes: 22 additions & 18 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
django-easy-pdf
===============
Django PDF rendering
====================

Django PDF rendering, the easy way.

.. image:: https://pypip.in/v/django-easy-pdf/badge.png
.. image:: https://img.shields.io/pypi/v/django-easy-pdf.svg
:target: https://pypi.python.org/pypi/django-easy-pdf/
:alt: Latest Version

.. image:: https://pypip.in/d/django-easy-pdf/badge.png
.. image:: https://img.shields.io/badge/wheel-yes-green.svg
:target: https://pypi.python.org/pypi/django-easy-pdf/
:alt: Downloads

.. image:: https://pypip.in/license/django-easy-pdf/badge.png
:alt: Wheel
.. image:: https://img.shields.io/pypi/l/django-easy-pdf.svg
:target: https://pypi.python.org/pypi/django-easy-pdf/
:alt: License

Developed at `en.ig.ma software shop <http://en.ig.ma>`_.

Development Version
-------------------

Note: A new PDF rendering backend using WeasyPrint for more accurate rendering is in development under the develop branch.
See https://github.com/nigma/django-easy-pdf/pull/34 for changes, testing and discussion.

If you rely on the ``xhtml2pdf`` rendering backend and templates pin the package version to ``django-easy-pdf>=0.1.1<0.2.0``.

Overview
--------
Expand All @@ -35,11 +40,10 @@ to render PDFs in the backend outside the request scope
Quickstart
----------

1. Include ``django-easy-pdf``, ``xhtml2pdf>=0.0.6`` and ``reportlab>=2.7,<3``
in your ``requirements.txt`` file. If you are on Python 3 you need to install
the latest version of Reportlab and the beta version of xhtml2pdf::
1. Include ``django-easy-pdf``, ``xhtml2pdf`` in your ``requirements.txt`` file.
If you are on Python 3 you need to install the latest version of Reportlab and the beta version of xhtml2pdf::

$ pip install --pre xhtml2pdf
$ pip install xhtml2pdf>=0.2b1

2. Add ``easy_pdf`` to ``INSTALLED_APPS``.

Expand All @@ -60,13 +64,13 @@ Quickstart
from easy_pdf.views import PDFTemplateView
class HelloPDFView(PDFTemplateView):
template_name = "hello.html"
template_name = 'hello.html'
Documentation
-------------

The full documentation is at `django-easy-pdf.rtfd.org <http://django-easy-pdf.rtfd.org>`_.
The full documentation is at `django-easy-pdf.readthedocs.org <https://django-easy-pdf.readthedocs.org>`_.

A live demo is at `easy-pdf.herokuapp.com <https://easy-pdf.herokuapp.com/>`_.
You can run it locally after installing dependencies by running ``python demo.py``
Expand All @@ -77,9 +81,9 @@ Dependencies

``django-easy-pdf`` depends on:

- ``django>=1.5.1``
- ``xhtml2pdf>=0.0.6``
- ``reportlab>=2.7,<3``
- ``django>=1.10``
- ``xhtml2pdf>=0.2b1``
- ``reportlab``


License
Expand All @@ -92,7 +96,7 @@ Other Resources
---------------

- GitHub repository - https://github.com/nigma/django-easy-pdf
- PyPi Package site - http://pypi.python.org/pypi/django-easy-pdf
- PyPi Package site - https://pypi.python.org/pypi/django-easy-pdf


Commercial Support
Expand Down
Loading

0 comments on commit ded00c8

Please sign in to comment.