Repository navigation
chore(v1): reduce public API surface - #2698
Merged
Merged
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
SBrandeis
marked this pull request as ready for review
November 16, 2026 16:49
SBrandeis
force-pushed
the
chore/cleanup-public-api-2
branch
2 times, most recently
from
November 17, 2026 14:59
892c36a to
73c019b
Compare
Nothing outside bitcannon uses them. Atom itself stays pub: it is the value set classify() writes into its public tags output.
Json, its accessors, MAX_DEPTH and json::Error's fields are only used by the reader in tk-serialize. json::Error itself stays pub for now: the umbrella re-exports the json module, so the compiler cannot tell who names it.
Buckets, Bucket, AddedTokenFlags, BucketVocabStore and its key hashing, plus AddedVocabulary's lookup accessors, are only used inside tk-encode.
get_vocab, get_vocab_size, id_to_token and token_to_id on Unigram, WordLevel, PipelineWordPiece and PipelineModel are only called by PipelineTokenizer, which keeps its own pub lookups.
…the crate Lattice's insert, piece, len, bos_node, eos_node, sample and sample_nbest, Node::new, Unigram's alpha and nbest_size fields, and UnigramError are only used inside tk-encode.
Only the BPE model uses them.
…rate WordLevelBuilder::new and WordPieceBuilder::new are reached through WordLevel::builder() and WordPiece::builder(); nothing outside tk-encode reads WordPiece's max_input_chars_per_word field.
PipelineTokenizer's resolve_padding and resolve_truncation, PreTokenizerScratch's split_on_bytes, split_on_bits, take_pair and put_pair, and Template's has_type_ids and post_process are only called inside tk-encode.
The Pattern trait, Invert, Split's Search enum and search field, and whitespace::is_word_char are only used by tk-encode's pre-tokenizers.
Only its Default impl calls it; tk-serialize builds the unit struct directly.
…egex::find_iter to the crate Only tk-encode uses them.
Unigram, its only caller, calls content() directly. Now that the store is crate-private the alias was dead in builds without the unigram feature.
ENV_VARIABLE, get_parallelism and num_threads are only read by tk-encode's pool setup; set_num_threads stays pub as the library knob.
Since MB went pub(crate), a target without a classify kernel (scalar wasm32, riscv64) flags it as dead, which broke the bitcannon wasm clippy job.
split, its SplitPolicy, split_delimiter and split_matches are only called by tk-encode's pre-tokenizers. split and SplitPolicy need no re-export at all.
Only Split and the regex recognizer use it. Its last pub use, Split::grammar, was removed as test-only.
SBrandeis
force-pushed
the
chore/cleanup-public-api-2
branch
2 times, most recently
from
November 17, 2026 15:57
73c019b to
1d3efcc
Compare
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR
Reduce the amount of
pubmembers in the library