Skip to content
This repository was archived by the owner on Nov 6, 2025. It is now read-only.
This repository was archived by the owner on Nov 6, 2025. It is now read-only.

Rewrite of the utils.py module #63

@malik-irain

Description

@malik-irain

The utils.py file could be modified to contain functions that are not really related but may be useful in other files and to be safely imported without circular dependencies. For the moment, it depends on 4 other pymodaq_utils modules:

  • logger, but nothing is logged (so it could be removed)
  • warnings.deprecation_msg, this modules doesn't include anything from pymodaq_utils so it is safe to include
  • serialization module for ThreadCommand but they could be moved to their own file
  • config using as a default parameter in PlotColors (to move to their own file) and get_new_file_name that is never used (so it could be deleted)

Here is an example of how it is troublesome:

I'm modifying config.py to change the config folder name. I would like this folder name to be computed once, so I defined it as a global formatted string. To build it I need two functions, one to guess the environment name and one to compute a hash depending on the version number.

The hash function could be defined in config.py, but doing so prevents its import in anything config depends on and is not "semantically" correct, so I would like to define it in utils.py but it is not importable in config.

The environment guessing function already exists and is in environment.py, bug environment.py includes config, so I can't import the function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions