Something went wrong. Try again.
Nix Packages collection & NixOS github.com/NixOS/nixpkgs
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156{ lib, stdenv, buildPythonPackage, fetchFromGitHub,
# build-system hatchling,
# dependencies azure-ai-documentintelligence, azure-identity, beautifulsoup4, charset-normalizer, defusedxml, lxml, magika, mammoth, markdownify, olefile, openpyxl, pandas, pdfminer-six, pdfplumber, pydub, python-pptx, requests, speechrecognition, xlrd, youtube-transcript-api,
# tests pytestCheckHook,
# passthru gitUpdater,}:
let isNotAarch64Linux = !(stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64);inbuildPythonPackage (finalAttrs: { pname = "markitdown"; version = "0.1.8"; pyproject = true;
src = fetchFromGitHub { owner = "microsoft"; repo = "markitdown"; tag = "v${finalAttrs.version}"; hash = "sha256-nOzhvIqyq5iV2pKeHqStKELFLRnTRF7+pbxHaV0XZ4s="; };
sourceRoot = "${finalAttrs.src.name}/packages/markitdown";
build-system = [ hatchling ];
pythonRelaxDeps = [ "magika" "mammoth" "youtube-transcript-api" ];
optional-dependencies = { all = [ python-pptx mammoth pandas openpyxl xlrd lxml pdfminer-six pdfplumber olefile pydub speechrecognition youtube-transcript-api azure-ai-documentintelligence azure-identity ]; pptx = [ python-pptx ]; docx = [ mammoth lxml ]; xlsx = [ pandas openpyxl ]; xls = [ pandas xlrd ]; pdf = [ pdfminer-six pdfplumber ]; outlook = [ olefile ]; audio-transcription = [ pydub speechrecognition ]; youtube-transcription = [ youtube-transcript-api ]; az-doc-intel = [ azure-ai-documentintelligence azure-identity ]; };
dependencies = [ beautifulsoup4 requests markdownify magika charset-normalizer defusedxml ];
# aarch64-linux fails cpuinfo test, because /sys/devices/system/cpu/ does not exist in the sandbox: # terminate called after throwing an instance of 'onnxruntime::OnnxRuntimeException' # # -> Skip all tests that require importing markitdown pythonImportsCheck = lib.optionals isNotAarch64Linux [ "markitdown" ]; doCheck = isNotAarch64Linux;
nativeCheckInputs = [ pytestCheckHook ] ++ finalAttrs.passthru.optional-dependencies.all;
disabledTests = [ # Require network access "test_markitdown_remote" "test_module_vectors" "test_cli_vectors" "test_module_misc"
# Require optional azure-ai-contentunderstanding, unavailable in nixpkgs. # The fallback stubs hit `UserAgentPolicy() takes no arguments`. "test_nonexistent_analyzer_raises_value_error" "test_cu_registered_before_docintel" ];
passthru.updateScript = gitUpdater { # Drop the "v" tag prefix before version comparison. rev-prefix = "v"; # Skip PEP 440 pre-release tags. ignoredVersions = "(a|b|rc)[0-9]+$"; };
meta = { description = "Python tool for converting files and office documents to Markdown"; homepage = "https://github.com/microsoft/markitdown"; changelog = "https://github.com/microsoft/markitdown/releases/tag/${finalAttrs.src.tag}"; license = lib.licenses.mit; maintainers = with lib.maintainers; [ malik ]; };})