diff --git a/pkgs/by-name/md/md2pdf/package.nix b/pkgs/by-name/md/md2pdf/package.nix new file mode 100644 index 0000000000000..32e608f76b838 --- /dev/null +++ b/pkgs/by-name/md/md2pdf/package.nix @@ -0,0 +1,9 @@ +{ + python3Packages, +}: + +python3Packages.toPythonApplication ( + python3Packages.md2pdf.overridePythonAttrs (oldAttrs: { + dependencies = oldAttrs.dependencies ++ oldAttrs.optional-dependencies.cli; + }) +) diff --git a/pkgs/development/python-modules/md2pdf/default.nix b/pkgs/development/python-modules/md2pdf/default.nix index 0870c6c31611e..ba17df6e1393d 100644 --- a/pkgs/development/python-modules/md2pdf/default.nix +++ b/pkgs/development/python-modules/md2pdf/default.nix @@ -1,6 +1,5 @@ { buildPythonPackage, - click, fetchFromGitHub, hatchling, jinja2, @@ -8,28 +7,30 @@ markdown, pygments, pymdown-extensions, + pypdf, pytest-cov-stub, pytestCheckHook, python-frontmatter, + typer, + watchfiles, weasyprint, }: buildPythonPackage rec { pname = "md2pdf"; - version = "2.1.0"; + version = "3.1.0"; pyproject = true; src = fetchFromGitHub { owner = "jmaupetit"; repo = "md2pdf"; tag = "v${version}"; - hash = "sha256-oVWUoWIS9GmkNPbJg90diT0jEgOULySSNxNdg95T2Vs="; + hash = "sha256-ksccl9K0o0mZleyLe1K1ob78W2MKZksTFtu6/dZUWeg="; }; build-system = [ hatchling ]; dependencies = [ - click jinja2 markdown pygments @@ -38,17 +39,37 @@ buildPythonPackage rec { weasyprint ]; + optional-dependencies = { + cli = [ + typer + watchfiles + ]; + latex = [ + # FIXME package markdown-latex + ]; + }; + pythonImportsCheck = [ "md2pdf" ]; nativeCheckInputs = [ + pypdf pytest-cov-stub pytestCheckHook - ]; + ] + ++ lib.concatAttrValues optional-dependencies; preCheck = '' export PATH="$out/bin:$PATH" ''; + disabledTests = [ + # AssertionError caused by + # glyph rendered for Unicode string unsupported by fonts: "👋" (U+1F44B) + "test_generate_pdf_with_jinja_context_input" + "test_generate_pdf_with_jinja_frontmatter_and_context_input" + "test_generate_pdf_with_jinja_frontmatter_input" + ]; + meta = { changelog = "https://github.com/jmaupetit/md2pdf/blob/${src.tag}/CHANGELOG.md"; description = "Markdown to PDF conversion tool"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c7f8486efcc71..33255de8e72a6 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2820,8 +2820,6 @@ with pkgs; md2gemini = with python3.pkgs; toPythonApplication md2gemini; - md2pdf = with python3Packages; toPythonApplication md2pdf; - mdcat = callPackage ../tools/text/mdcat { inherit (python3Packages) ansi2html; };