File tree Expand file tree Collapse file tree 6 files changed +25
-24
lines changed
Expand file tree Collapse file tree 6 files changed +25
-24
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ language: python
22sudo : false
33
44python :
5- - ' 3.5'
65- ' 3.6'
76- ' nightly'
87
Original file line number Diff line number Diff line change 55
66v0.31.0 (2017-05-23)
77....................
8- * move to python 3.5 +
8+ * move to python 3.6 +
9+ * add ``async `` generation for roughly 10x speedup
10+
11+ v0.30.0
12+ .......
13+
14+ - uprev wkhtmltopdf from **0.12.2 (beta) ** to **0.12.4 **.
15+ - code cleanup
16+ - (this is the same as ``v0.3 ``, I made a mistake when versioning)
17+
18+ v0.21.0
19+ .......
20+
21+ - correct permissions on wkhtmltopdf binary.
Original file line number Diff line number Diff line change 22====
33
44
5- |Build Status | |codecov.io | |PyPI Status | |license |
5+ |BuildStatus | |codecov | |PyPI | |license |
66
77PDF generation in python using
88`wkhtmltopdf <http://wkhtmltopdf.org/ >`__.
@@ -94,26 +94,11 @@ option
9494Low level function to call wkhtmltopdf, arguments are added to
9595wkhtmltopdf binary and passed to subprocess with not processing.
9696
97- Changelog
98- ---------
99-
100- 0.30
101- ~~~~
102-
103- - uprev wkhtmltopdf from **0.12.2 (beta) ** to **0.12.4 **.
104- - code cleanup
105- - (this is the same as ``v0.3 ``, I made a mistake when versioning)
106-
107- 0.21
108- ~~~~
109-
110- - correct permissions on wkhtmltopdf binary.
111-
112- .. |Build Status | image :: https://travis-ci.org/tutorcruncher/pydf.svg?branch=master
97+ .. |BuildStatus | image :: https://travis-ci.org/tutorcruncher/pydf.svg?branch=master
11398 :target: https://travis-ci.org/tutorcruncher/pydf
114- .. |codecov.io | image :: https://codecov.io/github/tutorcruncher/pydf/coverage.svg?branch=master
99+ .. |codecov | image :: https://codecov.io/github/tutorcruncher/pydf/coverage.svg?branch=master
115100 :target: https://codecov.io/github/tutorcruncher/pydf?branch=master
116- .. |PyPI Status | image :: https://img.shields.io/pypi/v/python-pdf.svg?style=flat
101+ .. |PyPI | image :: https://img.shields.io/pypi/v/python-pdf.svg?style=flat
117102 :target: https://pypi.python.org/pypi/python-pdf
118103.. |license | image :: https://img.shields.io/pypi/l/python-pdf.svg
119104 :target: https://github.com/tutorcruncher/pydf
Original file line number Diff line number Diff line change 1616
1717
1818def go_sync ():
19- count = 20
19+ count = 10
2020 for i in range (count ):
2121 pdf = generate_pdf (
2222 html ,
@@ -53,7 +53,6 @@ async def gen(i_):
5353 zoom = '1.25' ,
5454 margin_left = '8mm' ,
5555 margin_right = '8mm' ,
56- cache_dir = PDF_CACHE ,
5756 )
5857 print (f'{ i_ :03} : { len (pdf )} ' )
5958 file = OUT_DIR / f'output_{ i_ :03} .pdf'
Original file line number Diff line number Diff line change 11import asyncio
22import re
33import subprocess
4+ import tempfile
45
56from pathlib import Path
67
@@ -63,6 +64,10 @@ class AsyncPydf:
6364 def __init__ (self , * , max_processes = 20 , loop = None ):
6465 self .semaphore = asyncio .Semaphore (value = max_processes , loop = loop )
6566 self .loop = loop
67+ cache_dir = Path (tempfile .gettempdir ()) / 'pydf_cache'
68+ if not cache_dir .exists ():
69+ Path .mkdir (cache_dir )
70+ self .cache_dir = str (cache_dir )
6671
6772 async def generate_pdf (self ,
6873 html ,
@@ -72,6 +77,7 @@ async def generate_pdf(self,
7277 creator = None ,
7378 producer = None ,
7479 ** cmd_args ):
80+ cmd_args .setdefault ('cache_dir' , self .cache_dir )
7581 cmd_args = [WK_PATH ] + _convert_args (cmd_args )
7682 async with self .semaphore :
7783 p = await asyncio .create_subprocess_exec (
Original file line number Diff line number Diff line change @@ -38,7 +38,6 @@ def run(self):
3838 'License :: OSI Approved :: MIT License' ,
3939 'Programming Language :: Python' ,
4040 'Programming Language :: Python :: 3' ,
41- 'Programming Language :: Python :: 3.5' ,
4241 'Programming Language :: Python :: 3.6' ,
4342 'Topic :: Internet :: WWW/HTTP' ,
4443 ],
You can’t perform that action at this time.
0 commit comments