# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

DISTUTILS_EXT=1
DISTUTILS_USE_PEP517=maturin
PYTHON_COMPAT=( python3_{11..14} )
PYPI_NO_NORMALIZE=1
PYPI_PN=outlines_core

RUST_MIN_VER="1.85.0"
CRATES="
	adler2@2.0.1
	ahash@0.8.12
	aho-corasick@1.1.4
	atomic-waker@1.1.2
	autocfg@1.5.0
	aws-lc-rs@1.15.2
	aws-lc-sys@0.35.0
	base64@0.13.1
	base64@0.22.1
	bincode@2.0.1
	bincode_derive@2.0.1
	bitflags@2.10.0
	bumpalo@3.19.1
	byteorder@1.5.0
	bytes@1.11.0
	castaway@0.2.4
	cc@1.2.52
	cfg-if@1.0.4
	cfg_aliases@0.2.1
	cmake@0.1.57
	compact_str@0.9.0
	console@0.15.11
	crc32fast@1.5.0
	crossbeam-deque@0.8.6
	crossbeam-epoch@0.9.18
	crossbeam-utils@0.8.21
	darling@0.20.11
	darling_core@0.20.11
	darling_macro@0.20.11
	dary_heap@0.3.8
	derive_builder@0.20.2
	derive_builder_core@0.20.2
	derive_builder_macro@0.20.2
	dirs-sys@0.4.1
	dirs@5.0.1
	displaydoc@0.2.5
	dunce@1.0.5
	either@1.15.0
	encode_unicode@1.0.0
	equivalent@1.0.2
	esaxx-rs@0.1.10
	find-msvc-tools@0.1.7
	flate2@1.1.5
	fnv@1.0.7
	form_urlencoded@1.2.2
	fs_extra@1.3.0
	futures-channel@0.3.31
	futures-core@0.3.31
	futures-io@0.3.31
	futures-macro@0.3.31
	futures-sink@0.3.31
	futures-task@0.3.31
	futures-util@0.3.31
	getrandom@0.2.16
	getrandom@0.3.4
	hashbrown@0.16.1
	heck@0.5.0
	hf-hub@0.4.1
	http-body-util@0.1.3
	http-body@1.0.1
	http@1.4.0
	httparse@1.10.1
	hyper-rustls@0.27.7
	hyper-util@0.1.19
	hyper@1.8.1
	icu_collections@2.1.1
	icu_locale_core@2.1.1
	icu_normalizer@2.1.1
	icu_normalizer_data@2.1.1
	icu_properties@2.1.2
	icu_properties_data@2.1.2
	icu_provider@2.1.1
	ident_case@1.0.1
	idna@1.1.0
	idna_adapter@1.2.1
	indexmap@2.13.0
	indicatif@0.17.11
	indoc@2.0.7
	ipnet@2.11.0
	iri-string@0.7.10
	itertools@0.14.0
	itoa@1.0.17
	jobserver@0.1.34
	js-sys@0.3.83
	libc@0.2.180
	libredox@0.1.12
	litemap@0.8.1
	log@0.4.29
	lru-slab@0.1.2
	macro_rules_attribute-proc_macro@0.2.2
	macro_rules_attribute@0.2.2
	memchr@2.7.6
	memoffset@0.9.1
	minimal-lexical@0.2.1
	miniz_oxide@0.8.9
	mio@1.1.1
	monostate-impl@0.1.18
	monostate@0.1.18
	nom@7.1.3
	number_prefix@0.4.0
	once_cell@1.21.3
	onig@6.5.1
	onig_sys@69.9.1
	option-ext@0.2.0
	paste@1.0.15
	percent-encoding@2.3.2
	pin-project-lite@0.2.16
	pin-utils@0.1.0
	pkg-config@0.3.32
	portable-atomic@1.13.0
	potential_utf@0.1.4
	ppv-lite86@0.2.21
	proc-macro2@1.0.105
	pyo3-build-config@0.27.2
	pyo3-ffi@0.27.2
	pyo3-macros-backend@0.27.2
	pyo3-macros@0.27.2
	pyo3@0.27.2
	python3-dll-a@0.2.14
	quinn-proto@0.11.13
	quinn-udp@0.5.14
	quinn@0.11.9
	quote@1.0.43
	r-efi@5.3.0
	rand@0.8.5
	rand@0.9.2
	rand_chacha@0.3.1
	rand_chacha@0.9.0
	rand_core@0.6.4
	rand_core@0.9.3
	rayon-cond@0.4.0
	rayon-core@1.13.0
	rayon@1.11.0
	redox_users@0.4.6
	regex-automata@0.4.13
	regex-syntax@0.8.8
	regex@1.12.2
	reqwest@0.12.28
	ring@0.17.14
	rustc-hash@2.1.1
	rustls-pki-types@1.13.2
	rustls-webpki@0.103.8
	rustls@0.23.36
	rustversion@1.0.22
	ryu@1.0.22
	serde-pyobject@0.8.0
	serde@1.0.228
	serde_core@1.0.228
	serde_derive@1.0.228
	serde_json@1.0.149
	serde_urlencoded@0.7.1
	shlex@1.3.0
	simd-adler32@0.3.8
	slab@0.4.11
	smallvec@1.15.1
	socket2@0.6.1
	socks@0.3.4
	spm_precompiled@0.1.4
	stable_deref_trait@1.2.1
	static_assertions@1.1.0
	strsim@0.11.1
	subtle@2.6.1
	syn@2.0.114
	sync_wrapper@1.0.2
	synstructure@0.13.2
	target-lexicon@0.13.4
	thiserror-impl@1.0.69
	thiserror-impl@2.0.17
	thiserror@1.0.69
	thiserror@2.0.17
	tinystr@0.8.2
	tinyvec@1.10.0
	tinyvec_macros@0.1.1
	tokenizers@0.22.2
	tokio-rustls@0.26.4
	tokio-util@0.7.18
	tokio@1.49.0
	tower-http@0.6.8
	tower-layer@0.3.3
	tower-service@0.3.3
	tower@0.5.2
	tracing-core@0.1.36
	tracing@0.1.44
	try-lock@0.2.5
	unicode-ident@1.0.22
	unicode-normalization-alignments@0.1.12
	unicode-segmentation@1.12.0
	unicode-width@0.2.2
	unicode_categories@0.1.1
	unindent@0.2.4
	untrusted@0.9.0
	unty@0.0.4
	ureq@2.12.1
	url@2.5.8
	utf8_iter@1.0.4
	version_check@0.9.5
	virtue@0.0.18
	want@0.3.1
	wasi@0.11.1+wasi-snapshot-preview1
	wasip2@1.0.1+wasi-0.2.4
	wasm-bindgen-futures@0.4.56
	wasm-bindgen-macro-support@0.2.106
	wasm-bindgen-macro@0.2.106
	wasm-bindgen-shared@0.2.106
	wasm-bindgen@0.2.106
	wasm-streams@0.4.2
	web-sys@0.3.83
	web-time@1.1.0
	webpki-roots@0.26.11
	webpki-roots@1.0.5
	winapi-i686-pc-windows-gnu@0.4.0
	winapi-x86_64-pc-windows-gnu@0.4.0
	winapi@0.3.9
	windows-link@0.2.1
	windows-sys@0.48.0
	windows-sys@0.52.0
	windows-sys@0.59.0
	windows-sys@0.60.2
	windows-sys@0.61.2
	windows-targets@0.48.5
	windows-targets@0.52.6
	windows-targets@0.53.5
	windows_aarch64_gnullvm@0.48.5
	windows_aarch64_gnullvm@0.52.6
	windows_aarch64_gnullvm@0.53.1
	windows_aarch64_msvc@0.48.5
	windows_aarch64_msvc@0.52.6
	windows_aarch64_msvc@0.53.1
	windows_i686_gnu@0.48.5
	windows_i686_gnu@0.52.6
	windows_i686_gnu@0.53.1
	windows_i686_gnullvm@0.52.6
	windows_i686_gnullvm@0.53.1
	windows_i686_msvc@0.48.5
	windows_i686_msvc@0.52.6
	windows_i686_msvc@0.53.1
	windows_x86_64_gnu@0.48.5
	windows_x86_64_gnu@0.52.6
	windows_x86_64_gnu@0.53.1
	windows_x86_64_gnullvm@0.48.5
	windows_x86_64_gnullvm@0.52.6
	windows_x86_64_gnullvm@0.53.1
	windows_x86_64_msvc@0.48.5
	windows_x86_64_msvc@0.52.6
	windows_x86_64_msvc@0.53.1
	wit-bindgen@0.46.0
	writeable@0.6.2
	yoke-derive@0.8.1
	yoke@0.8.1
	zerocopy-derive@0.8.33
	zerocopy@0.8.33
	zerofrom-derive@0.1.6
	zerofrom@0.1.6
	zeroize@1.8.2
	zerotrie@0.2.3
	zerovec-derive@0.11.2
	zerovec@0.11.5
	zmij@1.0.12
"

inherit cargo distutils-r1 pypi

DESCRIPTION="Structured text generation core engine in Rust"
HOMEPAGE="
	https://github.com/dottxt-ai/outlines-core
	https://pypi.org/project/outlines_core/
"
SRC_URI+="
	${CARGO_CRATE_URIS}
"

LICENSE="Apache-2.0"
# Dependent crate licenses
LICENSE+="
	0BSD Apache-2.0 BSD-2 BSD ISC MIT MPL-2.0 Unicode-3.0 ZLIB
"
SLOT="0"
KEYWORDS="~amd64"

# Tests pull torch + numpy + numba + scipy + asv (sci-stack heavyweights);
# the binding builds and is exercised by upstream CI.
RESTRICT="test"

QA_FLAGS_IGNORED="usr/lib/python3.*/site-packages/outlines_core/outlines_core.*.so"