-
Notifications
You must be signed in to change notification settings - Fork 178
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
[ANE-949] Deep / Transitive dependencies for setuptool projects #1334
Conversation
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.
Added some comments as I'm working through it - would be able to wrap up review later today.
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.
- Gr8 work, this will have noticeable impact for our python users!
- One more change (mostly on discovery end)!
Other bits,
- Add integration test (since this will be heavily used by our python users)
-- integration-test/Analysis/SetuptoolsSpec.hs
-- Here is templated fixture, it may be easier to simply
-- perform fixture/test without below pattern, if you are
-- running into issue with nixEnv, and buildCommand
-- To test this locally:
-- cabal test integration-tests --test-show-details=streaming --test-option=--format=checks --test-option=--match --test-option="wildCardForTest"
pythonDynamic :: AnalysisTestFixture (Setuptools.SetuptoolsProject)
pythonDynamic =
AnalysisTestFixture
"pythonDynamic"
Setuptools.discover
LocalEnvironment -- You may have to use nix env and build cmd
Nothing -- Build command pip install, and virtual env, etc,
$ FixtureArtifact
"https://github.com/pallets/flask/archive/refs/tags/2.0.2.tar.gz"
[reldir|python/setuptools/flask/|]
[reldir|flask-2.0.2/|]
spec :: Spec
spec = do
testSuiteDepResultSummary pythonDynamic SetuptoolsProjectType $
DependencyResultsSummary
numDeps
numDirectDeps
numEdges
numManifestFiles
Complete
- Update changelog before merge!
- [Optional] Include example project in example-project repo
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.
Overview
PR adds support for determining deep / transitive dependencies for setuptool python projects (seutp.py, setup.cfg, requirements.txt). This is done by shelling out to
python -m pip list
andpython -m pip show
.pip list
will give us a list of installed packages, wherepip show
will give us package dependencies. If neither python nor pip are installed then we fall back to current implements.For req*.txt - only transitive dependencies for packages found in a req*.txt file will be reported.
For setup.py/setup.cfg, we attempt to parse the name, if a name is found we attempt to find a package installed with the same name and add transitives dependencies for those dependencies. If we cannot parse the name, or do not find a package installed with the same name, we fall back to only reporting the direct dependencies parsed in the config file.
Acceptance criteria
Testing plan
python -m venv ~/envs/test-fossa-cli
, make sure you are in the python env if you need to runsource ~/envs/test-fossa-cli/activate
pip install -r requirements.txt
pip install .
,Risks
Metrics
Is this change something that can or should be tracked? If so, can we do it today? And how? If its easy, do it
References
Checklist
docs/
.Changelog.md
. If this PR did not mark a release, I added my changes into an# Unreleased
section at the top..fossa.yml
orfossa-deps.{json.yml}
, I updateddocs/references/files/*.schema.json
. You may also need to update these if you have added/removed new dependency type (e.g.pip
) or analysis target type (e.g.poetry
).docs/references/subcommands/<subcommand>.md
.