File tree Expand file tree Collapse file tree 1 file changed +37
-40
lines changed
pkgs/development/python-modules/xgrammar Expand file tree Collapse file tree 1 file changed +37
-40
lines changed Original file line number Diff line number Diff line change 33 stdenv ,
44 buildPythonPackage ,
55 fetchFromGitHub ,
6+
7+ # build-system
68 cmake ,
79 ninja ,
8- pip ,
9- pytestCheckHook ,
10- python3 ,
1110 pybind11 ,
11+ scikit-build-core ,
12+
13+ # dependencies
1214 pydantic ,
1315 sentencepiece ,
1416 tiktoken ,
1517 torch ,
1618 transformers ,
1719 triton ,
20+
21+ # tests
22+ pytestCheckHook ,
23+ writableTmpDirAsHomeHook ,
1824} :
1925
2026buildPythonPackage rec {
2127 pname = "xgrammar" ;
22- version = "0.1.11 " ;
23- format = "other" ;
28+ version = "0.1.14 " ;
29+ pyproject = true ;
2430
2531 src = fetchFromGitHub {
2632 owner = "mlc-ai" ;
27- repo = pname ;
33+ repo = "xgrammar" ;
2834 tag = "v${ version } " ;
29- hash = "sha256-q5d8/9S9p9M8HlCIernT9IwPEDnbC1R9nGsLuS15RXY=" ;
3035 fetchSubmodules = true ;
36+ hash = "sha256-ohsoc3g5XUp9vSXxyOGj20wXzCXZC02ktHYVQjDqNeM=" ;
3137 } ;
3238
33- nativeBuildInputs = [
39+ build-system = [
3440 cmake
3541 ninja
42+ pybind11
43+ scikit-build-core
3644 ] ;
45+ dontUseCmakeConfigure = true ;
3746
38- buildInputs = [ pip ] ;
39-
40- dontUseNinjaInstall = true ;
41-
42- installPhase = ''
43- runHook preInstall
44-
45- cd ../python
46- ${ python3 . interpreter } -m pip install --prefix=$out .
47- cd ..
48-
49- runHook postInstall
50- '' ;
47+ dependencies =
48+ [
49+ pydantic
50+ sentencepiece
51+ tiktoken
52+ torch
53+ transformers
54+ ]
55+ ++ lib . optionals ( stdenv . hostPlatform . isLinux && stdenv . hostPlatform . isx86_64 ) [
56+ triton
57+ ] ;
5158
52- nativeCheckInputs = [ pytestCheckHook ] ;
53-
54- preCheck = ''
55- cd tests/python/
56- '' ;
59+ nativeCheckInputs = [
60+ pytestCheckHook
61+ writableTmpDirAsHomeHook
62+ ] ;
5763
5864 disabledTests = [
5965 # You are trying to access a gated repo.
@@ -64,27 +70,18 @@ buildPythonPackage rec {
6470 "test_grammar_matcher_json_schema"
6571 "test_grammar_matcher_tag_dispatch"
6672 "test_regex_converter"
73+ "test_tokenizer_info"
74+
6775 # Torch not compiled with CUDA enabled
6876 "test_token_bitmask_operations"
69- # You are trying to access a gated repo.
70- "test_tokenizer_info"
7177 ] ;
7278
7379 pythonImportsCheck = [ "xgrammar" ] ;
7480
75- dependencies = [
76- pybind11
77- pydantic
78- sentencepiece
79- tiktoken
80- torch
81- transformers
82- triton
83- ] ;
84-
85- meta = with lib ; {
81+ meta = {
8682 description = "Efficient, Flexible and Portable Structured Generation" ;
8783 homepage = "https://xgrammar.mlc.ai" ;
88- license = licenses . asl20 ;
84+ changelog = "https://github.com/mlc-ai/xgrammar/releases/tag/v${ version } " ;
85+ license = lib . licenses . asl20 ;
8986 } ;
9087}
You can’t perform that action at this time.
0 commit comments