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 ]; + }; +} 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 7eafab6fc84a..25848319e518 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -11358,6 +11358,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 { };