From 57ffb096ceffacdae82f7d0564b4b8e687ddd80a Mon Sep 17 00:00:00 2001 From: atse Date: Mon, 28 Oct 2024 17:52:00 +0800 Subject: [PATCH] pytec GUI: Set up packaging Co-authored-by: Egor Savkin --- flake.nix | 26 ++++++++++++++++++++++---- pytec/MANIFEST.in | 4 ++++ pytec/pyproject.toml | 18 ++++++++++++++++++ pytec/setup.py | 6 ++++++ 4 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 pytec/MANIFEST.in create mode 100644 pytec/pyproject.toml diff --git a/flake.nix b/flake.nix index 0e68b8c..1c25684 100644 --- a/flake.nix +++ b/flake.nix @@ -61,12 +61,25 @@ pytec = pkgs.python3Packages.buildPythonPackage { pname = "pytec"; version = "0.0.0"; + format = "pyproject"; src = "${self}/pytec"; - propagatedBuildInputs = with pkgs.python3Packages; [ - numpy - matplotlib - ]; + nativeBuildInputs = [ pkgs.qt6.wrapQtAppsHook ]; + propagatedBuildInputs = + [ pkgs.qt6.qtbase ] + ++ (with pkgs.python3Packages; [ + numpy + matplotlib + pyqtgraph + pyqt6 + qasync + pglive + ]); + + dontWrapQtApps = true; + postFixup = '' + wrapQtApp "$out/bin/tec_qt" + ''; }; pglive = pkgs.python3Packages.buildPythonPackage rec { @@ -90,6 +103,11 @@ default = thermostat; }; + apps.x86_64-linux.thermostat_gui = { + type = "app"; + program = "${self.packages.x86_64-linux.pytec}/bin/tec_qt"; + }; + hydraJobs = { inherit thermostat; }; diff --git a/pytec/MANIFEST.in b/pytec/MANIFEST.in new file mode 100644 index 0000000..5be0b39 --- /dev/null +++ b/pytec/MANIFEST.in @@ -0,0 +1,4 @@ +graft examples +include pytec/gui/resources/artiq.ico +include pytec/gui/view/param_tree.json +include pytec/gui/view/tec_qt.ui diff --git a/pytec/pyproject.toml b/pytec/pyproject.toml new file mode 100644 index 0000000..4af3992 --- /dev/null +++ b/pytec/pyproject.toml @@ -0,0 +1,18 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +name = "pytec" +version = "0.0" +authors = [{name = "M-Labs"}] +description = "Control TEC" +urls.Repository = "https://git.m-labs.hk/M-Labs/thermostat" +license = {text = "GPLv3"} + +[project.gui-scripts] +tec_qt = "tec_qt:main" + +[tool.setuptools] +packages.find = {} +py-modules = ["autotune", "plot", "tec_qt"] diff --git a/pytec/setup.py b/pytec/setup.py index 3a46a57..7e3828f 100644 --- a/pytec/setup.py +++ b/pytec/setup.py @@ -9,4 +9,10 @@ setup( license="GPLv3", install_requires=["setuptools"], packages=find_packages(), + entry_points={ + "gui_scripts": [ + "tec_qt = tec_qt:main", + ] + }, + py_modules=['autotune', 'plot', 'tec_qt'], )