-
Notifications
You must be signed in to change notification settings - Fork 10
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
Find project root when run from a wheel (logger module) #43
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #43 +/- ##
==========================================
- Coverage 77.08% 76.80% -0.28%
==========================================
Files 13 13
Lines 1270 1272 +2
Branches 230 231 +1
==========================================
- Hits 979 977 -2
- Misses 201 204 +3
- Partials 90 91 +1 ☔ View full report in Codecov by Sentry. |
for leaf in ("pyproject.toml", "setup.py"): | ||
root = find_dir_with_leaf(this_path, leaf) | ||
if root is not None: | ||
return root | ||
# Wheel installation is under site-packages hence return the parent of site-packages | ||
if "site-packages" in __file: | ||
return Path(__file.split("site-packages")[0] + "site-packages/") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And what if there are many modules with "about.py"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is presenting a workaround since we don't do anything with PROJECT_ROOT variables, to answer your question it doesn't matter, the path is going to be set from Python env location where wheel file is installed.
Ideally just rewriting the get_logger to get module name directly would make sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please take a look at the usages of this function in the library.
As for remoph - logging.get_logger(name) might be enough. The utility of blueprint is to help only when name is main
use |
No description provided.