summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2024-12-02 07:36:15 -0500
committerBen Sima <ben@bsima.me>2024-12-21 10:08:04 -0500
commitb3e113d2e1351ea1d48170a3433c2228ac2ae137 (patch)
treefa382c41ac2dccece918c8f759bc8fcc6b1fad52
parent442c0702502cae3ac4d7acd09f05635ec8378b06 (diff)
Package ludic
This required upgrading to python 3.12 because of some f-string format thing that ludic uses. It's kind of annoying but the upgrade was easy enough, so I just did it.
-rw-r--r--Omni/Bild.nix17
-rw-r--r--Omni/Bild/Deps/Python.nix2
-rw-r--r--Omni/Bild/Deps/ludic.nix36
-rw-r--r--Omni/Bild/Python.nix17
4 files changed, 59 insertions, 13 deletions
diff --git a/Omni/Bild.nix b/Omni/Bild.nix
index 6dd6e9d..90fa979 100644
--- a/Omni/Bild.nix
+++ b/Omni/Bild.nix
@@ -7,7 +7,7 @@ let
stable = let stable = nixpkgs.nixos-24_05;
in {
inherit (stable)
- sources lib makeWrapper ccacheStdenv haskell sbcl python3 nixos mkShell
+ sources lib makeWrapper ccacheStdenv haskell sbcl python312 nixos mkShell
dockerTools pkgs;
stdenv = stable.ccacheStdenv;
};
@@ -82,9 +82,9 @@ let
python = {
packages = self.lib.attrsets.getAttrs (import ./Bild/Deps/Python.nix)
- stable.python3.pkgs;
- pythonWith = stable.python3.withPackages;
- buildPythonApplication = stable.python3.pkgs.buildPythonApplication;
+ stable.python312.pkgs;
+ pythonWith = stable.python312.withPackages;
+ buildPythonApplication = stable.python312.pkgs.buildPythonApplication;
};
# c packages are just stable, filtered to just the list of deps i want
@@ -97,8 +97,12 @@ let
git-branchless gitlint groff guile hlint indent jq lolcat mypy nixfmt
ormolu pkg-config ripgrep rustc tree wemux;
llama-cpp = unstable.llama-cpp;
- llm = python3.withPackages
- (p: [ p.llm p.llm-ollama p.llm-sentence-transformers ]);
+ # can't put this in the dev namespace because it pulls in openai with
+ # python311, which conflicts with any other usage of openai with
+ # python312. so i need to make a target that exposese/wraps llm like i did
+ # with llamacpp
+ #llm = python311.withPackages
+ # (p: [ p.llm p.llm-ollama p.llm-sentence-transformers ]);
ollama = unstable.ollama;
ruff = unstable.ruff;
shellcheck = unstable.shellcheck;
@@ -215,7 +219,6 @@ let
gitlint
jq
lolcat
- llm
ormolu
ripgrep
tree
diff --git a/Omni/Bild/Deps/Python.nix b/Omni/Bild/Deps/Python.nix
index ba7a858..e36896a 100644
--- a/Omni/Bild/Deps/Python.nix
+++ b/Omni/Bild/Deps/Python.nix
@@ -1 +1 @@
-[ "cryptography" "llm" "mypy" "nltk" "slixmpp" "flask" "openai" ]
+[ "cryptography" "llm" "mypy" "nltk" "slixmpp" "flask" "openai" "ludic" ]
diff --git a/Omni/Bild/Deps/ludic.nix b/Omni/Bild/Deps/ludic.nix
new file mode 100644
index 0000000..dfac06c
--- /dev/null
+++ b/Omni/Bild/Deps/ludic.nix
@@ -0,0 +1,36 @@
+{ buildPythonPackage, fetchFromGitHub, lib, setuptools, pytestCheckHook
+, python-multipart, starlette, typeguard, pygments, pytest, pytest-cov, httpx
+, hatchling, hatch-vcs }:
+
+buildPythonPackage rec {
+ pname = "ludic";
+ version = "0.5.2";
+ pyproject = true;
+
+ src = fetchFromGitHub {
+ owner = "getludic";
+ repo = pname;
+ rev = "refs/tags/${version}";
+ hash = "sha256-Zcob2ljyeiCqnCobkDP4ihRTxvs5OtQ4y5+Itsgs/0o=";
+ };
+
+ nativeBuildInputs = [ setuptools hatchling hatch-vcs ];
+
+ propagatedBuildInputs = [ python-multipart starlette typeguard pygments ];
+
+ disabledTestPaths = [ "tests/contrib/test_django.py" ];
+
+ nativeCheckInputs = [ pytestCheckHook ];
+
+ checkInputs = [ pytest pytest-cov httpx ];
+
+ pythonImportsCheck = [ "ludic" ];
+
+ meta = with lib; {
+ homepage = "https://github.com/getludic/ludic";
+ description = "Web Development in Pure Python with Type-Guided Components.";
+ changelog = "https://github.com/getludic/ludic/releases/tag/${version}";
+ license = licenses.mit;
+ maintainers = with maintainers; [ bsima ];
+ };
+}
diff --git a/Omni/Bild/Python.nix b/Omni/Bild/Python.nix
index 6e4f390..23e9ecd 100644
--- a/Omni/Bild/Python.nix
+++ b/Omni/Bild/Python.nix
@@ -1,17 +1,24 @@
_self: super: {
- python3 = super.python3.override {
+ python312 = super.python312.override {
packageOverrides = _pyself: pysuper:
- with pysuper.pkgs.python3Packages;
+ with pysuper.pkgs.python312Packages;
let dontCheck = p: p.overridePythonAttrs (_: { doCheck = false; });
in {
interegular = callPackage ./Deps/interegular.nix { };
- llm-ollama = callPackage ./Deps/llm-ollama.nix { };
- llm-sentence-transformers =
- callPackage ./Deps/llm-sentence-transformers.nix { };
+ ludic = callPackage ./Deps/ludic.nix { };
mypy = dontCheck pysuper.mypy;
outlines = callPackage ./Deps/outlines.nix { };
perscache = callPackage ./Deps/perscache.nix { };
tokenizers = dontCheck pysuper.tokenizers;
};
};
+
+ python311 = super.python311.override {
+ packageOverrides = _pyself: pysuper:
+ with pysuper.pkgs.python311Packages; {
+ llm-ollama = callPackage ./Deps/llm-ollama.nix { };
+ llm-sentence-transformers =
+ callPackage ./Deps/llm-sentence-transformers.nix { };
+ };
+ };
}