You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Magika 2.0: custom rules, and one fast pipeline for the CLI, Python and C #1537
This issue tracks the work that puts Magika's rules and speed in the library, where every front end gets them, instead of in the CLI alone. Each PR below is self-contained and says Part of this issue.
Design
The low-level library API stays the real API:
Builder/Runtime;
FeaturesOrRuled::extract_file / extract_content;
Session::identify_features_batch.
Integrators build their own pipelines on it.
Custom rules live in Options (Options::custom_rules, a cheaply cloned Rules), so extraction applies them in any pipeline.
Order: custom rules, then built-in rules, then the model, each when enabled.
Veto: custom rules veto the model the same way built-in rules do since Veto ML output when rules have no false negatives #1529. A content type whose enforced rules are all class = "full" is vetoed when none of them matched.
Shared orchestration for our front ends lives in magika::pipeline, behind a pipeline feature that is off by default, and uses the public API only.
Engine: identifies from any thread, on the CPU at once and on the GPU once it's ready.
Pipeline: parallel walk, read, batch, infer and reorder.
Front ends: the CLI, Python and C use these helpers instead of their own copies.
Custom rules before the built-in rules: library Options::custom_rules, CLI --rules-file / --rules-check, Python rules= / rules_files=, C magika_rules_new; includes two fixes to #1529 (GPU tests; veto when features were extracted without rules)
This issue tracks the work that puts Magika's rules and speed in the library, where every front end gets them, instead of in the CLI alone. Each PR below is self-contained and says
Part ofthis issue.Design
The low-level library API stays the real API:
Builder/Runtime;FeaturesOrRuled::extract_file/extract_content;Session::identify_features_batch.Integrators build their own pipelines on it.
Custom rules live in
Options(Options::custom_rules, a cheaply clonedRules), so extraction applies them in any pipeline.class = "full"is vetoed when none of them matched.Shared orchestration for our front ends lives in
magika::pipeline, behind apipelinefeature that is off by default, and uses the public API only.Engine: identifies from any thread, on the CPU at once and on the GPU once it's ready.Pipeline: parallel walk, read, batch, infer and reorder.PRs in progress
Options::custom_rules, CLI--rules-file/--rules-check, Pythonrules=/rules_files=, Cmagika_rules_new; includes two fixes to #1529 (GPU tests; veto when features were extracted without rules)EngineandPipelineinmagika::pipeline(feature off by default); CLI, Python and C use them; Cmagika_engine_identify_pathsidentify_stream; fixes #1403, carries #1426 forward with its authorstrorbytesinidentify_paths(@kaluli123123); fixes #1472mainmainMerged earlier, from splitting #1447
Closed
Next
Rules: preparation and packaging
rust/rules/rulesets/{full,partial,notworking}/*.yar.rust/sync.shregenerates the committedsrc/bundled.rsand the rule labels, whichrust/genchecks against the knowledge base YAML.bundled.rsis stale.Testing
rust/test.sh(library, CLI, rules, C, generator),rust/changelog.sh, and the Python suite against the PyO3 build.🤖 Generated with Claude Code