Repository: jstockwin/py-pdf-parser (language: python)

Issue:
[requirements] Upgrade matplotlib to 3.3.3

Bump matplotlib from 3.1.2 to 3.4.2
Bumps [matplotlib](https://github.com/matplotlib/matplotlib) from 3.1.2 to 3.4.2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/matplotlib/matplotlib/releases">matplotlib's releases</a>.</em></p>
<blockquote>
<h2>REL: v3.4.2</h2>
<p>This is the second bugfix release of the 3.4.x series.</p>
<p>This release contains several critical bug-fixes:</p>
<ul>
<li>Generate wheels usable on older PyPy7.3.{0,1}</li>
<li>Fix compatibility with Python 3.10</li>
<li>Add <code>subplot_mosaic</code> Axes in the order the user gave them to us</li>
<li>Correctly handle 'none' <em>facecolors</em> in <code>do_3d_projection</code></li>
<li>Ensure that Matplotlib is importable even if there's no HOME</li>
<li>Fix <code>CenteredNorm</code> with <em>halfrange</em></li>
<li>Fix <code>bar_label</code> for bars with NaN values</li>
<li>Fix clip paths when zoomed such that they are outside the figure</li>
<li>Fix creation of <code>RangeSlider</code> with <em>valinit</em></li>
<li>Fix handling of &quot;d&quot; glyph in backend_ps, fixing EPS output</li>
<li>Fix handling of datetime coordinates in <code>pcolormesh</code> with Pandas</li>
<li>Fix processing of some <code>errorbar</code> arguments</li>
<li>Fix removal of shared polar Axes</li>
<li>Fix resetting grid visibility</li>
<li>Fix subfigure indexing error and tight bbox</li>
<li>Fix textbox cursor color</li>
<li>Fix TkAgg event loop error on window close</li>
<li>Ignore errors for sip with no setapi (Qt4Agg import errors)</li>
</ul>
<h2>REL: v3.4.1</h2>
<p>This is the first bugfix release of the 3.4.x series.</p>
<p>This release contains several critical bug-fixes:</p>
<ul>
<li>fix errorbar when specifying fillstyle</li>
<li>fix Inkscape cleanup at exit on Windows for tests</li>
<li>fix legends of colour-mapped scatter plots</li>
<li>fix positioning of annotation fancy arrows</li>
<li>fix size and color rendering for 3D scatter plots</li>
<li>fix suptitle manual positioning when using constrained layout</li>
<li>respect antialiasing settings in cairo backends as well</li>
</ul>
<h2>REL: v3.4.0</h2>
<p>Highlights of this release include:</p>
<ul>
<li>Figure and Axes creation / management
<ul>
<li>New subfigure functionality</li>
<li>Single-line string notation for <code>subplot_mosaic</code></li>
<li>Changes to behavior of Axes creation methods (<code>gca</code>, <code>add_axes</code>, <code>add_subplot</code>)</li>
<li><code>add_subplot</code>/<code>add_axes</code> gained an <em>axes_class</em> parameter</li>
<li>Subplot and subplot2grid can now work with constrained layout</li>
</ul>
</li>
<li>Plotting methods
<ul>
<li><code>axline</code> supports transform parameter</li>
<li>New automatic labeling for bar charts</li>
<li>A list of hatches can be specified to <code>bar</code> and <code>barh</code></li>
</ul>
</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/matplotlib/matplotlib/commit/e3fe991d45a3dbdf3afeaf8bd4556980178183eb"><code>e3fe991</code></a> REL: v3.4.2</li>
<li><a href="https://github.com/matplotlib/matplotlib/commit/2af33c73e39fa29e4fae2b73f82e8dd44700808d"><code>2af33c7</code></a> Move API changes to correct file.</li>
<li><a href="https://github.com/matplotlib/matplotlib/commit/de6c7889abb267fc3a590cc688e75c8b11f4f037"><code>de6c788</code></a> DOC: Update GitHub stats for 3.4.2.</li>
<li><a href="https://github.com/matplotlib/matplotlib/commit/3969286060a7f3e9f26c4cd619be6a85d23557e1"><code>3969286</code></a> Merge branch 'v3.4.1-doc' into v3.4.x</li>
<li><a href="https://github.com/matplotlib/matplotlib/commit/990ef2cc8831ff36691337e45f83728d333a9bd5"><code>990ef2c</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/matplotlib/matplotlib/issues/20184">#20184</a> from meeseeksmachine/auto-backport-of-pr-20147-on-v...</li>
<li><a href="https://github.com/matplotlib/matplotlib/commit/d90b7f05ab38c959b7bc788036fdf6f24b5f4f4e"><code>d90b7f0</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/matplotlib/matplotlib/issues/20183">#20183</a> from meeseeksmachine/auto-backport-of-pr-20147-on-v...</li>
<li><a href="https://github.com/matplotlib/matplotlib/commit/f5a3128fa56d18031d88acb95fbb891c4f800e7a"><code>f5a3128</code></a> Backport PR <a href="https://github-redirect.dependabot.com/matplotlib/matplotlib/issues/20147">#20147</a>: DOC: add example of labelling axes</li>
<li><a href="https://github.com/matplotlib/matplotlib/commit/0327cfb627fca6a87104cab0249e16d5359c5b4f"><code>0327cfb</code></a> Backport PR <a href="https://github-redirect.dependabot.com/matplotlib/matplotlib/issues/20147">#20147</a>: DOC: add example of labelling axes</li>
<li><a href="https://github.com/matplotlib/matplotlib/commit/601d3f5bd98430c175d7bacfe544df54084831bc"><code>601d3f5</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/matplotlib/matplotlib/issues/20181">#20181</a> from meeseeksmachine/auto-backport-of-pr-20171-on-v...</li>
<li><a href="https://github.com/matplotlib/matplotlib/commit/46343dc39d60917a859e1c1318251c92ea002a9d"><code>46343dc</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/matplotlib/matplotlib/issues/20180">#20180</a> from meeseeksmachine/auto-backport-of-pr-19876-on-v...</li>
<li>Additional commits viewable in <a href="https://github.com/matplotlib/matplotlib/compare/v3.1.2...v3.4.2">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=matplotlib&package-manager=pip&previous-version=3.1.2&new-version=3.4.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>


Discussion / hints:

Fix patch:
diff --git a/.github/scripts/docs.sh b/.github/scripts/docs.sh
index 6c3a6393..426786e5 100755
--- a/.github/scripts/docs.sh
+++ b/.github/scripts/docs.sh
@@ -6,7 +6,7 @@ echo '#######################################################################'
 
 export SPHINXOPTS="-W"  # Treat warnings as errors
 
-make --directory $PROJECT_DIR/docs html
+xvfb-run make --directory $PROJECT_DIR/docs html
 
 DOCS_STATUS=$?
 if [[ ("$DOCS_STATUS" == 0) ]]; then
diff --git a/docker-compose.yml b/docker-compose.yml
index f893b570..e1172e1a 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -6,7 +6,7 @@ shell:
     - /tmp/.X11-unix:/tmp/.X11-unix:rw
     - ./imagemagick_policy.xml:/etc/ImageMagick-6/policy.xml
   environment:
-    DISPLAY: ":1"
+    - DISPLAY
   command: bash
 
 lint:
@@ -31,6 +31,9 @@ tests:
   dockerfile: dockerfiles/Dockerfile_tests
   volumes:
     - .:/py-pdf-parser
+    - /tmp/.X11-unix:/tmp/.X11-unix:rw
+  environment:
+    - DISPLAY
   command: bash -c "nosetests ."
 
 # Run docs to re-build the docs once.
diff --git a/dockerfiles/Dockerfile b/dockerfiles/Dockerfile
index 87c3da3a..d7da1ba5 100644
--- a/dockerfiles/Dockerfile
+++ b/dockerfiles/Dockerfile
@@ -1,4 +1,4 @@
-FROM phusion/baseimage:0.11
+FROM phusion/baseimage:focal-1.0.0
 
 RUN adduser --disabled-password --gecos "" app_user
 
diff --git a/dockerfiles/Dockerfile_dev b/dockerfiles/Dockerfile_dev
index 17c20655..aa241710 100644
--- a/dockerfiles/Dockerfile_dev
+++ b/dockerfiles/Dockerfile_dev
@@ -1,4 +1,4 @@
-FROM phusion/baseimage:0.11
+FROM phusion/baseimage:focal-1.0.0
 
 RUN adduser --disabled-password --gecos "" app_user
 
diff --git a/py_pdf_parser/visualise/main.py b/py_pdf_parser/visualise/main.py
index 522dc609..10e13672 100644
--- a/py_pdf_parser/visualise/main.py
+++ b/py_pdf_parser/visualise/main.py
@@ -4,7 +4,7 @@
 
 import matplotlib
 
-matplotlib.use("Qt5Agg", warn=False)  # noqa
+matplotlib.use("Qt5Agg")  # noqa
 from matplotlib import pyplot as plt
 from matplotlib.backend_bases import MouseButton
 
@@ -19,7 +19,7 @@
     from matplotlib.figure import Figure, Text
     from matplotlib.axes import Axes
     from matplotlib.backend_bases import MouseEvent
-    import PyQt5
+    from PyQt5 import QtWidgets
 logger = logging.getLogger("PDFParser")
 
 
@@ -44,10 +44,10 @@ class PDFVisualiser:
     __fig: "Figure"
     __info_fig: Optional["Figure"] = None
     __info_text: Optional["Text"] = None
-    __first_page_button: "PyQt5.QtWidgets.QAction" = None
-    __previous_page_button: "PyQt5.QtWidgets.QAction" = None
-    __next_page_button: "PyQt5.QtWidgets.QAction" = None
-    __last_page_button: "PyQt5.QtWidgets.QAction" = None
+    __first_page_button: Optional["QtWidgets.QAction"] = None
+    __previous_page_button: Optional["QtWidgets.QAction"] = None
+    __next_page_button: Optional["QtWidgets.QAction"] = None
+    __last_page_button: Optional["QtWidgets.QAction"] = None
     __section_visualiser: "SectionVisualiser"
 
     __clicked_elements: Dict[MouseButton, "PDFElement"] = {}
diff --git a/setup.py b/setup.py
index 3f79150e..8f73f766 100644
--- a/setup.py
+++ b/setup.py
@@ -33,22 +33,22 @@
     ],
     extras_require={
         "dev": [
-            "matplotlib==3.1.2",
+            "matplotlib==3.4.2",
             "pillow==8.1.1",
-            "pyqt5==5.14.1",
+            "pyqt5==5.15.4",
             "pyvoronoi==1.0.5",
             "shapely==1.7.1",
         ],
         "test": [
             "black==21.5b1",
             "ddt==1.4.2",
-            "matplotlib==3.1.2",
+            "matplotlib==3.4.2",
             "mock==4.0.3",
             "mypy==0.812",
             "nose==1.3.7",
             "pillow==8.1.1",
             "pycodestyle==2.7.0",
-            "pyqt5==5.14.1",
+            "pyqt5==5.15.4",
             "pytype==2021.5.11",
             "recommonmark==0.7.1",
             "sphinx-autobuild==2021.3.14",


Test patch:
diff --git a/.github/scripts/test.sh b/.github/scripts/test.sh
index 88daad58..914122fc 100755
--- a/.github/scripts/test.sh
+++ b/.github/scripts/test.sh
@@ -7,7 +7,7 @@ echo ''
 echo '#######################################################################'
 echo '#                          Running nosetests                          #'
 echo '#######################################################################'
-nosetests $PROJECT_DIR
+xvfb-run nosetests $PROJECT_DIR
 
 TEST_STATUS=$?
 if [[ ("$TEST_STATUS" == 0) ]]; then
diff --git a/dockerfiles/Dockerfile_tests b/dockerfiles/Dockerfile_tests
index f5a30bd4..9dd5e117 100644
--- a/dockerfiles/Dockerfile_tests
+++ b/dockerfiles/Dockerfile_tests
@@ -1,4 +1,4 @@
-FROM phusion/baseimage:0.11
+FROM phusion/baseimage:focal-1.0.0
 
 RUN adduser --disabled-password --gecos "" app_user
 
@@ -6,7 +6,8 @@ RUN apt-get update && \
     apt-get -y install software-properties-common \
     python3-dev \
     python3-pip \
-    libmagickwand-dev
+    libmagickwand-dev \
+    xvfb
 
 RUN pip3 install --upgrade pip