From a4133153f18a921a2b0920629b81ff81217ccd81 Mon Sep 17 00:00:00 2001 From: Sam <30577766+Samasaur1@users.noreply.github.com> Date: Fri, 6 Jun 2025 21:33:18 -0700 Subject: [PATCH 1/2] pdfquery: init at 0.4.3 --- .../python-modules/pdfquery/default.nix | 60 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 62 insertions(+) create mode 100644 pkgs/development/python-modules/pdfquery/default.nix diff --git a/pkgs/development/python-modules/pdfquery/default.nix b/pkgs/development/python-modules/pdfquery/default.nix new file mode 100644 index 000000000000..6c71aef892ba --- /dev/null +++ b/pkgs/development/python-modules/pdfquery/default.nix @@ -0,0 +1,60 @@ +{ + buildPythonPackage, + fetchPypi, + lib, + cssselect, + chardet, + lxml, + pdfminer-six, + pyquery, + roman, + six, + setuptools, +}: + +buildPythonPackage rec { + pname = "pdfquery"; + version = "0.4.3"; + pyproject = true; + + # The latest version is on PyPI but not tagged on GitHub + src = fetchPypi { + inherit pname version; + hash = "sha256-oqKXTLMS/aT1aa3I1jN30l1cY2ckC0p7+xZTksc+Hc4="; + }; + + dependencies = [ + cssselect + chardet + lxml + pdfminer-six + pyquery + roman + + # Not explicitly listed in setup.py; found through trial and error + six + ]; + + build-system = [ + setuptools + ]; + + # Although this package has tests, they aren't runnable with + # `unittestCheckHook` or `pytestCheckHook` because you're meant + # to run the tests with `python setup.py test`, but that's deprecated + # and doesn't work anymore. So there are no runnable tests. + doCheck = false; + + # This runs as a different phase than checkPhase, so still runs + # despite `doCheck = false` + pythonImportsCheck = [ + "pdfquery" + ]; + + meta = { + description = "Concise, friendly PDF scraping using JQuery or XPath syntax"; + homepage = "https://github.com/jcushman/pdfquery"; + license = lib.licenses.mit; + maintainers = [ lib.maintainers.samasaur ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 2797bb768dd8..1fd25c4e20a8 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -11185,6 +11185,8 @@ self: super: with self; { pdfplumber = callPackage ../development/python-modules/pdfplumber { }; + pdfquery = callPackage ../development/python-modules/pdfquery { }; + pdfrw = callPackage ../development/python-modules/pdfrw { }; pdfrw2 = callPackage ../development/python-modules/pdfrw2 { }; From a08205f1733531605d1817ee68a43f601ef27a3d Mon Sep 17 00:00:00 2001 From: Sam <30577766+Samasaur1@users.noreply.github.com> Date: Fri, 6 Jun 2025 21:33:18 -0700 Subject: [PATCH 2/2] ao3downloader: init at 2025.6.1 --- pkgs/by-name/ao/ao3downloader/package.nix | 56 +++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 pkgs/by-name/ao/ao3downloader/package.nix diff --git a/pkgs/by-name/ao/ao3downloader/package.nix b/pkgs/by-name/ao/ao3downloader/package.nix new file mode 100644 index 000000000000..f8ab850e37c2 --- /dev/null +++ b/pkgs/by-name/ao/ao3downloader/package.nix @@ -0,0 +1,56 @@ +{ + lib, + python312Packages, + fetchFromGitHub, +}: + +# ao3downloader explicitly does not support Python 3.13 yet +# https://github.com/nianeyna/ao3downloader/blob/f8399bb8aca276ae7359157b90afd13925c90056/pyproject.toml#L8 +python312Packages.buildPythonApplication rec { + pname = "ao3downloader"; + version = "2025.6.1"; + pyproject = true; + + src = fetchFromGitHub { + owner = "nianeyna"; + repo = "ao3downloader"; + tag = "v${version}"; + hash = "sha256-ukS3uku8OW5nhM2Nr0IxAiG03XfqUn/Xyd0lZDGGkWw="; + }; + + build-system = with python312Packages; [ + hatchling + ]; + + dependencies = with python312Packages; [ + beautifulsoup4 + mobi + pdfquery + requests + six + tqdm + ]; + + pythonRelaxDeps = [ + "requests" + ]; + + pythonImportsCheck = [ + "ao3downloader" + ]; + + nativeCheckInputs = with python312Packages; [ + pytestCheckHook + syrupy + pythonImportsCheckHook + ]; + + meta = { + description = "Utility for downloading fanfiction in bulk from the Archive of Our Own"; + changelog = "https://github.com/nianeyna/ao3downloader/releases/tag/v${version}"; + mainProgram = "ao3downloader"; + homepage = "https://nianeyna.dev/ao3downloader"; + license = lib.licenses.gpl3; + maintainers = [ lib.maintainers.samasaur ]; + }; +}