2023-04-24 Documentation team meeting notes #43

Notes

As discussed in the last meeting, we’ll do a mob programming session where @zmitchell tries to package and upstream a package to see what problems somebody new runs into.

Mob programming

  • @zmitchell will try to upstream GitHub - wpilibsuite/sphinxext-rediraffe: Sphinx extension to redirect files for Automatically update _redirects file · Issue #522 · NixOS/nix.dev · GitHub
  • Searching for “nixpkgs python”, Python | nixpkgs comes up, section “Python library packages in Nixpkgs” seems relevant
  • Checking pypi for the package for fetchPypi, does exist
  • Not sure about the hash, remember can put in a bogus one and it will spit out the right one
  • Looking for other python packages in Nixpkgs, found a bunch of sphinx extensions in https://github.com/NixOS/nixpkgs/tree/master/pkgs/development/python-modules,
  • Doesn’t know the difference between buildPythonPackage and buildPythonApplication, just going for buildPythonPackage for now and hope it works
  • Copying https://github.com/NixOS/nixpkgs/blob/8dd0f0a459b206fc4209570f6b7ce44ae66f264e/pkgs/development/python-modules/sphinx-book-theme/default.nix
  • Trying to build the copied package with cd pkgs/development/python-modules/sphinx-rediraffe && nix-build .
    Error: "Cannot evaluate a function that has an argument without a value (lib) …
    → Not supplying arguments, no defaults
  • @infinisil: Take a look at contributing to nixpkgs section
  • Seeing the step to add package to all-packages.nix, then nix-build -A <name> works
  • Grepping for “sphinx” in all-packages.nix, trying to put the new package next to sphinx-serve
  • Notices that these are python applications, what do other sphinx libraries do?
  • Can’t find sphinx-book-theme in all-packages.nix → trying to find it in all of nixpkgs, found a definition mention in python-packages.nix
  • Adding a definition like sphinx-rediraffe = callPackage ... { };
  • Going to root of nixpkgs and trying nix-build -A sphinx-rediraffe
    Error: Attribute sphinx-rediraffe in selection path not found
  • Going back to the manual section to see if something was missed
  • Noticing that -A <name> was written for all-packages.nix, but now it’s in python-packages.nix, nix-build -A sphinx-book-theme also doesn’t work
  • Looking at Python section in the manual, no good ToC but found a Contributing guidelines section
    • Seeing a mention of python-packages.nix
    • Doesn’t seem to mention how to build Python packages
  • @infinisil: Grep for nix-build, found a mention in Python | nixpkgs
  • Trying out nix-build -A pythonPackages....
    Error: Python 2.7 is not supported, also doesn’t seem to work for the sphinx-book-theme
  • No clue why it’s using 2.7, where is 2 declared?
  • @infinisil: Try grepping for “python3”
    • Found a mention of python39Packages
  • Why separate python-packages.nix and python2-packages.nix, yet my package is added to python-packages.nix but it builds with Python 2
  • It finally builds with nix-build -A python3Packages.sphinx-rediraffe!
  • Proceeds to edit the default.nix, changing it according to the package and deleting everything that doesn’t seem to be needed, should get an error if it ends up being needed after all
  • Regarding propagatedBuildInputs, also know that there’s buildInputs, nativeBuildInputs and a whole bunch of others in a Matrix, got previous suggestion to not worry about it. propagatedBuildInputs seems to for things you want at build time and at runtime.
  • Leaving the hash the same since it’s already formatted as expected but incorrect
  • Not sure about meta.changelog, sphinx-rediraffe doesn’t seem to have one, not sure if it’s fine to not have one, deleting it
  • What is meta.maintainers, Python package maintainer or Nixpkgs maintainer?
    • Grepping for “maintainers” in the manual, not a lot of results, but adding myself now
  • Trying to build it, download failed, correct hash is output
  • Getting error about import not working, seems to be related to pythonImportsCheck
  • Fixing it by changing it to the correct python module name after checking upstream readme
  • Wondering about passthru.tests, found section on pkgs.testers, no explanation of passthru, found section on meta tests
  • Found passthru section in the stdenv section, but not entirely sure what it means, mentions dependency specification. Not sure why it says passthru can hold arbitrary values, but then some conventions seem to be explained.
  • Looking at other packages to see if they have passthru.tests, finds another package that doesn’t have it → Not needed for now
  • @henrik-ch: We should test it too
  • @zmitchell: Not sure how to test it, would have to point nix.dev to my local directory
  • @infinisil: Can explain it next time, it’s important to test new packages
8 Likes