From 595e53600f236ad10383884c700ddedcaca59e08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Bori?= Date: Mon, 8 Sep 2025 16:29:58 +0200 Subject: [PATCH 1/3] python3Packages.mediawiki-langcodes: init at 0.2.18 --- .../mediawiki-langcodes/default.nix | 37 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 39 insertions(+) create mode 100644 pkgs/development/python-modules/mediawiki-langcodes/default.nix diff --git a/pkgs/development/python-modules/mediawiki-langcodes/default.nix b/pkgs/development/python-modules/mediawiki-langcodes/default.nix new file mode 100644 index 000000000000..16de76c82d79 --- /dev/null +++ b/pkgs/development/python-modules/mediawiki-langcodes/default.nix @@ -0,0 +1,37 @@ +{ + lib, + buildPythonPackage, + setuptools, + fetchPypi, + pytestCheckHook, +}: + +buildPythonPackage (finalAttrs: { + pname = "mediawiki-langcodes"; + version = "0.2.18"; + pyproject = true; + + # Using fetchPypi instead of fetching from source for technical reason. + # It required Internet and Python scripts to build the database. + src = fetchPypi { + pname = "mediawiki_langcodes"; + inherit (finalAttrs) version; + hash = "sha256-9wHlISFD2Pc4qA+kAGR2yRXRby6NGkQRTOoamaoFCxU="; + }; + + build-system = [ setuptools ]; + + pythonImportsCheck = [ "mediawiki_langcodes" ]; + + nativeCheckInputs = [ + pytestCheckHook + ]; + + meta = { + description = "Convert MediaWiki language names and language codes"; + homepage = "https://github.com/xxyzz/mediawiki_langcodes"; + changelog = "https://github.com/xxyzz/mediawiki_langcodes/releases/tag/v${finalAttrs.version}"; + license = lib.licenses.gpl3Plus; + maintainers = with lib.maintainers; [ theobori ]; + }; +}) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index d1d597dc0282..789a5c0da8ca 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -9687,6 +9687,8 @@ self: super: with self; { mediapy = callPackage ../development/python-modules/mediapy { }; + mediawiki-langcodes = callPackage ../development/python-modules/mediawiki-langcodes { }; + medpy = callPackage ../development/python-modules/medpy { }; medvol = callPackage ../development/python-modules/medvol { }; From f750dd7e14e9ae248b93a38f24e158f267aaeeef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Bori?= Date: Mon, 8 Sep 2025 16:44:37 +0200 Subject: [PATCH 2/3] python3Packages.wikitextprocessor: init at 0.4.96-unstable-2026-03-06 --- .../wikitextprocessor/default.nix | 68 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 70 insertions(+) create mode 100644 pkgs/development/python-modules/wikitextprocessor/default.nix diff --git a/pkgs/development/python-modules/wikitextprocessor/default.nix b/pkgs/development/python-modules/wikitextprocessor/default.nix new file mode 100644 index 000000000000..339a140c7026 --- /dev/null +++ b/pkgs/development/python-modules/wikitextprocessor/default.nix @@ -0,0 +1,68 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + setuptools, + dateparser, + lupa, + lxml, + mediawiki-langcodes, + psutil, + requests, + pytestCheckHook, + unstableGitUpdater, +}: + +buildPythonPackage { + pname = "wikitextprocessor"; + version = "0.4.96-unstable-2026-03-06"; + pyproject = true; + + src = fetchFromGitHub { + owner = "tatuylonen"; + repo = "wikitextprocessor"; + fetchSubmodules = true; + rev = "9d9a410c45c06d30239bcc0d8c1a57718a3f7a2c"; + hash = "sha256-qhl9yRF2MUQvKXgcuxu20h6cEQofN1xMMb4JJZcFHS0="; + }; + + build-system = [ setuptools ]; + + pythonRelaxDeps = [ "dateparser" ]; + + dependencies = [ + dateparser + lupa + lxml + mediawiki-langcodes + psutil + requests + ]; + + pythonImportsCheck = [ "wikitextprocessor" ]; + + nativeCheckInputs = [ + pytestCheckHook + ]; + + disabledTests = [ + # It requires Internet + "test_process_dump" + # It attempts to write a readonly database + "test_fetchlanguage" + "test_language_parser_function" + ]; + + passthru.updateScript = unstableGitUpdater { }; + + meta = { + description = "Parser and expander for Wikipedia, Wiktionary etc. dump files, with Lua execution support"; + homepage = "https://github.com/tatuylonen/wikitextprocessor"; + license = with lib.licenses; [ + mit + cc-by-sa-40 # Needed for certain test files under Wiktionary licence + gpl2Plus # Needed for certain files in lua/mediawiki-extensions-Scribunto/ + ]; + maintainers = with lib.maintainers; [ theobori ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 789a5c0da8ca..a1045bce1702 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -21065,6 +21065,8 @@ self: super: with self; { wikitextparser = callPackage ../development/python-modules/wikitextparser { }; + wikitextprocessor = callPackage ../development/python-modules/wikitextprocessor { }; + willow = callPackage ../development/python-modules/willow { }; winacl = callPackage ../development/python-modules/winacl { }; From 158756b2209c2e5c31288a612e4bc10ea0afc4b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Bori?= Date: Mon, 8 Sep 2025 16:53:48 +0200 Subject: [PATCH 3/3] python3Packages.wiktextract: init at 1.99.7-unstable-2026-03-26 --- .../python-modules/wiktextract/default.nix | 51 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 53 insertions(+) create mode 100644 pkgs/development/python-modules/wiktextract/default.nix diff --git a/pkgs/development/python-modules/wiktextract/default.nix b/pkgs/development/python-modules/wiktextract/default.nix new file mode 100644 index 000000000000..a1e5f04d75f0 --- /dev/null +++ b/pkgs/development/python-modules/wiktextract/default.nix @@ -0,0 +1,51 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + setuptools, + levenshtein, + nltk, + pydantic, + wikitextprocessor, + unstableGitUpdater, +}: + +buildPythonPackage { + pname = "wiktextract"; + version = "1.99.7-unstable-2026-03-26"; + pyproject = true; + + src = fetchFromGitHub { + owner = "tatuylonen"; + repo = "wiktextract"; + rev = "f47b8fc87a0e17f4dcca68f534e73f4c6fa8e8e7"; + hash = "sha256-U9Xm3vRAvONN/DwyhEEM54eiBnv7JKAEXPolK9HfJU8="; + }; + + build-system = [ setuptools ]; + + dependencies = [ + levenshtein + nltk + pydantic + wikitextprocessor + ]; + + # It requires Internet + doCheck = false; + + pythonImportsCheck = [ "wiktextract" ]; + + passthru.updateScript = unstableGitUpdater { }; + + meta = { + description = "Wiktionary dump file parser and multilingual data extractor"; + homepage = "https://github.com/tatuylonen/wiktextract"; + license = with lib.licenses; [ + mit + cc-by-sa-40 # Needed for certain test files under Wiktionary licence + ]; + maintainers = with lib.maintainers; [ theobori ]; + mainProgram = "wiktwords"; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index a1045bce1702..ca1951e4faff 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -21067,6 +21067,8 @@ self: super: with self; { wikitextprocessor = callPackage ../development/python-modules/wikitextprocessor { }; + wiktextract = callPackage ../development/python-modules/wiktextract { }; + willow = callPackage ../development/python-modules/willow { }; winacl = callPackage ../development/python-modules/winacl { };