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
octoprint.python.pkgs.octolapse: init at 0.4.1 #136513
Conversation
meta = with lib; { | ||
description = "Stabilized timelapses for Octoprint"; | ||
homepage = "https://github.com/FormerLurker/OctoLapse"; | ||
license = licenses.agpl3; |
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.
{ lib, buildPythonPackage, fetchPypi, mock }: | ||
|
||
buildPythonPackage rec { | ||
pname = "file_read_backwards"; |
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 = "file_read_backwards"; | |
pname = "file-read-backwards"; |
Naming should follow PEP 0503 -> https://nixos.org/manual/nixpkgs/unstable/#contributing
It's better to have file-read-backwards added this way. Use this PR for octolapse, I'll drop it from mine. |
@illustris would you like me to add you as a maintainer for octolapse as well? |
Sure. I actively use it, so I'd be happy to fix it if it breaks in the future. |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
pkgs/development/python-modules/file_read_backwards/default.nix
Outdated
Show resolved
Hide resolved
sha256 = "13q20g7brabplc198jh67lk65rn140r8217iak9b2jy3in8fggv4"; | ||
}; | ||
|
||
propagatedBuildInputs = with super; [ awesome-slugify setuptools pillow sarge six psutil file_read_backwards ]; |
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 = with super; [ awesome-slugify setuptools pillow sarge six psutil file_read_backwards ]; | |
propagatedBuildInputs = with super; [ awesome-slugify setuptools pillow sarge six psutil file-read-backwards ]; |
Thinking more about this, I wonder why this doesn't fail the build. Shouldn't these plugins be included in octoprint
's build somehow? Maybe there should be an octoprint-full
package in all-packages.nix
or something like that?
Would you know how is one supposed to use these plugins or at least build them?
Edit: Okay, found a way to build this:
% nix build -Lvf . --no-link pkgs.octoprint.python.pkgs.octolapse
error: undefined variable 'file_read_backwards' at /home/mat/programming/nixpkgs/pkgs/applications/misc/octoprint/plugins.nix:413:94
(use '--show-trace' to show detailed location information)
I would vote to add a octoprint-full
into the top-level and make sure these plugins actually build.
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 -full package with all optional plugins isn't a pattern I've seen often in nixpkgs. For example:
https://github.com/NixOS/nixpkgs/tree/master/pkgs/servers/monitoring/grafana
https://github.com/NixOS/nixpkgs/tree/master/pkgs/servers/roundcube
https://github.com/NixOS/nixpkgs/tree/master/pkgs/shells/fish
https://github.com/NixOS/nixpkgs/tree/master/pkgs/applications/networking/cluster/helm
Gimp has plugins, and has a wrapper package gimp-with-plugins
, but even this defaults to plugins ? null
https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/graphics/gimp/wrapper.nix
Gimp differs from the above packages in having its plugins exposed as gimpPlugins.<name>
. Yosys does something similar. This might be less confusing than having a -full package with all plugins, especially given some of these plugins are very situational and not needed by most people. The ender3v2tempfix plugin, for example, is essential if and only if you have an ender 3 v2 printer.
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 name needs to be updated or we run into an eval error when the addon is used.
version = "2.0.0"; | ||
|
||
src = fetchPypi { | ||
pname = builtins.replaceStrings ["-"] ["_"] 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.
Use lib instead of builtins.
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?
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 remember someone saying something about lib enabling reflection, but I can't find it any more. @SuperSandro2000 can you point me to any documentation / discussion about why lib is preferred over builtins here?
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 is no documentation for every little thing. lib sometimes has some extra sugar on top of the builtins like fetchurl and it is just easier to use lib everywhere because you don't need to think about anything. For replaceStrings lib and builtins are identical.
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.
Successfully built nix build -Lvf . --no-link pkgs.octoprint.python.pkgs.octolapse
. 👍
pkgs/development/python-modules/file-read-backwards/default.nix
Outdated
Show resolved
Hide resolved
pkgs/development/python-modules/file-read-backwards/default.nix
Outdated
Show resolved
Hide resolved
sha256 = "13q20g7brabplc198jh67lk65rn140r8217iak9b2jy3in8fggv4"; | ||
}; | ||
|
||
pythonImportsCheck = [ "file_read_backwards" ]; |
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.
TL;DR: I think we'll have to give up on the import check in this plugin. I suggest you remove this import check entirely (read below for a more detailed explanation):
pythonImportsCheck = [ "file_read_backwards" ]; |
Detailed explanation:
Similarly to the other comment, this should be like this:
pythonImportsCheck = [ "octoprint_octolapse" ];
However, I just checked and octoprint's plugins execute some code on import which fails the import check:
python3.8-OctoPrintPlugin-Octolapse> Check whether the following modules can be imported: octoprint_octolapse
python3.8-OctoPrintPlugin-Octolapse> Initializing GcodePositionProcessor V1.0.1 - Copyright (C) 2019 Brad Hochgesang...Python 3+ Detected...complete
python3.8-OctoPrintPlugin-Octolapse> 2021-11-27 16:07:30,253 - octolapse.__init__ - INFO - Release mode detected.
python3.8-OctoPrintPlugin-Octolapse> Error in atexit._run_exitfuncs:
python3.8-OctoPrintPlugin-Octolapse> Traceback (most recent call last):
python3.8-OctoPrintPlugin-Octolapse> File "/nix/store/66p7i56lg3zzp7nj6g0fywb704ihp4iy-python3-3.8.11/lib/python3.8/logging/__init__.py", line 2127, in shutdown
python3.8-OctoPrintPlugin-Octolapse> h.close()
python3.8-OctoPrintPlugin-Octolapse> File "/nix/store/iqdafs15896fzih94jgicr7lgx0b4h5j-python3.8-OctoPrint-1.6.1/lib/python3.8/site-packages/octoprint/logging/handlers.py", line 31, in close
python3.8-OctoPrintPlugin-Octolapse> self._executor.shutdown(wait=True)
python3.8-OctoPrintPlugin-Octolapse> AttributeError: 'OctolapseConsoleHandler' object has no attribute '_executor'
@SuperSandro2000: I suggest we omit the imports check here. It would require a change a change to the buildPlugin
function to support this.
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.
Makes sense to me. If everything else looks good, I'll go ahead and comment out the check, it may be sensible to add it at a later time when the import works.
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.
Good to know.
Anything else needed in order to finish this PR up? |
rebase and force push to fix the merge conflict. |
This is a semi-automatic executed nixpkgs-review with nixpkgs-review-checks extension. It is checked by a human on a best effort basis and does not build all packages (e.g. lumo, tensorflow or pytorch). Result of 2 packages built:
|
Motivation for this change
Package the popular Octolapse plugin along with an additional python dependency
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)