diff --git a/pkgs/development/python-modules/latex2mathml/default.nix b/pkgs/development/python-modules/latex2mathml/default.nix new file mode 100644 index 000000000000..8737f0ef31da --- /dev/null +++ b/pkgs/development/python-modules/latex2mathml/default.nix @@ -0,0 +1,55 @@ +{ lib +, buildPythonPackage +, pythonOlder +, fetchFromGitHub +, poetry-core +, setuptools +, pytestCheckHook +, multidict +, xmljson +}: + +buildPythonPackage rec { + pname = "latex2mathml"; + version = "3.75.2"; + + disabled = pythonOlder "3.7"; + + src = fetchFromGitHub { + owner = "roniemartinez"; + repo = pname; + rev = version; + hash = "sha256-i/F1B/Rndg66tiKok1PDMK/rT5c2e8upnQrMSCTUzpU="; + }; + + format = "pyproject"; + + nativeBuildInputs = [ + poetry-core + ]; + + propagatedBuildInputs = [ + setuptools # needs pkg_resources at runtime + ]; + + nativeCheckInputs = [ + pytestCheckHook + multidict + xmljson + ]; + + # Disable code coverage in check phase + postPatch = '' + sed -i '/--cov/d' pyproject.toml + ''; + + pythonImportsCheck = [ "latex2mathml" ]; + + meta = with lib; { + description = "Pure Python library for LaTeX to MathML conversion"; + homepage = "https://github.com/roniemartinez/latex2mathml"; + changelog = "https://github.com/roniemartinez/latex2mathml/releases/tag/${version}"; + license = licenses.mit; + maintainers = with maintainers; [ sfrijters ]; + }; +} diff --git a/pkgs/development/python-modules/schemdraw/default.nix b/pkgs/development/python-modules/schemdraw/default.nix new file mode 100644 index 000000000000..c3da6e6edc79 --- /dev/null +++ b/pkgs/development/python-modules/schemdraw/default.nix @@ -0,0 +1,68 @@ +{ lib +, buildPythonPackage +, pythonOlder +, fetchFromBitbucket +, pyparsing +, matplotlib +, latex2mathml +, ziafont +, ziamath +, pytestCheckHook +, nbval +}: + +buildPythonPackage rec { + pname = "schemdraw"; + version = "0.16"; + format = "pyproject"; + + disabled = pythonOlder "3.8"; + + src = fetchFromBitbucket { + owner = "cdelker"; + repo = pname; + rev = version; + hash = "sha256-W9sXtYI8gEwQPRo50taEGT6AQG1tdAbeCtX49eHVvFQ="; + }; + + propagatedBuildInputs = [ + pyparsing + ]; + + passthru.optional-dependencies = { + matplotlib = [ + matplotlib + ]; + svgmath = [ + latex2mathml + ziafont + ziamath + ]; + }; + + nativeCheckInputs = [ + pytestCheckHook + nbval + matplotlib + latex2mathml + ziafont + ziamath + ]; + + # Strip out references to unfree fonts from the test suite + postPatch = '' + substituteInPlace test/test_styles.ipynb --replace "font='Times', " "" + ''; + + pytestFlagsArray = [ "--nbval-lax" ]; + + pythonImportsCheck = [ "schemdraw" ]; + + meta = with lib; { + description = "A package for producing high-quality electrical circuit schematic diagrams"; + homepage = "https://schemdraw.readthedocs.io/en/latest/"; + changelog = "https://schemdraw.readthedocs.io/en/latest/changes.html"; + license = licenses.mit; + maintainers = with maintainers; [ sfrijters ]; + }; +} diff --git a/pkgs/development/python-modules/ziafont/default.nix b/pkgs/development/python-modules/ziafont/default.nix new file mode 100644 index 000000000000..5fc1298b7907 --- /dev/null +++ b/pkgs/development/python-modules/ziafont/default.nix @@ -0,0 +1,39 @@ +{ lib +, buildPythonPackage +, pythonOlder +, fetchFromBitbucket +, pytestCheckHook +, nbval +}: + +buildPythonPackage rec { + pname = "ziafont"; + version = "0.5"; + + disabled = pythonOlder "3.8"; + + src = fetchFromBitbucket { + owner = "cdelker"; + repo = pname; + rev = version; + hash = "sha256-mTQ2yRG+E2nZ2g9eSg+XTzK8A1EgKsRfbvNO3CdYeLg="; + }; + + nativeCheckInputs = [ + pytestCheckHook + nbval + ]; + + preCheck = "rm test/manyfonts.ipynb"; # Tries to download fonts + + pytestFlagsArray = [ "--nbval-lax" ]; + + pythonImportsCheck = [ "ziafont" ]; + + meta = with lib; { + description = "Convert TTF/OTF font glyphs to SVG paths"; + homepage = "https://ziafont.readthedocs.io/en/latest/"; + license = licenses.mit; + maintainers = with maintainers; [ sfrijters ]; + }; +} diff --git a/pkgs/development/python-modules/ziamath/default.nix b/pkgs/development/python-modules/ziamath/default.nix new file mode 100644 index 000000000000..7a4d2520d87a --- /dev/null +++ b/pkgs/development/python-modules/ziamath/default.nix @@ -0,0 +1,45 @@ +{ lib +, buildPythonPackage +, pythonOlder +, fetchFromBitbucket +, ziafont +, pytestCheckHook +, nbval +, latex2mathml +}: + +buildPythonPackage rec { + pname = "ziamath"; + version = "0.7"; + + disabled = pythonOlder "3.8"; + + src = fetchFromBitbucket { + owner = "cdelker"; + repo = pname; + rev = version; + hash = "sha256-JuuCDww0EZEHZLxB5oQrWEJpv0szjwe4iXCRGl7OYTA="; + }; + + propagatedBuildInputs = [ + ziafont + ]; + + nativeCheckInputs = [ + pytestCheckHook + nbval + latex2mathml + ]; + + pytestFlagsArray = [ "--nbval-lax" ]; + + pythonImportsCheck = [ "ziamath" ]; + + meta = with lib; { + description = "Render MathML and LaTeX Math to SVG without Latex installation"; + homepage = "https://ziamath.readthedocs.io/en/latest/"; + changelog = "https://ziamath.readthedocs.io/en/latest/changes.html"; + license = licenses.mit; + maintainers = with maintainers; [ sfrijters ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a12e29e91d45..73a8cbffd9eb 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4795,6 +4795,8 @@ with pkgs; gladtex = callPackage ../tools/typesetting/tex/gladtex { }; + latex2mathml = with python3Packages; toPythonApplication latex2mathml; + latexrun = callPackage ../tools/typesetting/tex/latexrun { }; lkproof = callPackage ../tools/typesetting/tex/lkproof { }; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 1dd06b0ea27f..a15811290bb4 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -5341,6 +5341,8 @@ self: super: with self; { laszip = callPackage ../development/python-modules/laszip { }; + latex2mathml = callPackage ../development/python-modules/latex2mathml { }; + latexcodec = callPackage ../development/python-modules/latexcodec { }; latexify-py = callPackage ../development/python-modules/latexify-py { }; @@ -10529,6 +10531,8 @@ self: super: with self; { schema-salad = callPackage ../development/python-modules/schema-salad { }; + schemdraw = callPackage ../development/python-modules/schemdraw { }; + schiene = callPackage ../development/python-modules/schiene { }; schwifty = callPackage ../development/python-modules/schwifty { }; @@ -12934,6 +12938,10 @@ self: super: with self; { zha-quirks = callPackage ../development/python-modules/zha-quirks { }; + ziafont = callPackage ../development/python-modules/ziafont { }; + + ziamath = callPackage ../development/python-modules/ziamath { }; + zict = callPackage ../development/python-modules/zict { }; zigpy = callPackage ../development/python-modules/zigpy { };