Skip to content
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

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Conversation

dtsykunov
Copy link

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

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added 6.topic: python 8.has: maintainer-list (update) This PR changes `maintainers/maintainer-list.nix` labels Jun 14, 2024
@NixOSInfra NixOSInfra added the 12. first-time contribution This PR is the author's first one; please be gentle! label Jun 14, 2024
@ofborg ofborg bot added 8.has: package (new) This PR adds a new package 11.by: package-maintainer This PR was created by the maintainer of the package it changes 10.rebuild-darwin: 1-10 10.rebuild-linux: 1-10 labels Jun 14, 2024
@@ -0,0 +1,261 @@
{ buildPythonPackage
Copy link
Contributor

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=";
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
sha256 = "sha256-FQxfyHPvqI1x4b3byCrTAf11El2MNOXtb5/jx66Yve4=";
hash = "sha256-FQxfyHPvqI1x4b3byCrTAf11El2MNOXtb5/jx66Yve4=";


src = fetchFromGitHub {
owner = "dmlc";
repo = pname;
Copy link
Contributor

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 = [
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
propagatedBuildInputs = [
dependencies = [

};

patches = [
./dlpack_convert.patch
Copy link
Contributor

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";
    })
  ];
}

Copy link
Author

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.

@dtsykunov
Copy link
Author

@drupol Thank you very much for the review. I believe I addressed all the notes.
Please, take a look again when you get the chance.

@dtsykunov dtsykunov requested a review from drupol June 17, 2024 20:58
}:
let
pname = "dgl";
version = "1.1.3";
Copy link
Member

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

Copy link
Author

@dtsykunov dtsykunov Jun 19, 2024

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,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
cudaPackages,
config,
cudaPackages,
cudaSupport ? config.cudaSupport,

cudaSupport should be optional.
This package does not necessarily require CUDA.

Comment on lines +21 to +24
# 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,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# 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.

Comment on lines +35 to +48
"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"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"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

Comment on lines +55 to +56
"test_adj[idtype0]"
"test_adj[idtype1]"
Copy link
Member

Choose a reason for hiding this comment

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

ditto

Comment on lines +198 to +205
buildPhase = ''
runHook preBuild

make -j $NIX_BUILD_CORES

runHook postBuild
'';

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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

Comment on lines +219 to +220
doCheck = true;

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
doCheck = true;

buildPythonPackage function has doCheck = true; by default.

Comment on lines +221 to +251
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
'';
Copy link
Member

Choose a reason for hiding this comment

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

Comment on lines +254 to +256
description = ''
Python package built to ease deep learning on graph, on top of existing DL frameworks.
'';
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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/";
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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.

@FliegendeWurst FliegendeWurst added the awaiting_changes (old Marvin label, do not use) label Dec 1, 2024
@wegank wegank added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jan 2, 2025
@SigmaSquadron SigmaSquadron removed the awaiting_changes (old Marvin label, do not use) label Jan 5, 2025
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jan 5, 2025
@donovanglover donovanglover marked this pull request as draft February 7, 2025 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: python 8.has: maintainer-list (update) This PR changes `maintainers/maintainer-list.nix` 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 10.rebuild-linux: 1-10 11.by: package-maintainer This PR was created by the maintainer of the package it changes 12. first-time contribution This PR is the author's first one; please be gentle!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants