-
Notifications
You must be signed in to change notification settings - Fork 17
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
top-level venv doesn't work #465
Comments
Thanks for reporting! To be honest this is the first time I've seen top-level venv, and I was not aware that keeping your source tree "inside" a virtualenv, like this, was even an option. I seem to remember that we have some code in FawltyDeps for automatically excluding the contents of virtualenvs when we search for code and dependency declarations. This is to avoid FawltyDeps analyzing and reporting problems with code that happened to be installed in a virtualenv, but that is not part of your project. I suspect that this check now regards your entire source tree as being "inside" a virtualenv and therefore excludes it... Will look into this as time permits. |
I have no idea how (un)canonical my approach is, it's a habit I've picked up a loooong time ago, and it has never bitten me before. Also, because venv does this Happy to hear more, though this is certainly not a blocker for me. |
This sample project has a virtualenv in the same directory as the project itself. Currently this causes FawltyDeps to find zero code and zero dependencies in the project.
Issue #465 highlights a peculiar case where the top-level project directory is also itself the root of a virtualenv. Our traversal code will skip any (given or detected) Python environment, under the assumption that we never want to analyze code/deps from a package installed within. However, we here have a special case where -- from the traversal code's POV -- we have found a pyenv rooted at a directory that also appears in the given settings.code and/or settings.deps (by default settings.code, settings.deps and settings.pyenvs are all "."). Work around this special case as follows: When a Python environment is found rooted at a path that is _also_ directly given in either settings.code or settings.deps, then we _don't_ want to skip traversal of the entire directory, rather we only skip traversal of the specific subdirectories that form the actual contents of the environment: - Any package dirs found by validate_pyenv_source() (i.e. any "site-packages" dirs). - The "bin/" (or "Scripts\" on Windows) subdir where we expect to find any tools installed into the environment. We could probably extend this handling to _any_ Python environment (including those found after we start the traversal proper), but I'm not 100% sure that this won't trigger false positives where some weird Python environment (e.g. a Conda or poetry2nix environment) happens to contain extra "stuff" missing from the above list that would adversely affect our analysis.
This sample project has a virtualenv in the same directory as the project itself. Currently this causes FawltyDeps to find zero code and zero dependencies in the project.
Issue #465 highlights a peculiar case where the top-level project directory is also itself the root of a virtualenv. Our traversal code will skip any (given or detected) Python environment, under the assumption that we never want to analyze code/deps from a package installed within. However, we here have a special case where -- from the traversal code's POV -- we have found a pyenv rooted at a directory that also appears in the given settings.code and/or settings.deps (by default settings.code, settings.deps and settings.pyenvs are all "."). Work around this special case as follows: When a Python environment is found rooted at a path that is _also_ directly given in either settings.code or settings.deps, then we _don't_ want to skip traversal of the entire directory, rather we only skip traversal of the specific subdirectories that form the actual contents of the environment: - Any package dirs found by validate_pyenv_source() (i.e. any "site-packages" dirs). - The "bin/" (or "Scripts\" on Windows) subdir where we expect to find any tools installed into the environment. We could probably extend this handling to _any_ Python environment (including those found after we start the traversal proper), but I'm not 100% sure that this won't trigger false positives where some weird Python environment (e.g. a Conda or poetry2nix environment) happens to contain extra "stuff" missing from the above list that would adversely affect our analysis.
This sample project has a virtualenv in the same directory as the project itself. Currently this causes FawltyDeps to find zero code and zero dependencies in the project.
Issue #465 highlights a peculiar case where the top-level project directory is also itself the root of a virtualenv. Our traversal code will skip any (given or detected) Python environment, under the assumption that we never want to analyze code/deps from a package installed within. However, we here have a special case where -- from the traversal code's POV -- we have found a pyenv rooted at a directory that also appears in the given settings.code and/or settings.deps (by default settings.code, settings.deps and settings.pyenvs are all "."). Work around this special case as follows: When a Python environment is found rooted at a path that is _also_ directly given in either settings.code or settings.deps, then we _don't_ want to skip traversal of the entire directory, rather we only skip traversal of the specific subdirectories that form the actual contents of the environment: - Any package dirs found by validate_pyenv_source() (i.e. any "site-packages" dirs). - The "bin/" (or "Scripts\" on Windows) subdir where we expect to find any tools installed into the environment. We could probably extend this handling to _any_ Python environment (including those found after we start the traversal proper), but I'm not 100% sure that this won't trigger false positives where some weird Python environment (e.g. a Conda or poetry2nix environment) happens to contain extra "stuff" missing from the above list that would adversely affect our analysis.
Describe the bug
When the virtualenv is the same as the project-dir, fawltydeps doesn't work
To Reproduce
When the venv is external, everything is fine:
Approach with "top level venv", however:
Being explicit doesn't help:
Expected behavior
I expect this to work equally well as when using a venv outside of the project-dir, or a deeply nested venv
Environment
The text was updated successfully, but these errors were encountered: