Skip to content

Commit

Permalink
Merge pull request #250 from alanhamlett/master
Browse files Browse the repository at this point in the history
Drop support for Python <= 3.7
  • Loading branch information
alanhamlett authored Sep 14, 2023
2 parents 4e188ee + b7bf798 commit c50c9fe
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 27 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, 3.11]
python-version: [3.8, 3.9, '3.10', 3.11]
fail-fast: false

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -23,7 +23,7 @@ jobs:
chmod +x ./ci/before-script.sh
./ci/before-script.sh
python -m pip install --upgrade pip
pip install nose
pip install pynose
- name: Run tests
run: nosetests -w tests
run: nosetests -w tests
4 changes: 2 additions & 2 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Changelog
---------
* `1.0.1`
* Add support for Python 3.10 and Python 3.11
* `2.0.0`
* Drop support for Python <= 3.7
* `1.0.0`
* By default PDFKit now passes "quiet" option to wkhtmltopdf. Now if you need to get output you should pass "verbose=True" to API calls
* Fix different issues with searching for wkhtmltopdf binary
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Python-PDFKit: HTML to PDF wrapper
.. image:: https://badge.fury.io/py/pdfkit.svg
:target: http://badge.fury.io/py/pdfkit

Python 2 and 3 wrapper for wkhtmltopdf utility to convert HTML to PDF using Webkit.
Python 3 wrapper for wkhtmltopdf utility to convert HTML to PDF using Webkit.

This is adapted version of `ruby PDFKit <https://github.com/pdfkit/pdfkit>`_ library, so big thanks to them!

Expand All @@ -19,7 +19,7 @@ Installation

.. code-block:: bash
$ pip install pdfkit (or pip3 for python3)
$ pip install pdfkit
2. Install wkhtmltopdf:

Expand Down
4 changes: 2 additions & 2 deletions ci/before-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

WKHTML2PDF_VERSION='0.12.6-1'

sudo apt-get install -y build-essential xorg libssl-dev libxrender-dev wget gdebi
sudo apt install -y build-essential xorg libssl-dev libxrender-dev wget
wget "https://github.com/wkhtmltopdf/packaging/releases/download/${WKHTML2PDF_VERSION}/wkhtmltox_${WKHTML2PDF_VERSION}.bionic_amd64.deb"
sudo gdebi --n wkhtmltox_${WKHTML2PDF_VERSION}.bionic_amd64.deb
sudo apt install -y ./wkhtmltox_${WKHTML2PDF_VERSION}.bionic_amd64.deb
2 changes: 1 addition & 1 deletion pdfkit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"""

__author__ = 'Golovanov Stanislav'
__version__ = '1.0.1'
__version__ = '2.0.0'
__license__ = 'MIT'

from .pdfkit import PDFKit
Expand Down
12 changes: 4 additions & 8 deletions pdfkit/pdfkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
import io
import codecs

# Python 2.x and 3.x support for checking string types
basestring = str.__mro__[-2]
unicode = type(u'')


class PDFKit(object):
"""
Expand Down Expand Up @@ -113,7 +109,7 @@ def _command(self, path=None):
if self.source.isString() or self.source.isFileObj():
yield '-'
else:
if isinstance(self.source.source, basestring):
if isinstance(self.source.source, str):
yield self.source.to_s()
else:
for s in self.source.source:
Expand Down Expand Up @@ -158,7 +154,7 @@ def to_pdf(self, path=None):
args = self.command(path)

if sys.platform == 'win32':
#hide cmd window
# hide cmd window
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
startupinfo.wShowWindow = subprocess.SW_HIDE
Expand Down Expand Up @@ -241,8 +237,8 @@ def _normalize_options(self, options):
for optval in value:
yield (normalized_key, optval)
else:
normalized_value = '' if isinstance(value,bool) else value
yield (normalized_key, unicode(normalized_value) if value else value)
normalized_value = '' if isinstance(value, bool) else value
yield (normalized_key, str(normalized_value) if value else value)

def _normalize_arg(self, arg):
return arg.lower()
Expand Down
7 changes: 0 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,6 @@ def long_description():
author_email='[email protected]',
classifiers=[
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py27,py33,py34,py35,py36,py37,py38,py39,py310,py311
envlist = py38,py39,py310,py311

[testenv]
deps = pytest
Expand Down

0 comments on commit c50c9fe

Please sign in to comment.