-
-
Notifications
You must be signed in to change notification settings - Fork 16.5k
gpt4all-bindings: init at version 3.2.1 #340717
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
base: master
Are you sure you want to change the base?
Conversation
I am creating the PR as it's my first Python package in nixpkgs, so it may require a lot of fixups. |
cuda ? false, | ||
}: | ||
let | ||
basepkg = if cuda then gpt4all-cuda else gpt4all; |
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.
basepkg = if cuda then gpt4all-cuda else gpt4all; |
Instead, enable cuda through config.cudaSupport
.
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.
I made the condition inside the top-level/python-packages.nix
file as if I get the gpt4all
package through the derivation arguments, it clashes with the python library I'm trying to build.
setuptools, | ||
wheel, | ||
python, | ||
cuda ? 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.
cuda ? false, |
}; | ||
in | ||
buildPythonPackage { | ||
pname = "gpt4all-bindings"; |
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.
pname = "gpt4all-bindings"; | |
pname = "gpt4all"; |
Attribute names in python-packages.nix as well as pnames should match the library's name on PyPI, but be normalized according to PEP 0503. This means that characters should be converted to lowercase and . and _ should be replaced by a single - (foo-bar-baz instead of Foo__Bar.baz).
pname = "gpt4all-bindings"; | ||
inherit (basepkg) src version; | ||
sourceRoot = "${basepkg.src.name}/gpt4all-bindings/python"; | ||
pyproject = 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.
pyproject = false; | |
pyproject = true; |
A typical python package with setup.py.
https://github.com/nomic-ai/gpt4all/tree/main/gpt4all-bindings/python
sourceRoot = "${basepkg.src.name}/gpt4all-bindings/python"; | ||
pyproject = false; | ||
|
||
patches = [ ./setup_fixup.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.
Why do we need this 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.
The setup.py
adds some code inside it to copy library files inside a folder.
For this, it uses shutil.copy2
which fails if the destination file already exists, which it does for some of them
I modified the patch to only avoid this specific case.
build-system = [ | ||
setuptools | ||
wheel | ||
]; |
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.
build-system = [ | |
setuptools | |
wheel | |
]; | |
build-system = [ setuptools ]; |
buildPhase = '' | ||
python3 setup.py build | ||
''; | ||
|
||
installPhase = '' | ||
mkdir -p $out/${python.sitePackages}/ | ||
cp -r gpt4all $out/${python.sitePackages}/gpt4all | ||
''; | ||
|
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 = '' | |
python3 setup.py build | |
''; | |
installPhase = '' | |
mkdir -p $out/${python.sitePackages}/ | |
cp -r gpt4all $out/${python.sitePackages}/gpt4all | |
''; |
''; | ||
|
||
pythonImportsCheck = [ "gpt4all" ]; | ||
|
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.
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.
So I enabled tests, and after removing those needing network connection to download a large LLM and do inference, it left me with 0 tests left to execute.
So I just let them disabled, and added a comment on why
pythonImportsCheck = [ "gpt4all" ]; | ||
|
||
meta = with lib; { | ||
description = "GPT4All: Run Local LLMs on Any Device. Python bindings"; |
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 = "GPT4All: Run Local LLMs on Any Device. Python bindings"; | |
description = "Run Local LLMs on Any Device"; |
https://nixos.org/manual/nixpkgs/unstable/#var-meta-description
pkgs/top-level/python-packages.nix
Outdated
@@ -5294,6 +5294,8 @@ self: super: with self; { | |||
|
|||
gpt-2-simple = callPackage ../development/python-modules/gpt-2-simple { }; | |||
|
|||
gpt4all-bindings = callPackage ../development/python-modules/gpt4all-bindings { }; |
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.
gpt4all-bindings = callPackage ../development/python-modules/gpt4all-bindings { }; | |
gpt4all = callPackage ../development/python-modules/gpt4all { }; |
Signed-off-by: Litchi Pi <litchi.pi@proton.me>
b0fc0a7
to
5d6bbe9
Compare
Addressed the comments, rebased and squashed into a clean commit |
@natsukium Any more comments on this PR I should address ? :-) |
Signed-off-by: Litchi Pi <litchi.pi@proton.me>
ping |
Description of changes
Packaging request: #306217
Python library for the Gpt4all project
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.