-
-
Notifications
You must be signed in to change notification settings - Fork 15.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
python312Packages.dgl: init at 1.1.3 #319786
base: master
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,261 @@ | |||
{ buildPythonPackage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please reformat this new file with nixfmt-rfc-style
.
owner = "dmlc"; | ||
repo = pname; | ||
rev = "v${version}"; | ||
sha256 = "sha256-FQxfyHPvqI1x4b3byCrTAf11El2MNOXtb5/jx66Yve4="; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sha256 = "sha256-FQxfyHPvqI1x4b3byCrTAf11El2MNOXtb5/jx66Yve4="; | |
hash = "sha256-FQxfyHPvqI1x4b3byCrTAf11El2MNOXtb5/jx66Yve4="; |
|
||
src = fetchFromGitHub { | ||
owner = "dmlc"; | ||
repo = pname; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't use this.
repo = pname;
is nice for DRY but creates a binding that goes too far.
See further information about this here: nix-community/nixpkgs-lint#21
./dlpack_convert.patch | ||
]; | ||
|
||
propagatedBuildInputs = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
propagatedBuildInputs = [ | |
dependencies = [ |
}; | ||
|
||
patches = [ | ||
./dlpack_convert.patch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Each patch in nixpkgs applied to the upstream source should be documented. Out-of-tree patches, fetched using fetchpatch
, are preferred.
In each patch comment, please explain the purpose of the patch and link to the relevant upstream issue if possible. If the patch has been merged upstream but is not yet part of the released version, please note the version number or date in the comment such that a future maintainer updating the nix expression will know whether the patch has been incorporated upstream and can thus be removed from nixpkgs.
Furthermore, please use a stable URL for the patch. Rather than, for example, linking to a GitHub pull request of the form https://github.com/owner/repo/pull/pr_number.patch
, which would change every time a commit is added or the PR is force-pushed, link to a specific commit patch in the form https://github.com/owner/repo/commit/sha.patch
.
Here are two good examples of patch comments:
mkDerivation {
…
patches = [
# Ensure RStudio compiles against R 4.0.0.
# Should be removed next 1.2.X RStudio update or possibly 1.3.X.
(fetchpatch {
url = "https://github.com/rstudio/rstudio/commit/3fb2397c2f208bb8ace0bbaf269481ccb96b5b20.patch";
sha256 = "0qpgjy6aash0fc0xbns42cwpj3nsw49nkbzwyq8az01xwg81g0f3";
})
];
}
mkDerivation {
…
patches = [
# Allow building with bison 3.7
# PR at https://github.com/GoldenCheetah/GoldenCheetah/pull/3590
(fetchpatch {
url = "https://github.com/GoldenCheetah/GoldenCheetah/commit/e1f42f8b3340eb4695ad73be764332e75b7bce90.patch";
sha256 = "1h0y9vfji5jngqcpzxna5nnawxs77i1lrj44w8a72j0ah0sznivb";
})
];
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, there is no patch for this in the repo for dgl. However, I was able to get rid of this patch by providing a CXXFLAGS
environment variable to the build.
@drupol Thank you very much for the review. I believe I addressed all the notes. |
}: | ||
let | ||
pname = "dgl"; | ||
version = "1.1.3"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you adopt 1.1.3
?
2.2.1
has already been released.
https://github.com/dmlc/dgl/releases/tag/v2.2.1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because starting from version 2.0.0 dgl requires torchdata package which isn't present in nixpkgs.
I'll go ahead and try to revive this PR:
#187779
{ | ||
buildPythonPackage, | ||
cmake, | ||
cudaPackages, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cudaPackages, | |
config, | |
cudaPackages, | |
cudaSupport ? config.cudaSupport, |
cudaSupport
should be optional.
This package does not necessarily require CUDA
.
# tensorflow-build and torch use different grpcio, tensorboard and protobuf versions | ||
# so they can't be used at the same time | ||
withTorch ? true, | ||
withTensorflow ? false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# tensorflow-build and torch use different grpcio, tensorboard and protobuf versions | |
# so they can't be used at the same time | |
withTorch ? true, | |
withTensorflow ? false, |
In the python library, we do not allow such arguments since it is easy to conflict PYTHONPATH with different derivatives.
"test_cluster_gcn[0]" | ||
"test_cluster_gcn[4]" | ||
"test_dataloader_worker_init_fn" | ||
"test_graph_dataloader[16]" | ||
"test_graph_dataloader[None]" | ||
"test_saint[edge-0]" | ||
"test_saint[edge-4]" | ||
"test_saint[node-0]" | ||
"test_saint[node-4]" | ||
"test_saint[walk-0]" | ||
"test_saint[walk-4]" | ||
"test_shadow[0]" | ||
"test_shadow[4]" | ||
"test_sparse_opt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"test_cluster_gcn[0]" | |
"test_cluster_gcn[4]" | |
"test_dataloader_worker_init_fn" | |
"test_graph_dataloader[16]" | |
"test_graph_dataloader[None]" | |
"test_saint[edge-0]" | |
"test_saint[edge-4]" | |
"test_saint[node-0]" | |
"test_saint[node-4]" | |
"test_saint[walk-0]" | |
"test_saint[walk-4]" | |
"test_shadow[0]" | |
"test_shadow[4]" | |
"test_sparse_opt" | |
"test_cluster_gcn" | |
"test_dataloader_worker_init_fn" | |
"test_graph_dataloader" | |
"test_saint" | |
"test_shadow" | |
"test_sparse_opt" |
It is not necessary to list all of the parameters.
You can use the -k command line option to specify an expression which implements a substring match on the test names instead of the exact match on markers that -m provides.
https://docs.pytest.org/en/7.1.x/example/markers.html#using-k-expr-to-select-tests-based-on-their-name
"test_adj[idtype0]" | ||
"test_adj[idtype1]" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
buildPhase = '' | ||
runHook preBuild | ||
|
||
make -j $NIX_BUILD_CORES | ||
|
||
runHook postBuild | ||
''; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
buildPhase = '' | |
runHook preBuild | |
make -j $NIX_BUILD_CORES | |
runHook postBuild | |
''; |
By default, parallel building is enabled as CMake supports parallel building almost everywhere.
https://nixos.org/manual/nixpkgs/unstable/#cmake
doCheck = true; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doCheck = true; |
buildPythonPackage
function has doCheck = true;
by default.
checkPhase = | ||
'' | ||
runHook preCheck | ||
|
||
export HOME="$(mktemp -d)" | ||
|
||
cd .. | ||
|
||
./build/runUnitTests | ||
|
||
export PYTHONPATH="$PYTHONPATH:$out/${python.sitePackages}:$src/tests" | ||
export PATH="$PATH:$out/bin" | ||
'' | ||
+ lib.optionalString withTorch '' | ||
export DGLBACKEND=pytorch | ||
pytest tests/python/pytorch/ -k '${disabledTestString pytorchDisabledTests}' \ | ||
--ignore=tests/python/pytorch/sparse/ | ||
pytest tests/python/common/ -k '${disabledTestString commonDisabledTests}' | ||
|
||
pytest tests/distributed/ -k '${disabledTestString distributedDisabledTests}' | ||
'' | ||
+ | ||
lib.optionalString (withTensorflow && withTorch) # should be withTensorflow, but you need 'import torch' to run these | ||
'' | ||
export DGLBACKEND=tensorflow | ||
pytest tests/python/tensorflow/ | ||
pytest tests/python/common/ -k '${disabledTestString commonDisabledTests}' | ||
'' | ||
+ '' | ||
runHook postCheck | ||
''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use pytestCheckHook
instead?
https://nixos.org/manual/nixpkgs/unstable/#using-pytestcheckhook
description = '' | ||
Python package built to ease deep learning on graph, on top of existing DL frameworks. | ||
''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
description = '' | |
Python package built to ease deep learning on graph, on top of existing DL frameworks. | |
''; | |
description = "Python package built to ease deep learning on graph, on top of existing DL frameworks"; |
Please remove the trailing period.
https://nixos.org/manual/nixpkgs/unstable/#var-meta-description
description = '' | ||
Python package built to ease deep learning on graph, on top of existing DL frameworks. | ||
''; | ||
homepage = "https://www.dgl.ai/"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
homepage = "https://www.dgl.ai/"; | |
homepage = "https://www.dgl.ai/"; | |
changelog = "https://github.com/dmlc/dgl/releases/tag/${src.rev}" |
Adding meta.changelog
should be useful for future updates.
Description of changes
Python package built to ease deep learning on graph, on top of existing DL frameworks.
https://www.dgl.ai/
https://github.com/dmlc/dgl/
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.