diff --git a/.github/workflows/Test.yml b/.github/workflows/Test.yml index 720d4db..ffd1522 100644 --- a/.github/workflows/Test.yml +++ b/.github/workflows/Test.yml @@ -6,5 +6,5 @@ jobs: call_workflow: uses: ./.github/workflows/Testbase.yml with: - python: '3.10' + python: '3.11' qt5: 'pyqt5' \ No newline at end of file diff --git a/.github/workflows/Testbase.yml b/.github/workflows/Testbase.yml index ed4517b..989a2a0 100644 --- a/.github/workflows/Testbase.yml +++ b/.github/workflows/Testbase.yml @@ -18,7 +18,7 @@ jobs: QT_DEBUG_PLUGINS: 1 steps: - name: Set up Python ${{ inputs.python }} - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install dependencies uses: actions/setup-python@v4 with: @@ -29,7 +29,7 @@ jobs: python -m pip install --upgrade pip export QT_DEBUG_PLUGINS=1 pip install flake8 pytest pytest-cov pytest-qt pytest-xdist pytest-xvfb setuptools wheel numpy h5py ${{ inputs.qt5 }} toml - pip install pymodaq + pip install pymodaq pyqt5 pip install -e . - name: create local pymodaq folder and setting permissions run: | diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index a9d2f56..69806c5 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -17,22 +17,24 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: '3.11' + python-version: '3.x' - name: Install dependencies run: | python -m pip install --upgrade pip - pip install setuptools wheel twine toml "pymodaq>=4.1.0" pyqt5 - - - name: create local pymodaq folder and setting permissions + pip install hatch hatchling toml twine + - name: Get history and tags for SCM versioning to work run: | - sudo mkdir /etc/.pymodaq - sudo chmod uo+rw /etc/.pymodaq - - - name: Build and publish + git branch + git fetch --prune --unshallow + git fetch --depth=1 origin +refs/tags/*:refs/tags/* + hatch version + - name: Build + run: hatch build + - name: Check the build + run: twine check dist/* + - 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 check dist/* - twine upload dist/* + hatch publish diff --git a/.github/workflows/updater.yml b/.github/workflows/updater.yml new file mode 100644 index 0000000..a80cc91 --- /dev/null +++ b/.github/workflows/updater.yml @@ -0,0 +1,23 @@ +name: GitHub Actions Version Updater + +# Controls when the action will run. +on: + schedule: + # Automatically run at 00:00 on day-of-month 5. + - cron: '0 0 5 * *' + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + # [Required] Access token with `workflow` scope. + token: ${{ secrets.WORKFLOW_SECRET }} + + - name: Run GitHub Actions Version Updater + uses: saadmk11/github-actions-version-updater@v0.8.1 + with: + # [Required] Access token with `workflow` scope. + token: ${{ secrets.WORKFLOW_SECRET }} \ No newline at end of file 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/hatch_build.py b/hatch_build.py new file mode 100644 index 0000000..a0208ee --- /dev/null +++ b/hatch_build.py @@ -0,0 +1,10 @@ +from pathlib import Path +from hatchling.metadata.plugin.interface import MetadataHookInterface +from pymodaq_utils.resources.hatch_build_plugins import update_metadata_from_toml + +here = Path(__file__).absolute().parent + + +class PluginInfoTomlHook(MetadataHookInterface): + def update(self, metadata: dict) -> None: + update_metadata_from_toml(metadata, here) diff --git a/plugin_info.toml b/plugin_info.toml deleted file mode 100644 index 858338a..0000000 --- a/plugin_info.toml +++ /dev/null @@ -1,25 +0,0 @@ -[plugin-info] -SHORT_PLUGIN_NAME = 'basler' - -package-url = 'https://github.com/BenediktBurger/pymodaq_plugins_basler' -description = 'PyMoDAQ plugins for cameras of Basler' - -author = 'Benedikt Burger' -author-email = "Benedikt.Burger@physik.tu-darmstadt.de" -license = 'MIT' - -[plugin-install] -#packages required for your plugin: -packages-required = [ - 'pymodaq>=4.4.7', - 'numpy', # for Basler camera - 'pypylon', -] - -[features] # defines the plugin features contained into this plugin -instruments = true # true if plugin contains instrument classes (else false, notice the lowercase for toml files) -extensions = false # true if plugins contains dashboard extensions -models = false # true if plugins contains pid models or other models (optimisation...) -h5exporters = false # true if plugin contains custom h5 file exporters -scanners = false # true if plugin contains custom scan layout (daq_scan extensions) - diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..eb93e96 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,63 @@ +[features] # defines the plugin features contained into this plugin +instruments = true # true if plugin contains instrument classes (else false, notice the lowercase for toml files) +extensions = false # true if plugins contains dashboard extensions +models = false # true if plugins contains pid models +h5exporters = false # true if plugin contains custom h5 file exporters +scanners = false # true if plugin contains custom scan layout (daq_scan extensions) + +[urls] +package-url = 'https://github.com/PyMoDAQ/pymodaq_plugins_basler' + +[project] +name = "pymodaq_plugins_basler" +description = 'PyMoDAQ plugins for cameras of Basler' +dependencies = [ + 'pymodaq>=4.4.7', + 'numpy', # for Basler camera + 'pypylon', +] + +authors = [ + {name = 'Benedikt Burger', email = "Benedikt.Burger@physik.tu-darmstadt.de"}, + {name = 'Romain GeneauX', email = "romain.geneaux@cea.fr"}, +] +maintainers = [ + {name = 'Romain GeneauX', email = "romain.geneaux@cea.fr"}, +] + +# nottodo: leave everything below as is! + +dynamic = ["version", "urls", "entry-points"] +readme = "README.rst" +license = { file="LICENSE" } +requires-python = ">=3.9" + +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: MIT License", + "Natural Language :: English", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Topic :: Scientific/Engineering :: Human Machine Interfaces", + "Topic :: Scientific/Engineering :: Visualization", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Software Development :: User Interfaces", +] + +[build-system] +requires = [ + "hatchling>=1.9.0", + "hatch-vcs", "toml", + "pymodaq_utils>=0.0.6", +] +build-backend = "hatchling.build" + +[tool.hatch.metadata.hooks.custom] + +[tool.hatch.version] +source = "vcs" + diff --git a/setup.py b/setup.py deleted file mode 100644 index c85f63a..0000000 --- a/setup.py +++ /dev/null @@ -1,4 +0,0 @@ -from pymodaq.resources.setup_plugin import setup -from pathlib import Path - -setup(Path(__file__).parent) diff --git a/src/pymodaq_plugins_basler/__init__.py b/src/pymodaq_plugins_basler/__init__.py index ca051e5..2198ac2 100644 --- a/src/pymodaq_plugins_basler/__init__.py +++ b/src/pymodaq_plugins_basler/__init__.py @@ -1,8 +1,15 @@ from pathlib import Path from pymodaq.utils.logger import set_logger # to be imported by other modules. + +from importlib import metadata +from importlib.metadata import PackageNotFoundError + + from .utils import Config config = Config() -with open(str(Path(__file__).parent.joinpath('resources/VERSION')), 'r') as fvers: - __version__ = fvers.read().strip() +try: + __version__ = metadata.version(__package__) +except PackageNotFoundError: + __version__ = '0.0.0dev' diff --git a/src/pymodaq_plugins_basler/resources/VERSION b/src/pymodaq_plugins_basler/resources/VERSION deleted file mode 100644 index afaf360..0000000 --- a/src/pymodaq_plugins_basler/resources/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.0.0 \ No newline at end of file