Skip to content

common options for scverse #17

@flying-sheep

Description

@flying-sheep

To keep the discussion going: The first part (general settings base class) is now implemented, question is how we do the common options. I imagine something like a global settings class that subclasses the new Settings, let's call it GlobalSettings, and a SCVERSE_GLOBAL sentinel value. Using another base class inheriting from Settings, let's call it PackageSettings, we can check on attribute access if a value is set to SCVERSE_GLOBAL and return the global setting in that case, otherwise the actual value. Packages could then subclass PackageSettings.

This scheme allows users to change settings for specific packages, but I'm not sure where GlobalSettings is supposed to live so user can change global settings as well. Putting it into scverse-misc feels weird, since this is mostly a developer-oriented package. So far I can see three options:

  1. have packages re-export the global settings instance
  2. make a new package just for this
  3. add a context manager to PackageSettings so users can do something like
with settings.set_global_settings:
    settings.n_jobs = 42

Originally posted by @ilia-kats in #8

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