# .importlinter – gpkit‑core architecture baseline (INI)
# ---------------------------------------------------------------------------
# This file encodes a layered architecture that matches the current reality
# while aiming for the desired future state (clean separation of primitives,
# algebra, modelling API, solver adapters, and interactive helpers).
#
# code may depend **downward** (toward lower‑numbered layers) but never upward.
# ---------------------------------------------------------------------------
[importlinter]
root_package = gpkit

# ---------------------------------------------------------------------------
# Contract 1: Layered architecture (highest first)
# ---------------------------------------------------------------------------
[importlinter:contract:layers]
name = layered dependencies
type = layers

layers =
    # Interactive/UI helpers (may import everything below)
    gpkit.interactive | gpkit.breakdowns | gpkit.tools

    # Model eventually goes here? user-friendly interface to model and solvers
    gpkit.model

    # mathematical optimization models
    gpkit.programs

    # GP representation and solver interfaces
    gpkit.solvers : gpkit.solutions

    # Modelling primitives + indexing
    gpkit.constraints

    # Algebra + mathematical objects
    gpkit.nomials

    # Variables and hashing
    gpkit.varkey | gpkit.varmap

    # small helpers that might evantually move or be eliminated
    gpkit.util

    # Pure primitives & units (no gpkit imports allowed)
    gpkit.units | gpkit.exceptions

# goal is to evantually eliminate the ignore list below via refactoring
ignore_imports =
    # the following import patterns exist today but should be eliminated
    gpkit.units -> gpkit.nomials
    gpkit.nomials.math -> gpkit.constraints
    gpkit.nomials.array -> gpkit.constraints
    gpkit.solutions -> gpkit.breakdowns
    gpkit.tools.autosweep -> gpkit.interactive.plot_sweep
    gpkit.model -> gpkit.tools.autosweep
    gpkit.constraints.* -> gpkit.globals
    gpkit.nomials.* -> gpkit.globals
    gpkit.programs.* -> gpkit.globals
    gpkit.solvers.mosek_cli -> gpkit.globals

# ---------------------------------------------------------------------------
# Contract 2: Keep test helpers independent of production code (optional)
# ---------------------------------------------------------------------------
[importlinter:contract:tests_are_isolated]
name  = tests must not be imported by src
type  = forbidden
source_modules      = gpkit.*
forbidden_modules   = tests.*
