You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My project uses requirements.txt to define dependencies. We use the httpx library. When running deptry, it incorrectly parses this entry as a dependency specified from URL:
$ grep httpx requirements.txt
httpx==0.25.2
$ pre-commit run --all-files
Could not parse dependency name from url httpx==0.25.2
The dependency parser incorrectly interprets the line as containing a URL.
Subsequently it throws a DEP003 because the dependency is imported but not detected as being specified in the requirements.txt (even though it is there): sample.py:1:0: DEP003 'httpx' imported but it is a transitive dependency.
As a workaround, I have added an ignore to my pyproject.toml:
[tool.deptry.per_rule_ignores]
DEP003 = ["httpx"]
I think a fix would be to improve the _line_is_url function or its regex here
Maybe changing the matcher from http|https to http://|https:// would fix the problem without impacting the intended functionality.
To Reproduce
Steps to reproduce the behavior:
Specify requirements.txt dependency starting with http
Optional - Import this dependency somewhere in your code
Run deptry
Expected behavior
System [please complete the following information]:
OS: macOS Sonoma
Language Version: Python 3.11
Poetry version: N/A, using pip
Additional context
N/A
The text was updated successfully, but these errors were encountered:
Describe the bug
My project uses requirements.txt to define dependencies. We use the
httpx
library. When running deptry, it incorrectly parses this entry as a dependency specified from URL:The dependency parser incorrectly interprets the line as containing a URL.
Subsequently it throws a DEP003 because the dependency is imported but not detected as being specified in the requirements.txt (even though it is there):
sample.py:1:0: DEP003 'httpx' imported but it is a transitive dependency
.As a workaround, I have added an ignore to my pyproject.toml:
I think a fix would be to improve the
_line_is_url
function or its regex hereMaybe changing the matcher from
http|https
tohttp://|https://
would fix the problem without impacting the intended functionality.To Reproduce
Steps to reproduce the behavior:
Expected behavior
System [please complete the following information]:
Additional context
N/A
The text was updated successfully, but these errors were encountered: