diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..2177f3b --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,180 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "gettext - Scan", + "type": "shell", + "command": "cmd", + "args": [ + "/c", + "gettext.bat", + "rescan", + ], + "options": { + "cwd": "scripts", + "env": { + "UNATTENDED": "1", + "PYTHONUTF8": "1", + "PYTHON": "${env:PPSTACK_PYTHONEXE}", + } + }, + "group": { + "kind": "build", + "isDefault": true + }, + "presentation": { + "echo": true, + "reveal": "always", + "focus": false, + "panel": "shared", + "showReuseMessage": true, + "clear": false + } + }, + { + "label": "gettext - Compile", + "type": "shell", + "command": "cmd", + "args": [ + "/c", + "gettext.bat", + "compile", + ], + "options": { + "cwd": "scripts", + "env": { + "UNATTENDED": "1", + "PYTHON": "${env:PPSTACK_PYTHONEXE}", + } + }, + "group": { + "kind": "build", + "isDefault": true + }, + "presentation": { + "echo": true, + "reveal": "always", + "focus": false, + "panel": "shared", + "showReuseMessage": true, + "clear": false + } + }, + { + "label": "Run Pylint", + "type": "shell", + "command": "cmd", + "args": [ + "/c", + "run_pylint.bat", + // "--disable=R0801,C0103,C0114,C0115,C0116,W0612,W0613", + "--disable=fixme,C,R,W", + ], + "options": { + "cwd": "scripts", + "env": { + "UNATTENDED": "1", + "PYTHON": "${env:PPSTACK_PYTHONEXE}", + } + }, + "group": { + "kind": "build", + "isDefault": true + }, + "presentation": { + "echo": true, + "reveal": "always", + "focus": false, + "panel": "dedicated", + "showReuseMessage": true, + "clear": true + } + }, + { + "label": "Clean Up", + "type": "shell", + "command": "cmd", + "args": [ + "/c", + "clean_up.bat" + ], + "options": { + "cwd": "scripts", + }, + "group": { + "kind": "build", + "isDefault": true + }, + "presentation": { + "echo": true, + "reveal": "always", + "focus": false, + "panel": "shared", + "showReuseMessage": true, + "clear": false + } + }, + { + "label": "Build documentation", + "type": "shell", + "command": "cmd", + "options": { + "cwd": "scripts", + "env": { + "PYTHON": "${env:PPSTACK_PYTHONEXE}", + "UNATTENDED": "1", + } + }, + "args": [ + "/c", + "build_doc.bat" + ], + "problemMatcher": [], + "group": { + "kind": "build", + "isDefault": true + }, + "presentation": { + "echo": true, + "reveal": "always", + "focus": false, + "panel": "shared", + "showReuseMessage": true, + "clear": true + } + }, + { + "label": "Build all wheels", + "type": "shell", + "command": "cmd", + "options": { + "cwd": "scripts", + "env": { + "PYTHON": "${env:PPSTACK_PYTHONEXE}", + "UNATTENDED": "1", + } + }, + "args": [ + "/c", + "build_wheels.bat" + ], + "problemMatcher": [], + "group": { + "kind": "build", + "isDefault": true + }, + "presentation": { + "echo": true, + "reveal": "always", + "focus": false, + "panel": "shared", + "showReuseMessage": true, + "clear": true + }, + "dependsOrder": "sequence", + "dependsOn": [ + "Clean Up", + ] + } + ] +} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 409fd6b..f7dcd0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # guiqwt Releases # +## Version 4.4.5 ## + +Added warning regarding package obsolescence. +[PlotPy](https://github.com/PlotPyStack/plotpy) is the new version of guiqwt. + ## Version 4.4.4 ## Added compatibility with Python 3.12. diff --git a/README.md b/README.md index 002d8a6..54eac7f 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,9 @@ -guiqwt will soon be replaced by [plotpy](https://github.com/PlotPyStack/plotpy) which is a complete rewrite of the library, under more permissive license terms (BSD) with a lot of improvements (automatic test suite with ~70% test coverage, unified curve/image ready-to-use widgets, new documentation, ...). +guiqwt has been replaced by [PlotPy](https://github.com/PlotPyStack/plotpy) which is a complete rewrite of the library, under more permissive license terms (BSD) with a lot of improvements (automatic test suite with ~70% test coverage, unified curve/image ready-to-use widgets, new documentation, ...). +We strongly recommend to use PlotPy instead of guiqwt. First, because guiqwt is not maintained anymore and second, because PlotPy is far more robust and tested. +Moreover, you can easily migrate your existing guiqwt-based code to PlotPy thanks to the [migration guide](https://plotpy.readthedocs.io/en/latest/dev/guiqwt_to_plotpy.html). ------ diff --git a/doc/images/plotpy-banner.png b/doc/images/plotpy-banner.png new file mode 100644 index 0000000..cc3293b Binary files /dev/null and b/doc/images/plotpy-banner.png differ diff --git a/doc/index.rst b/doc/index.rst index df0f9f4..e864987 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -1,25 +1,10 @@ .. automodule:: guiqwt -.. only:: html and not htmlhelp - - .. note:: - - Windows users may download the :download:`CHM Manual <../guiqwt.chm.zip>`. - - After downloading this file, you may see blank pages in the documentation. - That's because Windows is blocking CHM files for security reasons. - Fixing this problem is easy: - - * Right-click the CHM file, select properties, then click “Unblock”. - * Or compress the CHM file into a zip archive and decompress it in - another directory. - * Do not open the CHM file on a network drive. - Contents: .. toctree:: :maxdepth: 2 - + overview installation migrating_from_v2_to_v3 @@ -28,7 +13,7 @@ Contents: disthelpers reference/index development - + Indices and tables: diff --git a/guiqwt/__init__.py b/guiqwt/__init__.py index f55f8cb..6fcd633 100644 --- a/guiqwt/__init__.py +++ b/guiqwt/__init__.py @@ -1,5 +1,22 @@ # -*- coding: utf-8 -*- """ +.. warning:: + + *guiqwt* has been replaced by a new package called `PlotPy`_, which is a complete + rewrite of the library, under more permissive license terms (BSD) with a lot of + improvements (automatic test suite with ~70% test coverage, unified curve/image + ready-to-use widgets, new documentation, ...). + +.. figure:: images/plotpy-banner.png + :align: center + + We strongly recommend to use `PlotPy`_ instead of guiqwt. First, because guiqwt is + not maintained anymore and second, because `PlotPy`_ is far more robust and tested. + Moreover, you can easily migrate your existing guiqwt-based code to `PlotPy`_ + thanks to the `migration guide `_. + +.. _PlotPy: https://github.com/PlotPyStack/plotpy + guiqwt ====== @@ -23,16 +40,24 @@ """ -__version__ = "4.4.4" # Update here *AND* in setup.py! +__version__ = "4.4.5" # Update here *AND* in setup.py! # (Until setup.py has been fully retrofitted, this manual sync is mandatory) def about(html=True, copyright_only=False): """Return text about this package""" - import sys, os, os.path as osp, platform, guidata, guiqwt, qwt - from guiqwt.config import _ + import os + import os.path as osp + import platform + import sys + + import guidata + import qwt from qtpy import QtCore as QC + import guiqwt + from guiqwt.config import _ + name = __file__.split(osp.sep)[-2] tf1 = ( name, @@ -599,3 +624,11 @@ def about(html=True, copyright_only=False): # # # Version 2.0 dated 2006-09-05. +# +# 13.2 Failing an amicable solution within two (2) months as from their +# occurrence, and unless emergency proceedings are necessary, the +# disagreements or disputes shall be referred to the Paris Courts having +# jurisdiction, by the more diligent Party. +# +# +# Version 2.0 dated 2006-09-05. diff --git a/scripts/build_dist.bat b/scripts/build_dist.bat new file mode 100644 index 0000000..e061c83 --- /dev/null +++ b/scripts/build_dist.bat @@ -0,0 +1,18 @@ +@echo off +REM This script was copied from PythonQwt project +REM ====================================================== +REM Package build script +REM ====================================================== +REM Licensed under the terms of the MIT License +REM Copyright (c) 2020 Pierre Raybaut +REM (see PythonQwt LICENSE file for more details) +REM ====================================================== +call %~dp0utils GetScriptPath SCRIPTPATH +call %FUNC% GetLibName LIBNAME +call %FUNC% GetModName MODNAME +call %FUNC% SetPythonPath +call %FUNC% UsePython +if exist MANIFEST ( del /q MANIFEST ) +%PYTHON% -m build +rmdir /s /q %LIBNAME%.egg-info +call %FUNC% EndOfScript \ No newline at end of file diff --git a/scripts/build_doc.bat b/scripts/build_doc.bat new file mode 100644 index 0000000..2f0e8ed --- /dev/null +++ b/scripts/build_doc.bat @@ -0,0 +1,20 @@ +@echo off +REM This script was copied from PythonQwt project +REM ====================================================== +REM Documentation build script +REM ====================================================== +REM Licensed under the terms of the MIT License +REM Copyright (c) 2020 Pierre Raybaut +REM (see PythonQwt LICENSE file for more details) +REM ====================================================== +setlocal +call %~dp0utils GetScriptPath SCRIPTPATH +call %FUNC% GetLibName LIBNAME +call %FUNC% GetModName MODNAME +call %FUNC% SetPythonPath +call %FUNC% UsePython +cd %SCRIPTPATH%\.. +%PYTHON% doc\update_requirements.py +sphinx-build -b html doc build\doc +start build\doc\index.html +call %FUNC% EndOfScript \ No newline at end of file diff --git a/scripts/build_inplace.bat b/scripts/build_inplace.bat new file mode 100644 index 0000000..8afb285 --- /dev/null +++ b/scripts/build_inplace.bat @@ -0,0 +1,36 @@ +@echo off +REM This script was copied from PythonQwt project +REM ====================================================== +REM Package build script +REM ====================================================== +REM Licensed under the terms of the MIT License +REM Copyright (c) 2020 Pierre Raybaut +REM (see PythonQwt LICENSE file for more details) +REM ====================================================== +setlocal enabledelayedexpansion +call %~dp0utils GetScriptPath SCRIPTPATH +call %FUNC% GetModName MODNAME +call %FUNC% SetPythonPath + +if exist MANIFEST ( del /q MANIFEST ) +:: Iterate over all directories in the grandparent directory +:: (WinPython base directories) +call %FUNC% GetPythonExeGrandParentDir DIR0 +for /D %%d in ("%DIR0%*") do ( + :: Get the directory name without the path + for %%n in (%%d) do set "DIRNAME=%%~nxn" + + :: Check if the directory ends with "-PyQt6" or "-PySide6" + if not "!DIRNAME:~-6!"=="-PyQt6" ( + if not "!DIRNAME:~-8!"=="-PySide6" ( + set WINPYDIRBASE=%%d + call !WINPYDIRBASE!\scripts\env.bat + echo ****************************************************************************** + echo Building %MODNAME% from "%%d" + echo ****************************************************************************** + python setup.py build_ext --inplace + echo ---- + ) + ) +) +call %FUNC% EndOfScript \ No newline at end of file diff --git a/scripts/build_wheels.bat b/scripts/build_wheels.bat new file mode 100644 index 0000000..abb3257 --- /dev/null +++ b/scripts/build_wheels.bat @@ -0,0 +1,38 @@ +@echo off +REM This script was copied from PythonQwt project +REM ====================================================== +REM Package build script +REM ====================================================== +REM Licensed under the terms of the MIT License +REM Copyright (c) 2020 Pierre Raybaut +REM (see PythonQwt LICENSE file for more details) +REM ====================================================== +setlocal enabledelayedexpansion +call %~dp0utils GetScriptPath SCRIPTPATH +call %FUNC% GetModName MODNAME +call %FUNC% SetPythonPath + +if exist MANIFEST ( del /q MANIFEST ) +:: Iterate over all directories in the grandparent directory +:: (WinPython base directories) +call %FUNC% GetPythonExeGrandParentDir DIR0 +for /D %%d in ("%DIR0%*") do ( + :: Get the directory name without the path + for %%n in (%%d) do set "DIRNAME=%%~nxn" + + :: Check if the directory ends with "-PyQt6" or "-PySide6" + if not "!DIRNAME:~-6!"=="-PyQt6" ( + if not "!DIRNAME:~-8!"=="-PySide6" ( + set WINPYDIRBASE=%%d + set OLD_PATH=!PATH! + call !WINPYDIRBASE!\scripts\env.bat + echo ****************************************************************************** + echo Building %MODNAME% from "%%d" + echo ****************************************************************************** + python setup.py build bdist_wheel + echo ---- + set PATH=!OLD_PATH! + ) + ) +) +call %FUNC% EndOfScript \ No newline at end of file diff --git a/scripts/clean_up.bat b/scripts/clean_up.bat new file mode 100644 index 0000000..263c885 --- /dev/null +++ b/scripts/clean_up.bat @@ -0,0 +1,43 @@ +@echo off +REM This script was copied from PythonQwt project +REM ====================================================== +REM Clean up repository +REM ====================================================== +REM Licensed under the terms of the MIT License +REM Copyright (c) 2020 Pierre Raybaut +REM (see PythonQwt LICENSE file for more details) +REM ====================================================== +call %~dp0utils GetScriptPath SCRIPTPATH +call %FUNC% GetLibName LIBNAME +cd %SCRIPTPATH%\..\ + +@REM Removing files/directories related to Python/doc build process +if exist %LIBNAME%.egg-info ( rmdir /s /q %LIBNAME%.egg-info ) +if exist %LIBNAME%\%LIBNAME%.chm ( del /q %LIBNAME%\%LIBNAME%.chm ) +if exist MANIFEST ( del /q MANIFEST ) +if exist build ( rmdir /s /q build ) +if exist dist ( rmdir /s /q dist ) +if exist doc\_build ( rmdir /s /q doc\_build ) + +@REM Removing files produced by tests +del *.png +del *.tif +del *.pickle + +@REM Removing cache files/directories related to Python execution +del /s /q *.pyc 1>nul 2>&1 +del /s /q *.pyo 1>nul 2>&1 +FOR /d /r %%d IN ("__pycache__") DO @IF EXIST "%%d" rd /s /q "%%d" + +@REM Removing directories related to public repository upload +set TEMP=%SCRIPTPATH%\..\..\%LIBNAME%_temp +set PUBLIC=%SCRIPTPATH%\..\..\%LIBNAME%_public +if exist %TEMP% ( rmdir /s /q %TEMP% ) +if exist %PUBLIC% ( rmdir /s /q %PUBLIC% ) + +@REM Removing files/directories related to Coverage +if exist .coverage ( del /q .coverage ) +if exist coverage.xml ( del /q coverage.xml ) +if exist htmlcov ( rmdir /s /q htmlcov ) +del /q .coverage.* 1>nul 2>&1 +if exist sitecustomize.py ( del /q sitecustomize.py ) \ No newline at end of file diff --git a/scripts/gettext.bat b/scripts/gettext.bat new file mode 100644 index 0000000..a647966 --- /dev/null +++ b/scripts/gettext.bat @@ -0,0 +1,16 @@ +@echo off +REM This script was derived from PythonQwt project +REM ====================================================== +REM Run gettext translation tool +REM ====================================================== +REM Licensed under the terms of the MIT License +REM Copyright (c) 2020 Pierre Raybaut +REM (see PythonQwt LICENSE file for more details) +REM ====================================================== +setlocal +call %~dp0utils GetScriptPath SCRIPTPATH +call %FUNC% SetPythonPath +call %FUNC% UsePython +call %FUNC% GetModName MODNAME +%PYTHON% -c "from guidata.utils.gettext_helpers import do_%1; do_%1('%MODNAME%')" +call %FUNC% EndOfScript \ No newline at end of file diff --git a/scripts/run_pylint.bat b/scripts/run_pylint.bat new file mode 100644 index 0000000..dead4b2 --- /dev/null +++ b/scripts/run_pylint.bat @@ -0,0 +1,17 @@ +@echo off +REM This script was derived from PythonQwt project +REM ====================================================== +REM Run pylint analysis +REM ====================================================== +REM Licensed under the terms of the MIT License +REM Copyright (c) 2020 Pierre Raybaut +REM (see PythonQwt LICENSE file for more details) +REM ====================================================== +setlocal +call %~dp0utils GetScriptPath SCRIPTPATH +call %FUNC% GetModName MODNAME +call %FUNC% SetPythonPath +set PYLINT_ARG=%* +if "%PYLINT_ARG%"=="" set PYLINT_ARG=--disable=fixme +%PYTHON% -m pylint --rcfile=%SCRIPTPATH%\..\.pylintrc %PYLINT_ARG% %MODNAME% +call %FUNC% EndOfScript \ No newline at end of file diff --git a/scripts/utils.bat b/scripts/utils.bat new file mode 100644 index 0000000..4848b68 --- /dev/null +++ b/scripts/utils.bat @@ -0,0 +1,115 @@ +@echo off +set FUNC=%0 +call:%* +goto Exit + +REM ====================================================== +REM Utilities for deployment, test and build scripts +REM ====================================================== +REM Licensed under the terms of the MIT License +REM Copyright (c) 2020 Pierre Raybaut +REM (see LICENSE file for more details) +REM ====================================================== + +:GetScriptPath + set _tmp_=%~dp0 + if %_tmp_:~-1%==\ set %1=%_tmp_:~0,-1% + EXIT /B 0 + +:GetLibName + pushd %~dp0.. + for %%I in (.) do set %1=%%~nxI + popd + goto:eof + +:GetModName + pushd %~dp0.. + for /D %%I in (*) DO ( + if exist %%I\__init__.py ( + set %1=%%I + goto :found_module + ) + ) + :found_module + popd + goto:eof + +:GetVersion + call:GetModName MODNAME + call:SetPythonPath + echo import %MODNAME%;print(%MODNAME%.__version__) | python > _tmp_.txt + set /p %1=<_tmp_.txt + del _tmp_.txt + goto:eof + +:GetVersionWithoutAlphaBeta + call:GetModName MODNAME + call:SetPythonPath + echo import %MODNAME%;ver=%MODNAME%.__version__;print(ver.split("b")[0] if "b" in ver else ver.split("a")[0] if "a" in ver else ver) | python > _tmp_.txt + set /p %1=<_tmp_.txt + del _tmp_.txt + goto:eof + +:SetPythonPath + set ORIGINAL_PYTHONPATH=%PYTHONPATH% + cd %~dp0.. + for /F "tokens=*" %%A in (.env) do ( + set %%A + ) + set PYTHONPATH=%PYTHONPATH%;%ORIGINAL_PYTHONPATH% + goto:eof + +:GetPythonExeGrandParentDir + for %%i in (%PYTHON%) do set DIR2=%%~dpi + set DIR2=%DIR2:~0,-1% + for %%j in (%DIR2%) do set DIR1=%%~dpj + set DIR1=%DIR1:~0,-1% + for %%k in (%DIR1%) do set %1=%%~dpk + goto:eof + +:UsePython + if defined WINPYVER (goto:eof) + if not defined PYTHON (goto :nopython) + for %%a in ("%PYTHON%") do set "p_dir=%%~dpa" + if exist "%p_dir%\activate.bat" (goto :venvpython) + for %%a in (%p_dir:~0,-1%) do set "WINPYDIRBASE=%%~dpa" + if exist "%WINPYDIRBASE%\scripts\env.bat" (goto :nopython) + goto :python + :venvpython + call "%p_dir%\activate.bat" + call :ShowTitle "Using Python Virtual Environment from %p_dir%" + goto:eof + :python + set PATH=%p_dir%;%PATH% + call :ShowTitle "Using Python from %p_dir%" + goto:eof + :nopython + if defined WINPYDIRBASE ( + call %WINPYDIRBASE%\scripts\env.bat + call :ShowTitle "Using WinPython from %WINPYDIRBASE%" + ) else ( + echo Warning: WINPYDIRBASE environment variable is not defined, switching to system Python + echo ******** + echo (if nothing happens, that's probably because Python is not installed either: + echo please set the WINPYDIRBASE variable to select WinPython directory, or install Python) + ) + goto:eof + +:ShowTitle + @echo: + @echo ========= %~1 ========= + @echo: + goto:eof + +:EndOfScript + @echo: + @echo ********************************************************************************** + @echo: + if not defined UNATTENDED ( + @echo End of script + pause + ) + goto:eof + +:Exit +exit /b \ No newline at end of file diff --git a/setup.py b/setup.py index 85ea2a6..b690d0c 100644 --- a/setup.py +++ b/setup.py @@ -18,13 +18,14 @@ # Building extensions: # python setup.py build_ext -c mingw32 --inplace -import setuptools # analysis:ignore -import numpy -import sys import os import os.path as osp import subprocess +import sys from distutils.core import setup + +import numpy +import setuptools # analysis:ignore from setuptools import Extension @@ -234,7 +235,7 @@ def is_msvc(): setup( name=LIBNAME, - version="4.4.4", # Update here *AND* in __init__.py! + version="4.4.5", # Update here *AND* in __init__.py! # (Until setup.py has been fully retrofitted, this manual sync is mandatory) description=__description__, long_description=LONG_DESCRIPTION,