diff --git a/pkgs/by-name/cq/cq-editor/package.nix b/pkgs/by-name/cq/cq-editor/package.nix new file mode 100644 index 0000000000000..14162365eeb34 --- /dev/null +++ b/pkgs/by-name/cq/cq-editor/package.nix @@ -0,0 +1,73 @@ +{ + lib, + fetchFromGitHub, + libsForQt5, + makeDesktopItem, + nix-update-script, + python3Packages, +}: +python3Packages.buildPythonApplication (finalAttrs: { + pname = "cq-editor"; + version = "0.6.2"; + pyproject = true; + + src = fetchFromGitHub { + owner = "CadQuery"; + repo = "cq-editor"; + rev = finalAttrs.version; + hash = "sha256-8Kj8WmzlchDbd7H9MJatUHsevJf1NSQjshor+vrdhwg="; + }; + + build-system = [ python3Packages.setuptools ]; + + nativeBuildInputs = [ libsForQt5.wrapQtAppsHook ]; + + dependencies = [ + python3Packages.cadquery + python3Packages.logbook + python3Packages.path + python3Packages.pyqt5 + python3Packages.pyqtgraph + python3Packages.qtawesome + python3Packages.qtconsole + python3Packages.requests + ]; + + pythonRelaxDeps = [ + "qtawesome" + "qtconsole" + ]; + + # cq-editor crashes when trying to use Wayland, so force xcb: + # https://github.com/CadQuery/CQ-editor/issues/266 + qtWrapperArgs = [ "--set QT_QPA_PLATFORM xcb" ]; + + postFixup = '' + wrapQtApp "$out/bin/cq-editor" + ''; + + desktopItems = [ + (makeDesktopItem { + name = "com.cadquery.CadQuery"; + desktopName = "CadQuery"; + icon = "cadquery"; + exec = "cq-editor %f"; + categories = [ + "Graphics" + "3DGraphics" + "Engineering" + ]; + type = "Application"; + comment = "CadQuery GUI editor based on PyQT"; + }) + ]; + + passthru.updateScript = nix-update-script { }; + + meta = { + description = "CadQuery GUI editor based on PyQT"; + homepage = "https://github.com/CadQuery/CQ-editor"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ cjshearer ]; + }; +}) diff --git a/pkgs/development/python-modules/cadquery-ocp/default.nix b/pkgs/development/python-modules/cadquery-ocp/default.nix new file mode 100644 index 0000000000000..b53a6a6e88176 --- /dev/null +++ b/pkgs/development/python-modules/cadquery-ocp/default.nix @@ -0,0 +1,78 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + fetchzip, + isPy3k, + python, + + # build + cmake, + mpi, + pybind11, + + # dependencies + fontconfig, + freeglut, + libGLU, + opencascade-occt, + rapidjson, + vtk, +}: +buildPythonPackage (finalAttrs: { + pname = "cadquery-ocp"; + version = "7.8.1.2"; + pyproject = false; + disabled = !isPy3k; + + # While I would prefer to codegen this from source, the toolchain is truly hideous and I have + # already spent several days trying to get it to work. For now, we use the pre-generated stubs. + src = fetchzip { + # 7.9.3.0 uses "Linux" instead of "ubuntu-20.04" in the release name, so the next update will + # require updating more than the version. + url = "https://github.com/CadQuery/OCP/releases/download/${finalAttrs.version}/OCP_src_stubs_ubuntu-20.04.zip"; + hash = "sha256-sg6QEZWNvY9xz5RNA2/bImYI5PpvOyndBKrlNfZgsUI="; + stripRoot = true; + }; + + nativeBuildInputs = [ + cmake + mpi + pybind11 + ]; + + buildInputs = [ + fontconfig + freeglut + libGLU + ((opencascade-occt.override { withVtk = true; }).overrideAttrs { + version = "7.8.1"; + src = fetchFromGitHub { + owner = "Open-Cascade-SAS"; + repo = "OCCT"; + rev = "V7_8_1"; + sha256 = "sha256-tg71cFx9HZ471T/3No9CeEHi8VSo0ZITIuNfTSNB2qU="; + }; + }) + rapidjson + vtk + ]; + + installPhase = '' + runHook preInstall + + install -D *.so -t $out/${python.sitePackages} + + runHook postInstall + ''; + + pythonImportsCheck = [ "OCP" ]; + + meta = { + description = "Python wrapper for OpenCASCADE generated using pywrap (CadQuery OCP)"; + homepage = "https://github.com/CadQuery/OCP"; + license = lib.licenses.asl20; + platforms = lib.platforms.linux; + maintainers = with lib.maintainers; [ cjshearer ]; + }; +}) diff --git a/pkgs/development/python-modules/cadquery/default.nix b/pkgs/development/python-modules/cadquery/default.nix new file mode 100644 index 0000000000000..8a305c4f3426b --- /dev/null +++ b/pkgs/development/python-modules/cadquery/default.nix @@ -0,0 +1,89 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + isPy3k, + nix-update-script, + + # build-system + setuptools, + + # dependencies + cadquery-ocp, + casadi, + ezdxf, + ipython, + multimethod, + nlopt, + nptyping, + path, + trame-vtk, + trame, + typing-extensions, + typish, + vtk, + + # tests + docutils, + pytest-xdist, + pytestCheckHook, +}: +buildPythonPackage (finalAttrs: { + pname = "cadquery"; + version = "2.6.1"; + pyproject = true; + disabled = !isPy3k; + + src = fetchFromGitHub { + owner = "CadQuery"; + repo = "cadquery"; + rev = "v${finalAttrs.version}"; + hash = "sha256-ZIZ49RCGkPztlhU/AmDFnJXvw5kuhF+sSLKZuXMtuCU="; + }; + + build-system = [ setuptools ]; + + propagatedBuildInputs = [ + cadquery-ocp + casadi + ezdxf + ipython + multimethod + nlopt + nptyping + path + trame + trame-vtk + typing-extensions + # typish will be removed in the next release: https://github.com/CadQuery/cadquery/pull/1967 + typish + vtk + ]; + + nativeCheckInputs = [ + docutils + pytest-xdist + pytestCheckHook + ]; + + pythonRelaxDeps = [ "multimethod" ]; + pythonRemoveDeps = [ + "cadquery-ocp" + "casadi" + ]; + + # This fails upstream: https://github.com/CadQuery/OCP/issues/192 + # OCP.Standard.Standard_Failure: BRepFill : The continuity is not G0 G1 or G2 + disabledTests = [ "test_cap" ]; + + pythonImportsCheck = [ "cadquery" ]; + + passthru.updateScript = nix-update-script { }; + + meta = { + description = "Parametric scripting language for creating and traversing CAD models"; + homepage = "https://github.com/CadQuery/cadquery"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ cjshearer ]; + }; +}) diff --git a/pkgs/development/python-modules/trame-client/default.nix b/pkgs/development/python-modules/trame-client/default.nix new file mode 100644 index 0000000000000..d258f2ec58718 --- /dev/null +++ b/pkgs/development/python-modules/trame-client/default.nix @@ -0,0 +1,38 @@ +{ + lib, + buildPythonPackage, + fetchPypi, + nix-update-script, + + # build-system + setuptools, + + # dependencies + trame-common, +}: +buildPythonPackage (finalAttrs: { + pname = "trame-client"; + version = "3.11.2"; + pyproject = true; + + src = fetchPypi { + inherit (finalAttrs) version; + pname = "trame_client"; + hash = "sha256-mLPwnQ+9sJzSnqxhyUWnbcrUoIz7SEOrzloUj9b8cxY="; + }; + + build-system = [ setuptools ]; + + dependencies = [ trame-common ]; + + pythonImportsCheck = [ "trame_client" ]; + + passthru.updateScript = nix-update-script { }; + + meta = { + description = "Internal client of trame"; + homepage = "https://github.com/Kitware/trame-client"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ cjshearer ]; + }; +}) diff --git a/pkgs/development/python-modules/trame-common/default.nix b/pkgs/development/python-modules/trame-common/default.nix new file mode 100644 index 0000000000000..642c7405cf7f2 --- /dev/null +++ b/pkgs/development/python-modules/trame-common/default.nix @@ -0,0 +1,33 @@ +{ + lib, + buildPythonPackage, + fetchPypi, + nix-update-script, + + # build + hatchling, +}: +buildPythonPackage (finalAttrs: { + pname = "trame-common"; + version = "1.1.1"; + pyproject = true; + + src = fetchPypi { + inherit (finalAttrs) version; + pname = "trame_common"; + hash = "sha256-YlSXC3VwBRDFgmXpD9OLqFK5nA5xKT0k7tVIGZArsBw="; + }; + + build-system = [ hatchling ]; + + pythonImportsCheck = [ "trame_common" ]; + + passthru.updateScript = nix-update-script { }; + + meta = { + description = "Dependency less classes and functions for trame"; + homepage = "https://github.com/Kitware/trame-common"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ cjshearer ]; + }; +}) diff --git a/pkgs/development/python-modules/trame-server/default.nix b/pkgs/development/python-modules/trame-server/default.nix new file mode 100644 index 0000000000000..8e2f836929a65 --- /dev/null +++ b/pkgs/development/python-modules/trame-server/default.nix @@ -0,0 +1,42 @@ +{ + lib, + buildPythonPackage, + fetchPypi, + nix-update-script, + + # build-system + setuptools, + + # dependencies + more-itertools, + wslink, +}: +buildPythonPackage (finalAttrs: { + pname = "trame-server"; + version = "3.10.0"; + pyproject = true; + + src = fetchPypi { + inherit (finalAttrs) version; + pname = "trame_server"; + hash = "sha256-DDQd6Xb3WP+OYHaZHn8wvhgDhNTzhs8prvo5FbgB0Rg="; + }; + + build-system = [ setuptools ]; + + dependencies = [ + more-itertools + wslink + ]; + + pythonImportsCheck = [ "trame_server" ]; + + passthru.updateScript = nix-update-script { }; + + meta = { + description = "Internal server side implementation of trame"; + homepage = "https://github.com/Kitware/trame-server"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ cjshearer ]; + }; +}) diff --git a/pkgs/development/python-modules/trame-vtk/default.nix b/pkgs/development/python-modules/trame-vtk/default.nix new file mode 100644 index 0000000000000..60aa1791ee3ed --- /dev/null +++ b/pkgs/development/python-modules/trame-vtk/default.nix @@ -0,0 +1,47 @@ +{ + lib, + buildPythonPackage, + fetchPypi, + nix-update-script, + + # build-system + hatchling, + + # dependencies + trame-client, + vtk, +}: +buildPythonPackage (finalAttrs: { + pname = "trame-vtk"; + version = "2.11.1"; + pyproject = true; + + src = fetchPypi { + inherit (finalAttrs) version; + pname = "trame_vtk"; + hash = "sha256-2x8xa6acKbkpJ3XD9zVnYEqjZnQsBgMNhQfVvVZCRJI="; + }; + + build-system = [ hatchling ]; + + propagatedBuildInputs = [ + trame-client + vtk + ]; + + postPatch = '' + # Ensure PEP 420 namespace package layout (split across trame-* packages) + find src/trame -type f -name '__init__.py' -delete + ''; + + pythonImportsCheck = [ "trame_vtk" ]; + + passthru.updateScript = nix-update-script { }; + + meta = { + description = "VTK widgets for trame"; + homepage = "https://github.com/Kitware/trame-vtk"; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ cjshearer ]; + }; +}) diff --git a/pkgs/development/python-modules/trame-vuetify/default.nix b/pkgs/development/python-modules/trame-vuetify/default.nix new file mode 100644 index 0000000000000..c639dc1055a77 --- /dev/null +++ b/pkgs/development/python-modules/trame-vuetify/default.nix @@ -0,0 +1,42 @@ +{ + lib, + buildPythonPackage, + fetchPypi, + nix-update-script, + + # build-system + setuptools, + + # dependencies + trame-client, +}: +buildPythonPackage (finalAttrs: { + pname = "trame-vuetify"; + version = "3.2.1"; + pyproject = true; + src = fetchPypi { + inherit (finalAttrs) version; + pname = "trame_vuetify"; + hash = "sha256-FXiQSo/FMTuoAzB26i2TOKBQomxozuuyB/trFeGMCkU="; + }; + + build-system = [ setuptools ]; + + dependencies = [ trame-client ]; + + postPatch = '' + # Ensure PEP 420 namespace package layout (split across trame-* packages) + find trame -type f -name '__init__.py' -delete + ''; + + pythonImportsCheck = [ "trame_vuetify" ]; + + passthru.updateScript = nix-update-script { }; + + meta = { + description = "Vuetify widgets for trame"; + homepage = "https://github.com/Kitware/trame-vuetify"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ cjshearer ]; + }; +}) diff --git a/pkgs/development/python-modules/trame/default.nix b/pkgs/development/python-modules/trame/default.nix new file mode 100644 index 0000000000000..cb9824eae2b7c --- /dev/null +++ b/pkgs/development/python-modules/trame/default.nix @@ -0,0 +1,55 @@ +{ + lib, + buildPythonPackage, + fetchPypi, + nix-update-script, + + # build-system + setuptools, + + # dependencies + pyyaml, + trame-server, + trame-client, + trame-common, + wslink, +}: +buildPythonPackage (finalAttrs: { + pname = "trame"; + version = "3.12.0"; + pyproject = true; + + src = fetchPypi { + inherit (finalAttrs) version; + pname = "trame"; + hash = "sha256-iLhhFiy4sCXoTpPxfc/UOoTQLSwWCMn21Y481kalDAU="; + }; + + build-system = [ setuptools ]; + + dependencies = [ + trame-server + trame-client + trame-common + wslink + pyyaml + ]; + + preBuild = '' + # Ensure PEP 420 namespace package layout (split across trame-* packages) + for d in trame trame/modules trame/ui trame/widgets; do + rm "$d/__init__.py" + done + ''; + + pythonImportsCheck = [ "trame" ]; + + passthru.updateScript = nix-update-script { }; + + meta = { + description = "Framework to build applications in plain Python"; + homepage = "https://github.com/Kitware/trame"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ cjshearer ]; + }; +}) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 5ec00f4bb2a67..42329ff9d9c04 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -2393,6 +2393,10 @@ self: super: with self; { cachy = callPackage ../development/python-modules/cachy { }; + cadquery = callPackage ../development/python-modules/cadquery { }; + + cadquery-ocp = callPackage ../development/python-modules/cadquery-ocp { }; + cadwyn = callPackage ../development/python-modules/cadwyn { }; caffe = toPythonModule ( @@ -19283,6 +19287,18 @@ self: super: with self; { trakit = callPackage ../development/python-modules/trakit { }; + trame = callPackage ../development/python-modules/trame { }; + + trame-client = callPackage ../development/python-modules/trame-client { }; + + trame-common = callPackage ../development/python-modules/trame-common { }; + + trame-server = callPackage ../development/python-modules/trame-server { }; + + trame-vtk = callPackage ../development/python-modules/trame-vtk { }; + + trame-vuetify = callPackage ../development/python-modules/trame-vuetify { }; + trampoline = callPackage ../development/python-modules/trampoline { }; transaction = callPackage ../development/python-modules/transaction { };