question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with Context annotations

See original GitHub issue

Since the Context class is in the same file as the code that imports the mutmut_config, it cannot be used for the annotations. We are extensively using annotations in our code and want to do the same for mutmut_config.py. The issue is probably caused by cyclic import error and is shout since the import exceptions are in try-except.

I suggest moving the class into a separate module. In general, I think it’s a good idea to separate the code into a few modules.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
henryh9ncommented, Oct 16, 2020

Hm… well, I don’t think moving the class to another module will help much, as you’d still trigger the import in __init__.py to get to a submodule right?

You’d have to make PR that changes the code so that the mutmut_config isn’t imported automatically like that. This seems like a good change anyway since this is more of a hack than a good design imo. Maybe something like a function in mutmut/__init__.py called read_config that does looks something like this:

def read_config():
    try:
        import mutmut_config as mc
        global mutmut_config
        mutmut_config = mc
    except ImportError:
        pass

and then make sure that it’s called by main().

Let me think a bit over this later today, I’ll propose smt in a PR

1reaction
boxedcommented, Oct 16, 2020

Hm… well, I don’t think moving the class to another module will help much, as you’d still trigger the import in __init__.py to get to a submodule right?

You’d have to make PR that changes the code so that the mutmut_config isn’t imported automatically like that. This seems like a good change anyway since this is more of a hack than a good design imo. Maybe something like a function in mutmut/__init__.py called read_config that does looks something like this:

def read_config():
    try:
        import mutmut_config as mc
        global mutmut_config
        mutmut_config = mc
    except ImportError:
        pass

and then make sure that it’s called by main().

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tweet annotations - Twitter Developers
Context annotations are delivered as a context_annotations field in the payload. These annotations are inferred based on semantic analysis (keywords, hashtags, ...
Read more >
Annotation for context definition | ContextDefinition.php
When providing plugin annotations, contexts can be defined to support UI interactions through providing limits, and mapping contexts to appropriate plugins.
Read more >
twitterdev/twitter-context-annotations: Flat files ... - GitHub
We aim to provide an updated file ~quarterly to encompass new entities that have been added – so please check back in a...
Read more >
Problem with annotation spring context with differ modules
I made application based on spring annotation configuration. This application is moduled, i'm build it with maven. I scan application to find ...
Read more >
problem building a rest api with @Context annotation
I have a lot of parameters posted to the REST api I am trying to build. So I want to use the @Context...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found