Skip to content

refactor: introduce scoped constants modules for shared package defaults #46

@yueswater

Description

@yueswater

Overview

Introduce a scoped constants/ layout for package-level shared defaults, while keeping example-only configuration out of the library surface.

Motivation

The codebase already has several meaningful constants (for example canvas DPI limits, export defaults, logging namespace, and plotting heuristics), but they are currently scattered across individual modules. A focused constants layout would improve discoverability and consistency without turning every literal into a global constant.

Proposed scope

Create econ_viz/constants/ for library-level, cross-module constants only.

Suggested modules:

  • econ_viz/constants/canvas.py
  • econ_viz/constants/io.py
  • econ_viz/constants/logging.py

Move or centralize candidates such as:

  • canvas DPI bounds / default DPI
  • math-text detection characters
  • contour-domain lower bound used for utility plots
  • smoothing / endpoint-extension defaults
  • savefig defaults shared by exporters
  • library logging root name

Explicit non-goals

Do not move:

  • model dataclass default parameters
  • theme definitions / colors from themes/
  • categorical enums from enums/
  • example-specific animation configuration into package constants

Follow-up structure

If example configuration also needs cleanup, handle that separately under something like:

  • examples/constants/animation.py

Acceptance criteria

  • Add a focused econ_viz/constants/ package with high-cohesion modules
  • Update existing modules to import shared constants from there where it improves reuse
  • Avoid a catch-all constants dump; keep ownership clear by domain
  • Leave example-only configuration outside the main library package unless it becomes reusable
  • Preserve current behaviour and test coverage

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions