Skip to content

Flatten pub-use-star re-exports into explicit public API #76

@darinkishore

Description

@darinkishore

Problem

Every mod.rs does pub use foo::* and lib.rs re-exports everything:

pub use adapter::chat::*;
pub use augmentation::*;
pub use core::*;
pub use data::*;
// ... etc

This makes the entire crate flat at the root — hundreds of items. Consequences:

  • Name collisions (e.g. Prediction vs Predicted, DSRs ToolCall vs rig ToolCall)
  • Impossible to tell what's public API vs internal
  • IDE autocomplete noise
  • Adding anything to any submodule automatically becomes public

Proposal

Move to explicit re-exports at the crate root:

// Core types users need
pub use core::{Module, Signature, Predict, Predicted, CallMetadata, PredictError, LM};
pub use core::signature::SignatureSchema;
// ... etc

Keep pub mod for submodules so users can reach internals via dspy_rs::core::whatever if needed, but the root namespace should be curated.

Impact

  • Breaking change for downstream code that relies on flat imports
  • But the crate is pre-1.0, so this is the time to do it

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions