Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/github-actions-version-updater@v0.8.1
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.

61 changes: 61 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[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_opencv'

[project]
name = "pymodaq_plugins_opencv"
description = 'plugin to use camera instrumented using the opencv library'
dependencies = [
"pymodaq>=5.0.0",
'opencv-python',
]

authors = [
{name = "Sebastien J. Weber", email = "'sebastien.weber@cnrs.fr'"},
]
maintainers = [
{name = "Sebastien J. Weber", email = "'sebastien.weber@cnrs.fr'"},
]

# 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"

69 changes: 0 additions & 69 deletions setup.py

This file was deleted.

13 changes: 9 additions & 4 deletions src/pymodaq_plugins_opencv/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
from pathlib import Path
from pymodaq.utils.logger import set_logger # to be imported by other modules.

from .utils import Config
from pymodaq_utils.utils import get_version, PackageNotFoundError
from pymodaq_utils.logger import set_logger, get_module_name

config = Config()
try:
__version__ = get_version(__package__)
except PackageNotFoundError:
__version__ = '0.0.0dev'



with open(str(Path(__file__).parent.joinpath('resources/VERSION')), 'r') as fvers:
__version__ = fvers.read().strip()
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import numpy as np
import cv2

from pymodaq.utils.daq_utils import ThreadCommand
from pymodaq_utils.utils import ThreadCommand
from pymodaq.utils.data import DataFromPlugins, Axis, DataToExport
from pymodaq.control_modules.viewer_utility_classes import DAQ_Viewer_base, comon_parameters, main
from pymodaq.utils.parameter import Parameter
from pymodaq_gui.parameter import Parameter

from pymodaq_plugins_opencv.hardware.opencv import OpenCVProp

Expand Down
Loading
Loading