Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor annotations to console utility and use relative imports #10645

Merged
merged 4 commits into from
Nov 17, 2021

Conversation

ChristineTChen
Copy link
Contributor

What does this PR do?

This PR moves annotations to console util to prevent circular import error.

Also cleans up imports to use relative import

Motivation

Previously trying to import annotation utilities resulted in ImportError

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/christine.chen/dev/integrations-core/datadog_checks_dev/datadog_checks/dev/tooling/annotations.py", line 10, in <module>
    from .commands.console import echo_failure, echo_warning
  File "/Users/christine.chen/dev/integrations-core/datadog_checks_dev/datadog_checks/dev/tooling/commands/__init__.py", line 9, in <module>
    from .dep import dep
  File "/Users/christine.chen/dev/integrations-core/datadog_checks_dev/datadog_checks/dev/tooling/commands/dep.py", line 20, in <module>
    from .validate.licenses import extract_classifier_value
  File "/Users/christine.chen/dev/integrations-core/datadog_checks_dev/datadog_checks/dev/tooling/commands/validate/__init__.py", line 7, in <module>
    from .agent_reqs import agent_reqs
  File "/Users/christine.chen/dev/integrations-core/datadog_checks_dev/datadog_checks/dev/tooling/commands/validate/agent_reqs.py", line 7, in <module>
    from ...annotations import annotate_error
ImportError: cannot import name 'annotate_error' from partially initialized module 'datadog_checks.dev.tooling.annotations' (most likely due to a circular import) (/Users/christine.chen/dev/integrations-core/datadog_checks_dev/datadog_checks/dev/tooling/annotations.py)

Additional Notes

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • PR title must be written as a CHANGELOG entry (see why)
  • Files changes must correspond to the primary purpose of the PR as described in the title (small unrelated changes should have their own PR)
  • PR must have changelog/ and integration/ labels attached

@codecov
Copy link

codecov bot commented Nov 15, 2021

Codecov Report

Merging #10645 (7a9dfca) into master (bc134ef) will increase coverage by 0.02%.
The diff coverage is 90.00%.

Flag Coverage Δ
datadog_checks_dev 80.05% <90.00%> (+0.29%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Copy link
Contributor

@ofek ofek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Co-authored-by: Ofek Lev <ofekmeister@gmail.com>
@ChristineTChen ChristineTChen merged commit 970de2d into master Nov 17, 2021
@ChristineTChen ChristineTChen deleted the cc/fix-imports branch November 17, 2021 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants