-
-
Notifications
You must be signed in to change notification settings - Fork 16.7k
python3Packages.snappy: init at 3.2 #415184
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
e29fc6f
to
44785a0
Compare
e32e681
to
6ca033f
Compare
|
||
postInstall = '' | ||
cp -r src/tkinter_gl/tk $out/${python.sitePackages}/tkinter_gl/ | ||
patchelf --set-rpath ${lib.makeLibraryPath [ libGL ]} \ |
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.
This should really be fixed upstream.
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.
Source is here, but there are no releases and I haven't tried compiling it.
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 created a package for tkgl and added it as a dependency of tkinter-gl instead of patching the compiled ones, the tests still run.
What was the error? |
Ok, it looks like the source of the bug is here. The script will need to be patched. |
6c33279
to
8966abc
Compare
Cypari is now marked as broken on darwin. |
5b64066
to
fb798fc
Compare
Thank you for taking the time to package SnapPy and its dependencies! The attribute name is not too important, but unfortunately |
OK it has been added. |
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 have a few suggestions for changes which I hope are helpful.
snappy-15-knots, | ||
snappy-manifolds, | ||
spherogram, | ||
sphinx, |
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.
sphinx, | |
sphinxHook, |
A suggestion: I wonder if it might be good to build the docs using Nixpkgs' sphinxHook
?
There's a few other changes to the derivation needed to make this work, shown below.
Please ignore my suggestions if I'm missing some important reason for not doing this!
pname = "snappy"; | ||
version = "3.2"; | ||
pyproject = 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.
outputs = [ | |
"out" | |
"doc" | |
]; | |
Re: sphinxHook
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 think this can cause problems with nix-shell. Or does this fix it?
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 think that avoids issues? I tried running nix-shell -I nixpkgs=. -p "python3.withPackages (ps: [ps.snappy])"
, then SnapPy
, and clicking on the "SnapPy Help" button opened the documentation in my browser correctly.
Admittedly, I'm not sure if we'll enjoy the advantages of separating the documentation into its own output with that in place. The idea is to reduce the closure size of packages that just want to use the snappy libraries, but I think the doc
output always gets pulled in the way things are now.
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.
Alright, it seems to work. Maybe the SnapPy gui should be in a separate output then? But I'm not really sure how to do that.
postPatch = '' | ||
substituteInPlace setup.py \ | ||
--replace-fail "/usr/include/GL" "${libGL.dev}/include/GL" \ | ||
--replace-fail "'python/doc'" "'$out/${python.sitePackages}/snappy/doc'" |
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.
--replace-fail "'python/doc'" "'$out/${python.sitePackages}/snappy/doc'" | |
substituteInPlace python/app_menus.py \ | |
--replace-fail "os.path.join(os.path.dirname(snappy_dir), 'doc')" \ | |
"os.path.join('${placeholder "doc"}', 'share', 'doc', '$name', 'html')" | |
Re: sphinxHook
. For the help pages to be found within SnapPy.
sphinx | ||
sphinx-rtd-theme | ||
]; |
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.
sphinx | |
sphinx-rtd-theme | |
]; | |
]; | |
nativeBuildInputs = [ | |
sphinxHook | |
sphinx-rtd-theme | |
]; | |
sphinxRoot = "doc_src"; |
Re: sphinxHook
. Actually implementing it.
|
||
buildInputs = [ | ||
libGL | ||
libX11 |
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.
libX11 |
Repeat from above: SnapPy builds fine without this for me?
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 have removed it, it seems it is not necessary.
|
||
env.NIX_CFLAGS_COMPILE = toString [ | ||
"-I${libGL.dev}/include" | ||
"-I${libX11.dev}/include" | ||
]; | ||
|
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.
env.NIX_CFLAGS_COMPILE = toString [ | |
"-I${libGL.dev}/include" | |
"-I${libX11.dev}/include" | |
]; |
I don't think this needs to be specified manually. Correct me if I'm wrong.
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.
It seems to build without these, I don't remember why I thought they were necessary.
]; | ||
|
||
postInstall = '' | ||
${python.interpreter} setup.py build_docs |
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.
${python.interpreter} setup.py build_docs |
Re: sphinxHook
. Not needed with that in use.
f392323
to
d23d681
Compare
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.
Following up on #415184 (comment):
Yeah I'm not sure how to build SnapPy without the GUI but these changes might sort of solve the problem. The idea being that if you want to run the SnapPy GUI and have the documentation work you install pkgs.snappy-topology
, and if you just want to have the pkgs.python3Packages.snappy
to import into, e.g. Sage, then you don't end up with the documentation in your shell closure.
Not sure if this way of going about things is okay.
Maybe someone with more experience can say.
spherogram, | ||
sphinxHook, | ||
sphinx-rtd-theme, | ||
tkinter-gl, |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
substituteInPlace python/app_menus.py \ | ||
--replace-fail "os.path.join(os.path.dirname(snappy_dir), 'doc')" \ | ||
"os.path.join('${placeholder "doc"}', 'share', 'doc', '$name', 'html')" |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
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.
This would cause python3Packages.snappy
to install a broken version of the gui?
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.
Yeah :/ The only thing that doesn't work, though, is opening the HTML documentation from the SnapPy GUI (which makes sense if withDocs = false
). Since the docs are also on snappy.computop.org maybe not including the docs by default is okay? It looks like this is essentially what happens in Nixpkgs for other Python packages using sphinxHook
to build their documentation.
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.
A little broken is still broken, and installing broken software is much worse than including a few extra megabytes of html.
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.
Yeah I'm going to have to agree with that.
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, what should I do for now? Leave it as is?
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.
Looks good to me as it is now. Upstream expects the documentation to be somewhere on the system.
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.
Hi, I took a look at the tkgl
derivation definition.
Using tcl.mkTclDerivation
would be more idiomatic.
I have some other small suggestions for changes.
pkgs/by-name/tk/tkgl/package.nix
Outdated
"--with-tclinclude=${lib.getDev tcl}/include" | ||
"--with-tk=${lib.getLib tk}/lib" | ||
"--with-tkinclude=${lib.getDev tk}/include" | ||
"--libdir=${placeholder "out"}/lib" |
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.
"--libdir=${placeholder "out"}/lib" |
This gets taken care of by stdenv
.
pkgs/by-name/tk/tkgl/package.nix
Outdated
substituteInPlace Makefile.in \ | ||
--replace-fail "install: all install-binaries install-libraries install-doc" \ | ||
"install: all install-binaries" |
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.
substituteInPlace Makefile.in \ | |
--replace-fail "install: all install-binaries install-libraries install-doc" \ | |
"install: all install-binaries" |
I think it's cleaner to specify installTargets
.
"--with-tkinclude=${lib.getDev tk}/include" | ||
"--libdir=${placeholder "out"}/lib" | ||
]; | ||
|
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.
installTargets = [ | |
"install-binaries" | |
]; | |
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 it turns out sphinxHook
supports a postInstallSphinx
step.
Using this simplifies getting SnapPy to find the documentation.
substituteInPlace python/app_menus.py \ | ||
--replace-fail "os.path.join(os.path.dirname(snappy_dir), 'doc')" \ | ||
"os.path.join('${placeholder "doc"}', 'share', 'doc', '$name', 'html')" |
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.
substituteInPlace python/app_menus.py \ | |
--replace-fail "os.path.join(os.path.dirname(snappy_dir), 'doc')" \ | |
"os.path.join('${placeholder "doc"}', 'share', 'doc', '$name', 'html')" |
Found a better way to handle this.
sphinxRoot = "doc_src"; | ||
|
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.
sphinxRoot = "doc_src"; |
Let's move this down after postInstall
.
postInstall = '' | ||
cp -r freedesktop/share $out/ | ||
''; | ||
|
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.
sphinxRoot = "doc_src"; | |
postInstallSphinx = '' | |
ln -s ''${!outputDoc}/share/doc/$name/html $out/${python.sitePackages}/snappy/doc | |
''; | |
Sorry for my earlier suggestion, I feel that this way of handling the documentation will give less friction.
For example, this avoids a warning during the checkPhase
.
Nixpkgs bumped
|
SnapPy is a program and python module for studying the topology and geometry of 3-manifolds.
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.