From ff9d16c0caa9a05de3f2c89dce4325f261c52119 Mon Sep 17 00:00:00 2001 From: "Philipp S. Sommer" Date: Sat, 26 Sep 2020 19:38:46 +0200 Subject: [PATCH 1/6] ignore .mypy_cache --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 8b22363..875a53c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,9 @@ __pycache__/ # C extensions *.so +# mypy cache +.mypy_cache + # Distribution / packaging .Python env/ From 14957a45dc561d51eb65ab536b58cef2af7004f3 Mon Sep 17 00:00:00 2001 From: "Philipp S. Sommer" Date: Sat, 26 Sep 2020 20:12:49 +0200 Subject: [PATCH 2/6] Require sphinx>=2.4.0 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 46d7dc4..4490aef 100644 --- a/setup.py +++ b/setup.py @@ -55,7 +55,7 @@ def run_tests(self): 'psyplot>=1.3.0', 'qtconsole', 'fasteners', - 'sphinx', + 'sphinx>=2.4.0', 'sphinx_rtd_theme', ], package_data={'psyplot_gui': [ From ac241d96bfc4a0fe5c5bd79561b61ff9752a45df Mon Sep 17 00:00:00 2001 From: "Philipp S. Sommer" Date: Sat, 26 Sep 2020 20:12:59 +0200 Subject: [PATCH 3/6] add more metadata --- docs/conf.py | 24 ++++++++++++++---------- psyplot_gui/__init__.py | 10 +++++++++- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index bc6c148..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,16 +82,16 @@ ipython_savefig_dir = os.path.join(os.path.dirname(__file__), '_static') # General information about the project. -project = u'psyplot_gui' -copyright = u'2016, Philipp Sommer' -author = u'Philipp Sommer' +project = 'psyplot-gui' +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__ @@ -140,8 +144,8 @@ # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - (master_doc, 'psyplot_gui.tex', u'psyplot GUI Documentation', - u'Philipp Sommer', 'manual'), + (master_doc, 'psyplot-gui.tex', u'psyplot GUI Documentation', + author, 'manual'), ] # -- Options for manual page output --------------------------------------- @@ -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', u'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/__init__.py b/psyplot_gui/__init__.py index 2f6cea7..cf418ac 100644 --- a/psyplot_gui/__init__.py +++ b/psyplot_gui/__init__.py @@ -27,7 +27,15 @@ from psyplot.compat.pycompat import get_default_value -__author__ = "Philipp Sommer (philipp.sommer@unil.ch)" +__author__ = "Philipp S. Sommer" +__copyright__ = "Copyright 2016 - 2020, Philipp S. Sommer" +__credits__ = ["Philipp S. Sommer"] +__license__ = "GPL-2.0-only" + +__maintainer__ = "Philipp S. Sommer" +__email__ = "philipp.sommer@hzg.de" + +__status__ = "Production" logger = logging.getLogger(__name__) logger.debug( From e802d7b320aaac9c145a84d761f171600f66ef32 Mon Sep 17 00:00:00 2001 From: "Philipp S. Sommer" Date: Sat, 26 Sep 2020 20:35:44 +0200 Subject: [PATCH 4/6] resolve depreceations --- psyplot_gui/help_explorer.py | 4 ++-- psyplot_gui/main.py | 4 +++- psyplot_gui/sphinx_supp/conf.py | 14 ++++++++------ tests/test_console.py | 2 +- tests/test_dataframeeditor.py | 2 +- tests/test_plot_creator.py | 26 ++++++++++++++++++++------ 6 files changed, 35 insertions(+), 17 deletions(-) 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 a32c919..c951f49 100755 --- a/psyplot_gui/sphinx_supp/conf.py +++ b/psyplot_gui/sphinx_supp/conf.py @@ -37,7 +37,9 @@ extensions.append('sphinx.ext.intersphinx') del use_intersphinx -autodoc_default_flags = ['show_inheritance'] +autodoc_default_options = { + 'show_inheritance': True +} try: import autodocsumm @@ -45,7 +47,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'] @@ -67,16 +69,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/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 From 0c58e555676f401086f1c7e82c31a0f41c1b4290 Mon Sep 17 00:00:00 2001 From: "Philipp S. Sommer" Date: Mon, 28 Sep 2020 18:17:31 +0200 Subject: [PATCH 5/6] require psyplot>=1.3.0 --- ci/conda-recipe/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/conda-recipe/meta.yaml b/ci/conda-recipe/meta.yaml index f1fe8eb..6b6637a 100644 --- a/ci/conda-recipe/meta.yaml +++ b/ci/conda-recipe/meta.yaml @@ -19,7 +19,7 @@ requirements: - pip run: - python - - psyplot >=1.2.0 + - psyplot >=1.3.0 - pyqt >=5 - qtconsole - fasteners From 7a406d549f12435c0720bc6f3ad3e1069cd13fbb Mon Sep 17 00:00:00 2001 From: "Philipp S. Sommer" Date: Mon, 28 Sep 2020 20:23:32 +0200 Subject: [PATCH 6/6] Revert jupyter_client restriction i.e. c8e50da3933b25f7009ca8170831613d9f4a6a4c --- ci/conda-recipe/meta.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/ci/conda-recipe/meta.yaml b/ci/conda-recipe/meta.yaml index 6b6637a..d16c44c 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: