diff --git a/.gitignore b/.gitignore index b1cbe4b..875a53c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,8 +5,8 @@ __pycache__/ # C extensions *.so -# MyPy cache -.mypy_cache/ +# mypy cache +.mypy_cache # Distribution / packaging .Python diff --git a/ci/conda-recipe/meta.yaml b/ci/conda-recipe/meta.yaml index e95f04c..8eb1768 100644 --- a/ci/conda-recipe/meta.yaml +++ b/ci/conda-recipe/meta.yaml @@ -25,9 +25,6 @@ requirements: - fasteners - sphinx - sphinx_rtd_theme - # HACK: Should be removed when https://github.com/ipython/ipykernel/pull/489 - # is implemented - - jupyter_client <6.0.0 test: imports: diff --git a/docs/conf.py b/docs/conf.py index d97e6dd..c529c88 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -69,7 +69,11 @@ # The master toctree document. master_doc = 'index' -autodoc_default_flags = ['show_inheritance', 'autosummary'] +autodoc_default_options = { + 'show_inheritance': True, + 'autosummary': True, +} + autoclass_content = 'both' not_document_data = ['psyplot_gui.config.rcsetup.defaultParams', @@ -78,7 +82,7 @@ ipython_savefig_dir = os.path.join(os.path.dirname(__file__), '_static') # General information about the project. -project = 'psyplot_gui' +project = 'psyplot-gui' copyright = psyplot_gui.__copyright__ author = psyplot_gui.__author__ @@ -87,7 +91,7 @@ # built documents. # # The short X.Y version. -version = re.match('\d+\.\d+\.\d+', psyplot_gui.__version__).group() +version = re.match(r'\d+\.\d+\.\d+', psyplot_gui.__version__).group() # The full version, including alpha/beta/rc tags. release = psyplot_gui.__version__ @@ -140,7 +144,7 @@ # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - (master_doc, 'psyplot_gui.tex', u'psyplot GUI Documentation', + (master_doc, 'psyplot-gui.tex', u'psyplot GUI Documentation', author, 'manual'), ] @@ -149,7 +153,7 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - (master_doc, 'psyplot_gui', u'psyplot GUI Documentation', + (master_doc, 'psyplot-gui', u'psyplot GUI Documentation', [author], 1) ] @@ -159,8 +163,8 @@ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - (master_doc, 'psyplot_gui', 'psyplot GUI Documentation', - author, 'psyplot_gui', 'Graphical user interface for the psyplot package', + (master_doc, 'psyplot-gui', u'psyplot GUI Documentation', + author, 'psyplot-gui', 'Graphical user interface for the psyplot package', 'Visualization'), ] diff --git a/psyplot_gui/help_explorer.py b/psyplot_gui/help_explorer.py index 80f51a7..8d2c719 100644 --- a/psyplot_gui/help_explorer.py +++ b/psyplot_gui/help_explorer.py @@ -27,7 +27,7 @@ from tempfile import mkdtemp try: from sphinx.application import Sphinx - from sphinx.util import get_module_source + from sphinx.pycode import ModuleAnalyzer try: from psyplot.sphinxext.extended_napoleon import ( ExtendedNumpyDocstring as NumpyDocstring, @@ -740,7 +740,7 @@ def is_importable(self, modname): bool True if sphinx can import the module""" try: - get_module_source(modname) + ModuleAnalyzer.get_module_source(modname) return True except Exception: return False diff --git a/psyplot_gui/main.py b/psyplot_gui/main.py index 0b83ad1..35c3789 100644 --- a/psyplot_gui/main.py +++ b/psyplot_gui/main.py @@ -788,7 +788,9 @@ def edit_preferences(self, exec_=None): widget = PrefPageClass(dlg) widget.initialize() dlg.add_page(widget) - available_width = 0.667 * QDesktopWidget().availableGeometry().width() + available_width = int( + 0.667*QDesktopWidget().availableGeometry().width() + ) width = dlg.sizeHint().width() height = dlg.sizeHint().height() # The preferences window should cover at least one third of the screen diff --git a/psyplot_gui/sphinx_supp/conf.py b/psyplot_gui/sphinx_supp/conf.py index 7fcbd70..f9d2d8a 100755 --- a/psyplot_gui/sphinx_supp/conf.py +++ b/psyplot_gui/sphinx_supp/conf.py @@ -44,7 +44,9 @@ extensions.append('sphinx.ext.intersphinx') del use_intersphinx -autodoc_default_flags = ['show_inheritance'] +autodoc_default_options = { + 'show_inheritance': True +} try: import autodocsumm @@ -52,7 +54,7 @@ pass else: extensions.append('autodocsumm') - autodoc_default_flags.append('autosummary') + autodoc_default_options['autosummary'] = True not_document_data = ['psyplot.config.rcsetup.defaultParams', 'psyplot.config.rcsetup.rcParams'] @@ -74,16 +76,16 @@ autoclass_content = 'both' # General information about the project. -project = u'Help' -copyright = u'2016, Philipp Sommer' -author = u'Philipp Sommer' +project = 'psyplot Help' +copyright = psyplot_gui.__copyright__ +author = psyplot_gui.__author__ # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = re.match('\d+\.\d+\.\d+', psyplot_gui.__version__).group() +version = re.match(r'\d+\.\d+\.\d+', psyplot_gui.__version__).group() # The full version, including alpha/beta/rc tags. release = psyplot_gui.__version__ # diff --git a/setup.py b/setup.py index 5ae13f1..a5d33be 100644 --- a/setup.py +++ b/setup.py @@ -58,7 +58,7 @@ def run_tests(self): 'psyplot>=1.3.0', 'qtconsole', 'fasteners', - 'sphinx', + 'sphinx>=2.4.0', 'sphinx_rtd_theme', ], package_data={'psyplot_gui': [ diff --git a/tests/test_console.py b/tests/test_console.py index b0a532a..22dccf9 100644 --- a/tests/test_console.py +++ b/tests/test_console.py @@ -56,7 +56,7 @@ def _test_object_docu(self, symbol): self.insert_text('object') QTest.keyClicks(c._control, symbol) sig = '' if six.PY2 else re.sub( - '^\(\s*self,\s*', '(', str(signature(object.__init__))) + r'^\(\s*self,\s*', '(', str(signature(object.__init__))) header = "object" + sig bars = '=' * len(header) self.assertEqual( diff --git a/tests/test_dataframeeditor.py b/tests/test_dataframeeditor.py index f67cbae..af45f00 100644 --- a/tests/test_dataframeeditor.py +++ b/tests/test_dataframeeditor.py @@ -6,7 +6,7 @@ import numpy as np import _base_testing as bt import unittest -from pandas.util.testing import assert_frame_equal +from pandas.testing import assert_frame_equal from psyplot_gui.compat.qtcompat import Qt, QApplication diff --git a/tests/test_plot_creator.py b/tests/test_plot_creator.py index c53dc43..18f4ddc 100644 --- a/tests/test_plot_creator.py +++ b/tests/test_plot_creator.py @@ -12,6 +12,20 @@ asstring) +def get_col_num(ax): + try: + return ax.get_subplotspec().colspan.start + except AttributeError: # matplotlib<3.2 + return ax.colNum + + +def get_row_num(ax): + try: + return ax.get_subplotspec().rowspan.start + except AttributeError: # matplotlib<3.2 + return ax.rowNum + + class PlotCreatorTest(bt.PsyPlotGuiTestCase): """Tests concerning the plot creator""" @@ -147,8 +161,8 @@ def test_add_subplots(self): self.assertEqual([ax.numRows for ax in axes], [2] * nvar) rows = [0, 0, 1] * nfigs cols = [0, 1, 0] * nfigs - self.assertEqual([ax.rowNum for ax in axes], rows) - self.assertEqual([ax.colNum for ax in axes], cols) + self.assertEqual([get_row_num(ax) for ax in axes], rows) + self.assertEqual([get_col_num(ax) for ax in axes], cols) fig_nums = list(chain(*([i] * 3 for i in range(1, nfigs + 1)))) self.assertEqual([ax.get_figure().number for ax in axes], fig_nums) plt.close('all') @@ -170,8 +184,8 @@ def test_add_single_subplots(self): # test rows, cols and figure numbers self.assertEqual([ax.numCols for ax in axes], [2] * nvar) self.assertEqual([ax.numRows for ax in axes], [2] * nvar) - self.assertEqual([ax.rowNum for ax in axes], [0] * nvar) - self.assertEqual([ax.colNum for ax in axes], [1] * nvar) + self.assertEqual([get_row_num(ax) for ax in axes], [0] * nvar) + self.assertEqual([get_col_num(ax) for ax in axes], [1] * nvar) self.assertEqual([ax.get_figure().number for ax in axes], list( range(1, nvar + 1))) plt.close('all') @@ -203,8 +217,8 @@ def test_axescreator_subplots(self): # test rows, cols and figure numbers self.assertEqual([ax.numCols for ax in axes], [2] * nvar) self.assertEqual([ax.numRows for ax in axes], [2] * nvar) - self.assertEqual([ax.rowNum for ax in axes], [0] * nvar) - self.assertEqual([ax.colNum for ax in axes], [1] * nvar) + self.assertEqual([get_row_num(ax) for ax in axes], [0] * nvar) + self.assertEqual([get_col_num(ax) for ax in axes], [1] * nvar) self.assertEqual([ax.get_figure().number for ax in axes], list( range(1, nvar + 1))) # close figures