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

Obey stacklevel in warnings.warn for loguru output #2656

Merged

Conversation

nikosavola
Copy link
Member

@nikosavola nikosavola commented Apr 5, 2024

As an example, these two statements are now both printed with the same linenumber in the same file

Loguru

2024-04-05 12:15:41.127 | WARNING  | gdsfactory.pdk:get_cross_section:532 - UserWarning: CrossSection.copy() only modifies the attributes of the first section.

Warnings

/home/niko/dev/gdsfactory/gdsfactory/pdk.py:532: UserWarning: CrossSection.copy() only modifies the attributes of the first section.
  return cross_section.copy(**kwargs)

Additionally, disables using warnings.showwarnings and makes the gdsfactory defaults only print using loguru, closes #2588

@nikosavola nikosavola requested a review from joamatab April 5, 2024 09:19
@nikosavola nikosavola self-assigned this Apr 5, 2024
@nikosavola nikosavola linked an issue Apr 5, 2024 that may be closed by this pull request
Copy link

github-actions bot commented Apr 5, 2024

Label error. Requires at least 1 of: breaking, bug, github_actions, documentation, dependencies, enhancement, feature, maintenance, security. Found: python

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @nikosavola - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 1 issue found
  • 🟢 Docstrings: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

gdsfactory/config.py Outdated Show resolved Hide resolved
gdsfactory/config.py Show resolved Hide resolved
Copy link

codecov bot commented Apr 5, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 71.77%. Comparing base (2d77845) to head (f1502ef).

Files Patch % Lines
gdsfactory/config.py 50.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2656      +/-   ##
==========================================
- Coverage   71.79%   71.77%   -0.02%     
==========================================
  Files         366      366              
  Lines       23754    23756       +2     
  Branches     3873     3874       +1     
==========================================
- Hits        17053    17052       -1     
- Misses       5576     5578       +2     
- Partials     1125     1126       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nikosavola nikosavola added the python Pull requests that update Python code label Apr 5, 2024
@nikosavola nikosavola merged commit a41be05 into main Apr 5, 2024
10 of 14 checks passed
@nikosavola nikosavola deleted the 2589-obey-stacklevel-in-warningswarn-for-loguru-output branch April 5, 2024 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Pull requests that update Python code
Projects
None yet
2 participants