Skip to content

Commit c50c9fe

Browse files
authored
Merge pull request #250 from alanhamlett/master
Drop support for Python <= 3.7
2 parents 4e188ee + b7bf798 commit c50c9fe

File tree

8 files changed

+16
-27
lines changed

8 files changed

+16
-27
lines changed

.github/workflows/main.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, 3.11]
10+
python-version: [3.8, 3.9, '3.10', 3.11]
1111
fail-fast: false
1212

1313
steps:
1414
- uses: actions/checkout@v2
1515
- name: Set up Python ${{ matrix.python-version }}
16-
uses: actions/setup-python@v2
16+
uses: actions/setup-python@v4
1717
with:
1818
python-version: ${{ matrix.python-version }}
1919

@@ -23,7 +23,7 @@ jobs:
2323
chmod +x ./ci/before-script.sh
2424
./ci/before-script.sh
2525
python -m pip install --upgrade pip
26-
pip install nose
26+
pip install pynose
2727
2828
- name: Run tests
29-
run: nosetests -w tests
29+
run: nosetests -w tests

HISTORY.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Changelog
22
---------
3-
* `1.0.1`
4-
* Add support for Python 3.10 and Python 3.11
3+
* `2.0.0`
4+
* Drop support for Python <= 3.7
55
* `1.0.0`
66
* By default PDFKit now passes "quiet" option to wkhtmltopdf. Now if you need to get output you should pass "verbose=True" to API calls
77
* Fix different issues with searching for wkhtmltopdf binary

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Python-PDFKit: HTML to PDF wrapper
88
.. image:: https://badge.fury.io/py/pdfkit.svg
99
:target: http://badge.fury.io/py/pdfkit
1010

11-
Python 2 and 3 wrapper for wkhtmltopdf utility to convert HTML to PDF using Webkit.
11+
Python 3 wrapper for wkhtmltopdf utility to convert HTML to PDF using Webkit.
1212

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

@@ -19,7 +19,7 @@ Installation
1919

2020
.. code-block:: bash
2121
22-
$ pip install pdfkit (or pip3 for python3)
22+
$ pip install pdfkit
2323
2424
2. Install wkhtmltopdf:
2525

ci/before-script.sh

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

33
WKHTML2PDF_VERSION='0.12.6-1'
44

5-
sudo apt-get install -y build-essential xorg libssl-dev libxrender-dev wget gdebi
5+
sudo apt install -y build-essential xorg libssl-dev libxrender-dev wget
66
wget "https://github.com/wkhtmltopdf/packaging/releases/download/${WKHTML2PDF_VERSION}/wkhtmltox_${WKHTML2PDF_VERSION}.bionic_amd64.deb"
7-
sudo gdebi --n wkhtmltox_${WKHTML2PDF_VERSION}.bionic_amd64.deb
7+
sudo apt install -y ./wkhtmltox_${WKHTML2PDF_VERSION}.bionic_amd64.deb

pdfkit/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"""
55

66
__author__ = 'Golovanov Stanislav'
7-
__version__ = '1.0.1'
7+
__version__ = '2.0.0'
88
__license__ = 'MIT'
99

1010
from .pdfkit import PDFKit

pdfkit/pdfkit.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88
import io
99
import codecs
1010

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

1612
class PDFKit(object):
1713
"""
@@ -113,7 +109,7 @@ def _command(self, path=None):
113109
if self.source.isString() or self.source.isFileObj():
114110
yield '-'
115111
else:
116-
if isinstance(self.source.source, basestring):
112+
if isinstance(self.source.source, str):
117113
yield self.source.to_s()
118114
else:
119115
for s in self.source.source:
@@ -158,7 +154,7 @@ def to_pdf(self, path=None):
158154
args = self.command(path)
159155

160156
if sys.platform == 'win32':
161-
#hide cmd window
157+
# hide cmd window
162158
startupinfo = subprocess.STARTUPINFO()
163159
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
164160
startupinfo.wShowWindow = subprocess.SW_HIDE
@@ -241,8 +237,8 @@ def _normalize_options(self, options):
241237
for optval in value:
242238
yield (normalized_key, optval)
243239
else:
244-
normalized_value = '' if isinstance(value,bool) else value
245-
yield (normalized_key, unicode(normalized_value) if value else value)
240+
normalized_value = '' if isinstance(value, bool) else value
241+
yield (normalized_key, str(normalized_value) if value else value)
246242

247243
def _normalize_arg(self, arg):
248244
return arg.lower()

setup.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,6 @@ def long_description():
3939
author_email='[email protected]',
4040
classifiers=[
4141
'Programming Language :: Python',
42-
'Programming Language :: Python :: 2.7',
43-
'Programming Language :: Python :: 3.2',
44-
'Programming Language :: Python :: 3.3',
45-
'Programming Language :: Python :: 3.4',
46-
'Programming Language :: Python :: 3.5',
47-
'Programming Language :: Python :: 3.6',
48-
'Programming Language :: Python :: 3.7',
4942
'Programming Language :: Python :: 3.8',
5043
'Programming Language :: Python :: 3.9',
5144
'Programming Language :: Python :: 3.10',

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py27,py33,py34,py35,py36,py37,py38,py39,py310,py311
2+
envlist = py38,py39,py310,py311
33

44
[testenv]
55
deps = pytest

0 commit comments

Comments
 (0)