Skip to content

Commit

Permalink
Merge pull request #9 from PyMoDAQ/5.0.x
Browse files Browse the repository at this point in the history
v5 proper imports
  • Loading branch information
seb5g authored Jan 21, 2025
2 parents 8eb84b8 + 4584cfe commit 256dea7
Show file tree
Hide file tree
Showing 19 changed files with 222 additions and 143 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/Test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: 'Tests'

on: [push]

jobs:
call_workflow:
uses: ./.github/workflows/Testbase.yml
with:
python: '3.11'
qt5: 'pyqt5'
44 changes: 44 additions & 0 deletions .github/workflows/Testbase.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Base

on:
workflow_call:
inputs:
python:
required: true
type: string
qt5:
required: true
type: string

jobs:
build:
runs-on: ubuntu-latest
env:
DISPLAY: ':99.0'
QT_DEBUG_PLUGINS: 1
steps:
- name: Set up Python ${{ inputs.python }}
uses: actions/checkout@v4
- name: Install dependencies
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python }}
- name: Install package
run: |
sudo apt install libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 x11-utils
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 pyqt5
pip install -e .
- name: create local pymodaq folder and setting permissions
run: |
sudo mkdir /etc/.pymodaq
sudo chmod uo+rw /etc/.pymodaq
- name: Linting with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude=src/pymodaq/resources/QtDesigner_Ressources,docs
- name: Test with pytest
run: |
pytest -n auto
25 changes: 17 additions & 8 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,28 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine toml
- name: Build and publish
pip install hatch hatchling toml twine
- 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: 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 upload dist/*
hatch publish
23 changes: 23 additions & 0 deletions .github/workflows/updater.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
with:
# [Required] Access token with `workflow` scope.
token: ${{ secrets.WORKFLOW_SECRET }}
10 changes: 10 additions & 0 deletions hatch_build.py
Original file line number Diff line number Diff line change
@@ -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)
23 changes: 0 additions & 23 deletions plugin_info.toml

This file was deleted.

63 changes: 63 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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_andor'

[project]
name = "pymodaq_plugins_andor"
description = 'Set of PyMoDAQ plugins for Andor Camera (CCD camera using SDK2, SCMOS cameras using SDK3...)'
dependencies = [
"pymodaq>=5.0.0",
#todo: list here all dependencies your package may have
]

authors = [
{name = "Weber Sébastien", email = '[email protected]'},
#todo: list here all authors of your plugin
]
maintainers = [
{name = "Weber Sébastien", email = '[email protected]'},
#todo: list here all maintainers of your plugin
]

# nottodo: leave everything below as is!

dynamic = ["version", "urls", "entry-points"]
readme = "README.rst"
license = { file="LICENSE" }
requires-python = ">=3.8"

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"

64 changes: 0 additions & 64 deletions setup.py

This file was deleted.

13 changes: 10 additions & 3 deletions src/pymodaq_plugins_andor/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
from pathlib import Path

from pymodaq.utils.logger import set_logger, get_module_name
from pymodaq_utils.logger import set_logger, get_module_name

with open(str(Path(__file__).parent.joinpath('resources/VERSION')), 'r') as fvers:
__version__ = fvers.read().strip()
from pathlib import Path
from .utils import Config
from pymodaq_utils.utils import get_version, PackageNotFoundError

config = Config()
try:
__version__ = get_version(__package__)
except PackageNotFoundError:
__version__ = '0.0.0dev'
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

from easydict import EasyDict as edict
from pymodaq.control_modules.move_utility_classes import DAQ_Move_base, comon_parameters_fun, main
from pymodaq.utils.daq_utils import ThreadCommand
from pymodaq_utils.utils import ThreadCommand
from pymodaq_plugins_andor.hardware import shamrock_sdk


Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import numpy as np
from qtpy import QtWidgets

from pymodaq_plugins_andor.daq_viewer_plugins.plugins_2D.daq_2Dviewer_AndorCCD import DAQ_2DViewer_AndorCCD
from pymodaq_plugins_andor.daq_move_plugins.daq_move_Shamrock import DAQ_Move_Shamrock
from pymodaq_utils.logger import set_logger, get_module_name
from pymodaq_utils.utils import ThreadCommand, find_dict_in_list_from_key_val

from pymodaq_gui.parameter import utils as putils

from pymodaq.utils.daq_utils import ThreadCommand, find_dict_in_list_from_key_val
from pymodaq.utils.data import Axis, DataFromPlugins
from pymodaq.utils.parameter import utils as putils
from pymodaq.control_modules.viewer_utility_classes import main
from pymodaq.utils.logger import set_logger, get_module_name

from pymodaq_plugins_andor.daq_viewer_plugins.plugins_2D.daq_2Dviewer_AndorCCD import DAQ_2DViewer_AndorCCD
from pymodaq_plugins_andor.daq_move_plugins.daq_move_Shamrock import DAQ_Move_Shamrock


logger = set_logger(get_module_name(__file__))

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import numpy as np
from qtpy import QtWidgets

from pymodaq_plugins_andor.daq_viewer_plugins.plugins_2D.daq_2Dviewer_AndorCCD import DAQ_2DViewer_AndorCCD
from pymodaq_plugins_andor.daq_move_plugins.daq_move_Shamrock import DAQ_Move_Shamrock
from pymodaq_utils.logger import set_logger, get_module_name
from pymodaq_utils.utils import ThreadCommand, find_dict_in_list_from_key_val

from pymodaq_gui.parameter import utils as putils

from pymodaq.utils.daq_utils import ThreadCommand, find_dict_in_list_from_key_val
from pymodaq.utils.data import Axis, DataFromPlugins, DataToExport
from pymodaq.utils.parameter import utils as putils
from pymodaq.control_modules.viewer_utility_classes import main, DAQ_Viewer_base, comon_parameters
from pymodaq.utils.logger import set_logger, get_module_name

from pymodaq_plugins_andor.daq_viewer_plugins.plugins_2D.daq_2Dviewer_AndorCCD import DAQ_2DViewer_AndorCCD
from pymodaq_plugins_andor.daq_move_plugins.daq_move_Shamrock import DAQ_Move_Shamrock

logger = set_logger(get_module_name(__file__))

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
from ..plugins_2D.daq_2Dviewer_AndorSCMOS import DAQ_2DViewer_AndorSCMOS
from ...daq_move_plugins.daq_move_Shamrock import DAQ_Move_Shamrock

import numpy as np
from pymodaq.utils.daq_utils import ThreadCommand, find_dict_in_list_from_key_val
from pymodaq.utils.data import Axis, DataFromPlugins
from pymodaq.utils.parameter import utils as putils
from qtpy import QtWidgets

from pymodaq_utils.utils import ThreadCommand, find_dict_in_list_from_key_val
from pymodaq.utils.logger import set_logger, get_module_name

logger = set_logger(get_module_name(__file__))
from pymodaq_gui.parameter import utils as putils

from pymodaq.utils.data import Axis, DataFromPlugins

from ..plugins_2D.daq_2Dviewer_AndorSCMOS import DAQ_2DViewer_AndorSCMOS
from ...daq_move_plugins.daq_move_Shamrock import DAQ_Move_Shamrock

logger = set_logger(get_module_name(__file__))


class DAQ_1DViewer_ShamrockSCMOS(DAQ_2DViewer_AndorSCMOS, DAQ_Move_Shamrock):
Expand Down
Loading

0 comments on commit 256dea7

Please sign in to comment.