Skip to content
Open
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
82 changes: 82 additions & 0 deletions pkgs/development/python-modules/pycolmap/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
lib,
buildPythonPackage,
setuptools,
cmake,
colmap,
boost,
numpy,
scikit-build-core,
ruff,
ninja,
pybind11,
pybind11-stubgen,
clang-tools,
perl,
mypy,
enlighten,
pytestCheckHook,
}:
let
# Add COLMAP's pybind11 fixes, see COLMAP's pyproject.toml.
# TODO: remove when https://github.com/sizmailov/pybind11-stubgen/pull/263 is merged
# Generated with; git diff ac46c10e229f1fc570600a14a644238b86ae4f99 a138210fd4f0b548f5195421a9b5b31091078ad6
pybind11-stubgen-pybind-3 = pybind11-stubgen.overrideAttrs (old: {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC, introducing a new overrideAttr in nixpkgs isn’t recommended since it’s brittle, but I can’t find the post 🤔

patches = (old.patches or [ ]) ++ [ ./pybind11-stubgen-fix-pybind-3.0.0.patch ];
});
in
buildPythonPackage {
pname = "pycolmap";

inherit (colmap) src version;

patches = (colmap.patches or [ ]) ++ [ ./remove-version-bounds.patch ];

pyproject = true;

dontUseCmakeConfigure = true;
dontWrapQtApps = true;

build-system = [
scikit-build-core
ruff
ninja
pybind11
pybind11-stubgen-pybind-3
cmake
clang-tools
perl
];

cmakeFlags = [ "-DGENERATE_STUBS=ON" ];

buildInputs = [ colmap ] ++ colmap.depsAlsoForPycolmap;

dependencies = [ numpy ];

pythonImportsCheck = "pycolmap";

nativeCheckInputs = [
pytestCheckHook
mypy
enlighten
];

enabledTestPaths = [ "python/examples" ];

postInstallCheck = ''
python -m mypy --package pycolmap --implicit-optional
'';

meta = with lib; {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove with lib;, using with xxx; is not recommended in a large scope

description = "Structure-From-Motion and Multi-View Stereo pipeline";
longDescription = ''
COLMAP is a general-purpose Structure-from-Motion (SfM) and Multi-View Stereo (MVS) pipeline
with a graphical and command-line interface.
'';
homepage = "https://colmap.github.io/pycolmap/index.html";
license = licenses.bsd3;
platforms = platforms.unix;
maintainers = with maintainers; [ chpatrick ];
};
}
Loading
Loading