-
Notifications
You must be signed in to change notification settings - Fork 0
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
Make sure logger.getLogger() is used instead of logging directly via logging.debug() #91
Conversation
WalkthroughThe pull request introduces several changes across multiple files in the Possibly related PRs
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (3)
prymer/util/executable_runner.py (1)
147-159
: Add subprocess details to debug messages.Add process ID and command name to messages for better traceability.
- log.debug("Subprocess terminated successfully.") + log.debug(f"Subprocess {self._name} (pid={self._subprocess.pid}) terminated successfully.") - log.debug("Subprocess failed to terminate.") + log.debug(f"Subprocess {self._name} (pid={self._subprocess.pid}) failed to terminate.") - log.debug("Subprocess is not running.") + log.debug(f"Subprocess {self._name} is not running.")prymer/api/picking.py (1)
Line range hint
151-154
: Use Path object directly instead of f-string.Replace
f"{fasta_path}"
withstr(fasta_path)
for proper path handling.- with FastaFile(f"{fasta_path}") as fasta: + with FastaFile(str(fasta_path)) as fasta:prymer/primer3/primer3.py (1)
Line range hint
317-318
: Address the 'FIXME' commentThe
# FIXME
comment indicates that this code requires attention. Please resolve it before merging.Do you need assistance in addressing this issue or would you like me to open a GitHub issue to track it?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (5)
prymer/api/picking.py
(1 hunks)prymer/api/variant_lookup.py
(3 hunks)prymer/primer3/primer3.py
(1 hunks)prymer/primer3/primer3_failure_reason.py
(1 hunks)prymer/util/executable_runner.py
(2 hunks)
✅ Files skipped from review due to trivial changes (1)
- prymer/primer3/primer3_failure_reason.py
🔇 Additional comments (7)
prymer/util/executable_runner.py (1)
73-75
: LGTM. Logging change matches PR objectives.
prymer/api/picking.py (1)
Line range hint 144-148
: LGTM: Improved input validation.
Early return and reference validation prevent invalid primer combinations.
prymer/api/variant_lookup.py (3)
285-287
: LGTM: Logging change aligns with PR objectives.
Changed from direct logging to getLogger(__name__)
.
316-316
: LGTM: Logging change aligns with PR objectives.
Changed from direct logging to getLogger(__name__)
.
377-379
: LGTM: Logging change aligns with PR objectives.
Changed from direct logging to getLogger(__name__)
.
prymer/primer3/primer3.py (2)
271-271
: Good use of logger instances for logging
Updating the logging to use logging.getLogger(__name__)
is a good practice.
Line range hint 366-383
: Ensure compatibility with Python 3.10+
The use of match
statements requires Python 3.10 or higher. Confirm that the project supports Python 3.10+.
Run the following script to check the Python version specified in the project's configuration:
✅ Verification successful
Python version requirement is met
Project requires Python 3.11+, which fully supports match statements. No compatibility issues.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check the Python version requirements in setup.py and pyproject.toml.
# Search for 'python_requires' in setup.py
if [ -f setup.py ]; then
grep 'python_requires' setup.py
fi
# Search for 'requires-python' in pyproject.toml
if [ -f pyproject.toml ]; then
grep 'requires-python' pyproject.toml
fi
# Search for Python classifiers in setup.py
if [ -f setup.py ]; then
grep 'Programming Language :: Python ::' setup.py
fi
Length of output: 109
Script:
#!/bin/bash
# Check for Python version requirements in any configuration files
fd -e toml -e cfg -e ini -x cat {} \; | grep -i "python"
# Check for imports of Python 3.10+ features
rg "from \| import.*match" -A 2
# Look for CI configuration files that might specify Python versions
fd "\.github|tox.ini|\.travis" --type f -x cat {}
Length of output: 484
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #91 +/- ##
=======================================
Coverage 96.66% 96.66%
=======================================
Files 26 26
Lines 1707 1709 +2
Branches 331 331
=======================================
+ Hits 1650 1652 +2
Misses 31 31
Partials 26 26 ☔ View full report in Codecov by Sentry. |
This small PR ensures that anywhere that
prymer
logs it first gets a logger vialogging.getLogger(__name__)
, rather than just doinglogging.debug(....)
.The problem with
logging.debug()
(and similar methods directly on the logging module) is that they are side-effecting on the logging configuration. E.g. here's thedebug()
function inlogging
:This was causing me issues in a repo that uses
prymer
, where after the first one of these calls, I then received duplicate log messages for every subsequent log in my code.