From 46185439167511821c283e93727306ff756226af 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 | 29 ++++++++++++++++++++++++++++- pytec/MANIFEST.in | 4 ++++ pytec/pyproject.toml | 18 ++++++++++++++++++ pytec/setup.py | 6 ++++++ 4 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 pytec/MANIFEST.in create mode 100644 pytec/pyproject.toml diff --git a/flake.nix b/flake.nix index ab388c1..f065bb6 100644 --- a/flake.nix +++ b/flake.nix @@ -64,12 +64,39 @@ numpy ]; }; + + thermostat_gui = pkgs.python3Packages.buildPythonPackage { + pname = "thermostat_gui"; + version = "0.0.0"; + format = "pyproject"; + src = "${self}/pytec"; + + nativeBuildInputs = [ pkgs.qt6.wrapQtAppsHook ]; + propagatedBuildInputs = + [ pkgs.qt6.qtbase ] + ++ (with pkgs.python3Packages; [ + pyqtgraph + pyqt6 + qasync + pglive + ]); + + dontWrapQtApps = true; + postFixup = '' + wrapQtApp "$out/bin/tec_qt" + ''; + }; in { packages.x86_64-linux = { - inherit thermostat; + inherit thermostat thermostat_gui; default = thermostat; }; + apps.x86_64-linux.thermostat_gui = { + type = "app"; + program = "${self.packages.x86_64-linux.thermostat_gui}/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'], )