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

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.

Activity

  1. malik-irain commented on Sep 16, 2025

    @malik-irain
    ContributorAuthor

    What's your opinion on this @seb5g

  2. malik-irain commented on Sep 16, 2025

    @malik-irain
    ContributorAuthor

    Solved by creating a env_utils.py with both functions

  3. seb5g commented on Sep 16, 2025

    @seb5g
    Contributor

    could you link the PR that solves this issue?

  4. malik-irain commented on Sep 16, 2025

    @malik-irain
    ContributorAuthor

    It wasn't really an issue more of a discussion, but that to implement what's in #64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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