Skip to content

BaseExperiment abstract methods not enforced without ABC #660

@drbenvincent

Description

@drbenvincent

Description

BaseExperiment uses @abstractmethod decorators but does not inherit from ABC,
so Python does not enforce abstract methods. This allows instantiating incomplete
experiment subclasses without errors, which can lead to runtime failures later.

Steps to Reproduce

  1. Define a subclass of BaseExperiment without implementing abstract methods.
  2. Instantiate the subclass.

Expected Behavior

Instantiation should fail with a TypeError until all abstract methods are implemented.

Actual Behavior

Instantiation succeeds because BaseExperiment does not inherit from ABC.

Environment

  • CausalPy version: 0.7.0 (or current main)
  • Python version: 3.11+
  • OS: macOS (darwin)

Proposed Solution (if known)

Make BaseExperiment inherit from abc.ABC to enforce abstract methods.

Additional Context

Relevant file: causalpy/experiments/base.py.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions