diff --git a/.github/workflows/compatibility.yml b/.github/workflows/compatibility.yml index 18b9dd6..bacf92c 100644 --- a/.github/workflows/compatibility.yml +++ b/.github/workflows/compatibility.yml @@ -36,7 +36,7 @@ jobs: - name: Run script run: | source venv/bin/activate - python scripts/compatibility-checker.py "git+https://github.com/PyMoDAQ/PyMoDAQ.git@${{ matrix.pymodaq-version }}" + python src/pymodaq_plugin_manager/compatibility_checker.py "git+https://github.com/PyMoDAQ/PyMoDAQ.git@${{ matrix.pymodaq-version }}" - name: Upload reports if failed if: failure() diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index cc1ffb5..68a46d5 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -8,24 +8,31 @@ on: types: [created] jobs: - deploy: + build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4.2.0 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5.2.0 with: - python-version: '3.x' + python-version: '3.11' - name: Install dependencies run: | python -m pip install --upgrade pip - pip install setuptools wheel twine toml - - name: Build and publish + pip install hatch hatchling + - name: Get history and tags for SCM versioning to work + run: | + git branch + git fetch --prune --unshallow + git fetch --depth=1 origin +refs/tags/*:refs/tags/* + hatch version + - name: Build + run: hatch build + - name: publish env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + HATCH_INDEX_USER: ${{ secrets.PYPI_USERNAME }} + HATCH_INDEX_AUTH: ${{ secrets.PYPI_PASSWORD }} run: | - python setup.py sdist bdist_wheel - twine upload dist/* + hatch publish diff --git a/README.md b/README.md index 4f0163a..a197900 100644 --- a/README.md +++ b/README.md @@ -1,51 +1,52 @@ -# PyMoDAQ Plugin Manager - -[](https://pypi.org/project/pymodaq_plugin_manager/) -[](https://pymodaq.readthedocs.io/en/stable/?badge=latest) -[](https://github.com/PyMoDAQ/pymodaq_plugin_manager) - - -A plugin manager for PyMoDAQ, Modular Data Acquisition with Python. - -Give a list of available, installable or updatable plugins compatible with pymodaq - -# PyMoDAQ Plugins -| Repo Name | Authors | Version plugin | Instruments | -| ------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Alcatel | | 1.1.0 | Viewer0D | -| Amplitude | | 0.1.1 | Viewer0D | -| Arduino | | 0.0.4 | Actuators | -| AvaSpec | | 0.1.2 | ActuatorsViewer0DViewer1DViewer2D | -| Basler | | 0.1.1 | ActuatorsViewer0DViewer1DViewer2D | -| Bnc | | 0.0.6 | ActuatorsViewer0DViewer1DViewer2D | -| Crystal_technology | | 0.0.1 | ActuatorsViewer0DViewer1DViewer2D | -| Femto | | 0.1.0 | Viewer1D | -| Flim | | 0.1.0 | ViewerND | -| Greateyes | | 1.0.2 | Viewer2D | -| Hamamatsu | | 0.3.0 | with pythonnet (Viewer1D).Viewer1DDCAM API with PyLabLib (Viewer2D) and Hamamatsu minispectrometers using .NET driverViewer2D | -| Hinds | | 0.0.3 | Actuators.. Viewer0D.. Viewer1D.. Viewer2D | -| Horiba | | 2.0.0 | Viewer1D | -| KDC101 | | 1.4.1 | ActuatorsViewer0DViewer1DViewer2D | -| Keithley | | 1.2.0 | Viewer0D | -| MozzaSpectro | | 0.1.1 | ActuatorsViewer0DViewer1DViewer2D | -| Newport | | 1.4.1 | Actuators | -| Nkt | | 1.0.0 | Actuators | -| Oceaninsight | | 1.1.1 | Viewer1D | -| Opencv | | 0.0.2 | Viewer2D | -| Optosigma | | 0.4.0 | Actuators | -| Physical_measurements | | 0.1.1 | Viewer0DViewer1DViewer2D | -| Physik_instrumente | | 1.2.0 | Actuators | -| Picoquant | | 0.1.0 | Viewer1D | -| Piezoconcept | | 1.1.0 | Actuators | -| Piezosystemjena | | 0.1.0 | Actuators | -| Princeton_instruments | | 0.1.0 | Viewer2D | -| Pylablib_camera | | 1.0.1 | Viewer2D | -| Raspberry | | 0.0.2 | Viewer2D | -| Redpitaya | | 0.0.3 | Viewer1D | -| Signal_recovery | | 0.1.0 | ActuatorsViewer0D | -| Smaract | | 2.0.4 | Actuators | -| Srs | | 0.0.2 | Viewer0D | -| Stellarnet | | 2.0.1 | Viewer1D | -| Tango | | 1.0.21 | ActuatorsViewer0DViewer1DViewer2D | -| Uniblitz | | 0.1.2 | Actuators | -| Zaber | | 2.0.2 | Actuators | +# PyMoDAQ Plugin Manager + +[](https://pypi.org/project/pymodaq_plugin_manager/) +[](https://pymodaq.readthedocs.io/en/stable/?badge=latest) +[](https://github.com/PyMoDAQ/pymodaq_plugin_manager) + + +A plugin manager for PyMoDAQ, Modular Data Acquisition with Python. + +Give a list of available, installable or updatable plugins compatible with pymodaq + + +# PyMoDAQ Plugins +| Repo Name | Authors | Version plugin | Instruments | +| ------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Alcatel | | 1.1.0 | Viewer0D | +| Amplitude | | 0.1.1 | Viewer0D | +| Arduino | | 0.0.4 | Actuators | +| AvaSpec | | 0.1.2 | ActuatorsViewer0DViewer1DViewer2D | +| Basler | | 0.1.1 | ActuatorsViewer0DViewer1DViewer2D | +| Bnc | | 0.0.6 | ActuatorsViewer0DViewer1DViewer2D | +| Crystal_technology | | 0.0.1 | ActuatorsViewer0DViewer1DViewer2D | +| Femto | | 0.1.0 | Viewer1D | +| Flim | | 0.1.0 | ViewerND | +| Greateyes | | 1.0.2 | Viewer2D | +| Hamamatsu | | 0.3.0 | with pythonnet (Viewer1D).Viewer1DDCAM API with PyLabLib (Viewer2D) and Hamamatsu minispectrometers using .NET driverViewer2D | +| Hinds | | 0.0.3 | Actuators.. Viewer0D.. Viewer1D.. Viewer2D | +| Horiba | | 2.0.0 | Viewer1D | +| KDC101 | | 1.4.1 | ActuatorsViewer0DViewer1DViewer2D | +| Keithley | | 1.2.0 | Viewer0D | +| MozzaSpectro | | 0.1.1 | ActuatorsViewer0DViewer1DViewer2D | +| Newport | | 1.4.1 | Actuators | +| Nkt | | 1.0.0 | Actuators | +| Oceaninsight | | 1.1.1 | Viewer1D | +| Opencv | | 0.0.2 | Viewer2D | +| Optosigma | | 0.4.0 | Actuators | +| Physical_measurements | | 0.1.1 | Viewer0DViewer1DViewer2D | +| Physik_instrumente | | 1.2.0 | Actuators | +| Picoquant | | 0.1.0 | Viewer1D | +| Piezoconcept | | 1.1.0 | Actuators | +| Piezosystemjena | | 0.1.0 | Actuators | +| Princeton_instruments | | 0.1.0 | Viewer2D | +| Pylablib_camera | | 1.0.1 | Viewer2D | +| Raspberry | | 0.0.2 | Viewer2D | +| Redpitaya | | 0.0.3 | Viewer1D | +| Signal_recovery | | 0.1.0 | ActuatorsViewer0D | +| Smaract | | 2.0.4 | Actuators | +| Srs | | 0.0.2 | Viewer0D | +| Stellarnet | | 2.0.1 | Viewer1D | +| Tango | | 1.0.21 | ActuatorsViewer0DViewer1DViewer2D | +| Uniblitz | | 0.1.2 | Actuators | +| Zaber | | 2.0.2 | Actuators | diff --git a/__init__.py b/__init__.py deleted file mode 100644 index b28b04f..0000000 --- a/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..ad8e82a --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,66 @@ +[build-system] +requires = ["hatchling>=1.9.0", "hatch-vcs", "toml"] +build-backend = "hatchling.build" + +[project] +name = "pymodaq_plugin_manager" +dynamic = [ + "version", +] +description = "Manager and interface to list, install or remove PyMoDAQ's plugins" +readme = "README_base.md" +license = { file="LICENSE" } +requires-python = ">=3.9" +authors = [ + { name = "Sébastien Weber", email = "sebastien.weber@cemes.fr" }, +] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Other Environment", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: MIT License", + "Natural Language :: English", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Scientific/Engineering :: Human Machine Interfaces", + "Topic :: Scientific/Engineering :: Visualization", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Software Development :: User Interfaces", +] + +dependencies = [ + 'pymodaq', + 'distlib', + 'jsonschema', + 'pytablewriter', + 'requests', + 'yawrap', + 'lxml', + 'readme_renderer', + 'chardet', + 'packaging' +] + + +[project.urls] +Homepage = "http://pymodaq.cnrs.fr" +Source = "https://github.com/PyMoDAQ/pymodaq_plugins_manager" +Tracker = "https://github.com/PyMoDAQ/pymodaq_plugins_manager/issues" + +[tool.hatch.version] +source = "vcs" +fallback-version = '1.2.4' + +[tool.hatch.build.targets.sdist] +include = [ + "/src", +] + + +[project.scripts] +plugin_manager = 'pymodaq_plugin_manager.manager:main' +write_plugins_doc = 'pymodaq_plugin_manager.validate:write_plugin_doc' +plugin_checker = 'pymodaq_plugin_manager.compatibility_checker:main' diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 29bba12..0000000 --- a/requirements.txt +++ /dev/null @@ -1,9 +0,0 @@ -chardet -distlib -jsonschema -pytablewriter -requests -yawrap -lxml -readme_renderer -packaging diff --git a/setup.py b/setup.py index 8421c2a..63a9bfa 100644 --- a/setup.py +++ b/setup.py @@ -45,6 +45,9 @@ 'yawrap', 'lxml', 'readme_renderer', + 'chardet', + 'packaging' + ], **setupOpts ) diff --git a/src/pymodaq_plugin_manager/VERSION b/src/pymodaq_plugin_manager/VERSION deleted file mode 100644 index e8ea05d..0000000 --- a/src/pymodaq_plugin_manager/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.2.4 diff --git a/src/pymodaq_plugin_manager/__init__.py b/src/pymodaq_plugin_manager/__init__.py index 4394b44..9fdabf2 100644 --- a/src/pymodaq_plugin_manager/__init__.py +++ b/src/pymodaq_plugin_manager/__init__.py @@ -1,7 +1,4 @@ -import json -from pathlib import Path -base_path = Path(__file__).parent +from pymodaq_utils.utils import get_version -with open(str(Path(__file__).parent.joinpath('VERSION')), 'r') as fvers: - __version__ = fvers.read().strip() +__version__ = get_version('pymodaq_plugin_manager') diff --git a/scripts/compatibility-checker.py b/src/pymodaq_plugin_manager/compatibility_checker.py similarity index 97% rename from scripts/compatibility-checker.py rename to src/pymodaq_plugin_manager/compatibility_checker.py index af0ecb2..6c421f2 100644 --- a/scripts/compatibility-checker.py +++ b/src/pymodaq_plugin_manager/compatibility_checker.py @@ -7,9 +7,8 @@ import importlib import argparse +from pymodaq_plugin_manager.validate import get_pypi_plugins -from pymodaq_plugin_manager.utils import get_pymodaq_version -from pymodaq_plugin_manager.validate import get_plugins, get_pypi_pymodaq, get_package_metadata, get_pypi_plugins def _detect_encoding(filename): ''' @@ -28,6 +27,7 @@ def _detect_encoding(filename): raw = f.read() return chardet.detect(raw)['encoding'] + class PyMoDAQPlugin: ''' A simple class to represent a PyMoDAQ plugin, from a `pip install` @@ -115,6 +115,7 @@ def all_imports_valid(self) -> bool: return len(self._failed_imports) == 0 + def parse_args(): parser = argparse.ArgumentParser(description="Detect incompatibilities between a PyMoDAQ version and the released plugins") parser.add_argument("-r", type=Path, default=Path("reports/"), dest="reports_path", help="Path to the reports folder (default: reports/)") @@ -123,6 +124,7 @@ def parse_args(): return parser.parse_args() + def main(): ''' The script use `get_pypi_plugins` function to get a list of all PyMoDAQ plugins. @@ -156,5 +158,7 @@ def main(): plugin.save_install_report() code = 1 sys.exit(code) + + if __name__ == '__main__': main() diff --git a/src/pymodaq_plugin_manager/validate.py b/src/pymodaq_plugin_manager/validate.py index 7a0cc20..7d7c62f 100644 --- a/src/pymodaq_plugin_manager/validate.py +++ b/src/pymodaq_plugin_manager/validate.py @@ -190,14 +190,14 @@ def get_pypi_plugins(browse_pypi=True, pymodaq_version: Union[Version, str] = No exclude_plugins = ['pymodaq_plugins', 'pymodaq_plugins_orsay', 'pymodaq_plugins_template', - 'pymodaq_plugins_KDC101', + 'pymodaq_plugins_KDC101', #should not exists on its own but should be incorporated into thorlabs 'pymodaq_plugins_AvaSpec', - 'pymodaq_plugins_MozzaSpectro' + 'pymodaq_plugins_MozzaSpectro', ] packages = get_pypi_package_list('pymodaq-plugins', print_method=print_method) pymodaq_latest = Version(get_pypi_pymodaq('pymodaq')['version']) for package in packages: - if package not in exclude_plugins: + if package.replace('-', '_') not in exclude_plugins: print_method(f'Fetching metadata for package {package}') metadata = get_pypi_pymodaq(package, pymodaq_version, pymodaq_latest) if metadata is not None: